Failing cucumber scenario for issue #305.

This commit is contained in:
Mario Visic 2012-03-03 23:18:08 +08:00
parent 487e92214e
commit 5e8aebbfa5
2 changed files with 53 additions and 25 deletions

View File

@ -31,3 +31,9 @@ Scenario: Attempting to login with an account without a membership
And I press "Log in" And I press "Log in"
Then I should not see "Listing pages" Then I should not see "Listing pages"
And I should see "not a member of this site" And I should see "not a member of this site"
Scenario: Being redirected to the previous admin page after login
Given I have an admin account
And I attempt to access an admin page when not logged in
When I login with my admin account
Then I should be redirected the the admin page I was attempting to access

View File

@ -28,6 +28,28 @@ Then /^I am redirected to "([^\"]*)"$/ do |url|
visit location visit location
end end
Given /^I have an admin account$/ do
@member = Site.first.memberships.where(:role => 'admin').first || FactoryGirl.create(:admin, :site => Site.first, :password => 'easyone')
@email = @member.account.email
@password = 'easyone'
end
Given /^I attempt to access an admin page when not logged in$/ do
@admin_path = edit_admin_current_site_path
visit @admin_path
end
When /^I login with my admin account$/ do
fill_in 'Email', :with => @email
fill_in 'Password', :with => @password
click_button 'Log in'
end
Then /^I should be redirected the the admin page I was attempting to access$/ do
save_and_open_page
current_path.should == edit_admin_current_site_path
end
### Cross-domain authentication ### Cross-domain authentication
When /^I forget to press the button on the cross-domain notice page$/ do When /^I forget to press the button on the cross-domain notice page$/ do