2009-05-22 23:14:40 +02:00
Given / ^the following user records?$ / do | table |
2009-06-30 12:22:17 +02:00
User . delete_all
2009-05-22 23:14:40 +02:00
table . hashes . each do | hash |
2012-04-30 13:51:42 +02:00
user = FactoryGirl . create ( :user , hash )
2011-08-18 12:48:59 +02:00
user . create_preference ( { :locale = > 'en' } )
2009-04-17 08:56:11 +02:00
end
end
2013-05-13 17:13:26 +02:00
Given ( " no users exists " ) do
User . delete_all
end
When ( / ^I change my password to "([^"]*)"$ / ) do | password |
2012-02-21 20:18:26 +01:00
step 'I should be on the change password page'
2012-03-19 14:05:54 +01:00
fill_in " user[password] " , :with = > password
fill_in " user[password_confirmation] " , :with = > password
2012-02-21 20:18:26 +01:00
click_button " Change password "
2011-09-09 17:49:42 +02:00
end
2010-05-03 21:26:48 +02:00
When / ^I delete the user "([^ \ "]*)"$ / do | username |
# click "//tr[@id='user-3']//img"
# assert_confirmation "Warning: this will delete user 'john', all their actions, contexts, project and notes. Are you sure that you want to continue?"
2013-02-27 20:02:01 +01:00
user = User . where ( :login = > username ) . first
2014-05-16 15:42:03 -04:00
expect ( user ) . to_not be_nil
2010-05-03 21:26:48 +02:00
2012-02-21 20:18:26 +01:00
handle_js_confirm do
page . find ( :xpath , " //tr[@id='user- #{ user . id } ']//img " ) . click
end
2014-05-16 15:42:03 -04:00
expect ( get_confirm_text ) . to eq ( " Warning: this will delete user ' #{ user . login } ', all their actions, contexts, project and notes. Are you sure that you want to continue? " )
2012-02-21 20:18:26 +01:00
2014-05-16 15:42:03 -04:00
expect ( page ) . to_not have_css ( " tr # user- #{ user . id } " )
2010-05-03 21:26:48 +02:00
end
Then / ^I should see that a user named "([^ \ "]*)" is not present$ / do | username |
2012-02-21 20:18:26 +01:00
step " I should not see \" #{ username } ( \" "
2010-05-03 21:26:48 +02:00
end
2009-05-22 23:14:40 +02:00
Then " I should be an admin " do
# just check on the presence of the menu item for managing users
2012-02-21 20:18:26 +01:00
step " I should see \" Manage users \" "
2009-06-30 12:22:17 +02:00
end