Failing cucumber scenario for issue #305.
This commit is contained in:
parent
487e92214e
commit
5e8aebbfa5
@ -3,31 +3,37 @@ Feature: Login
|
||||
As an administrator
|
||||
I want to log in
|
||||
|
||||
Background:
|
||||
Given I have the site: "test site" set up
|
||||
Background:
|
||||
Given I have the site: "test site" set up
|
||||
|
||||
Scenario: Successfully logging in
|
||||
When I go to login
|
||||
And I fill in "Email" with "admin@locomotiveapp.org"
|
||||
And I fill in "Password" with "easyone"
|
||||
And I press "Log in"
|
||||
Then I should see "Listing pages"
|
||||
Scenario: Successfully logging in
|
||||
When I go to login
|
||||
And I fill in "Email" with "admin@locomotiveapp.org"
|
||||
And I fill in "Password" with "easyone"
|
||||
And I press "Log in"
|
||||
Then I should see "Listing pages"
|
||||
|
||||
Scenario: Attempting to login with an invalid emai or password
|
||||
When I go to login
|
||||
And I fill in "Email" with "admin@locomotiveapp.org"
|
||||
And I fill in "Password" with ""
|
||||
And I press "Log in"
|
||||
Then I should not see "Listing pages"
|
||||
And I should see "Invalid email or password"
|
||||
Scenario: Attempting to login with an invalid emai or password
|
||||
When I go to login
|
||||
And I fill in "Email" with "admin@locomotiveapp.org"
|
||||
And I fill in "Password" with ""
|
||||
And I press "Log in"
|
||||
Then I should not see "Listing pages"
|
||||
And I should see "Invalid email or password"
|
||||
|
||||
Scenario: Attempting to login with an account without a membership
|
||||
Given the following accounts exist:
|
||||
| email | password | password_confirmation |
|
||||
| john@locomotiveapp.org | bluecheese | bluecheese |
|
||||
When I go to login
|
||||
And I fill in "Email" with "john@locomotiveapp.org"
|
||||
And I fill in "Password" with "bluecheese"
|
||||
And I press "Log in"
|
||||
Then I should not see "Listing pages"
|
||||
And I should see "not a member of this site"
|
||||
Scenario: Attempting to login with an account without a membership
|
||||
Given the following accounts exist:
|
||||
| email | password | password_confirmation |
|
||||
| john@locomotiveapp.org | bluecheese | bluecheese |
|
||||
When I go to login
|
||||
And I fill in "Email" with "john@locomotiveapp.org"
|
||||
And I fill in "Password" with "bluecheese"
|
||||
And I press "Log in"
|
||||
Then I should not see "Listing pages"
|
||||
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
|
||||
|
@ -28,6 +28,28 @@ Then /^I am redirected to "([^\"]*)"$/ do |url|
|
||||
visit location
|
||||
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
|
||||
|
||||
When /^I forget to press the button on the cross-domain notice page$/ do
|
||||
|
Loading…
Reference in New Issue
Block a user