fix login cukes
This commit is contained in:
parent
72f718c8c3
commit
9b563e39da
4 changed files with 21 additions and 12 deletions
|
|
@ -1,17 +1,13 @@
|
|||
@javascript
|
||||
Feature: user authentication
|
||||
|
||||
Scenario: user logs in
|
||||
Given a user with username "ohai" and password "secret"
|
||||
When I go to the new user session page
|
||||
And I fill in "Username" with "ohai"
|
||||
And I fill in "Password" with "secret"
|
||||
And I press "Sign in"
|
||||
When I sign in manually as "ohai" with password "secret"
|
||||
Then I should be on the stream page
|
||||
|
||||
@javascript
|
||||
Scenario: user logs out
|
||||
Given I am signed in
|
||||
And I click on my name in the header
|
||||
And I follow "Log out"
|
||||
And I wait for 1 seconds
|
||||
Then I should be on the new user session page
|
||||
Then I should be on the new user session page
|
||||
|
|
|
|||
|
|
@ -15,10 +15,13 @@ When /^I try to sign in$/ do
|
|||
end
|
||||
|
||||
When /^I try to sign in manually$/ do
|
||||
step %(I go to the new user session page)
|
||||
step %(I fill in "Username" with "#{@me.username}")
|
||||
step %(I fill in "Password" with "#{@me.password}")
|
||||
step %(I press "Sign in")
|
||||
visit login_page
|
||||
login_as @me.username, @me.password
|
||||
end
|
||||
|
||||
When /^I (?:sign|log) in manually as "([^"]*)" with password "([^"]*)"$/ do |username, password|
|
||||
visit login_page
|
||||
login_as username, password
|
||||
end
|
||||
|
||||
When /^I (?:sign|log) in as "([^"]*)"$/ do |email|
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@ module NavigationHelpers
|
|||
raise "Can't find mapping from \"#{page_name}\" to a path."
|
||||
end
|
||||
end
|
||||
|
||||
def login_page
|
||||
path_to "the new user session page"
|
||||
end
|
||||
end
|
||||
|
||||
World(NavigationHelpers)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,12 @@ module UserCukeHelpers
|
|||
user.aspects.create(:name => "Besties")
|
||||
user.aspects.create(:name => "Unicorns")
|
||||
end
|
||||
|
||||
def login_as(user, pass)
|
||||
fill_in 'user_username', :with=>user
|
||||
fill_in 'user_password', :with=>pass
|
||||
click_button :submit
|
||||
end
|
||||
end
|
||||
|
||||
World(UserCukeHelpers)
|
||||
World(UserCukeHelpers)
|
||||
|
|
|
|||
Loading…
Reference in a new issue