admin_steps.rb revision f0887817e25c082838f50d260e6a3d4e69a14bdf
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen BolloffGiven(/^I am logged in as a admin$/) do
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff @admin = FactoryGirl.create :admin
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff login_as @admin, :scope => :user
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloffend
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen BolloffGiven(/^there is a user$/) do
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff @user = FactoryGirl.create :user
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff @user_name = @user.name
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloffend
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen BolloffWhen(/^I visit the users overview page$/) do
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff visit admin_users_path
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloffend
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen BolloffWhen(/^I visit the users edit page$/) do
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff within(:css, '#list_users') do
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff @edit_button = first(:css, 'tbody > tr').find_link('edit')
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff @edit_button.click
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff end
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloffend
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen BolloffWhen(/^I change the name of the user$/) do
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff fill_in 'Name', with: "NewUser"
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloffend
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen BolloffWhen(/^I submit the form$/) do
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff click_button('Update User')
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloffend
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen BolloffThen(/^I should see the users overview page and the updated user$/) do
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff within(:css, '#list_users') do
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff expect(page).to have_content("NewUser")
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff expect(page).not_to have_content("@user_name")
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloff end
f0887817e25c082838f50d260e6a3d4e69a14bdfEileen Bolloffend