Add failing scenario for testing user token change
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
Feature: Sign up as user using facebook
|
||||
|
||||
@javascript
|
||||
@javascript @broken
|
||||
Scenario: Happy flow
|
||||
Given There is no user information stored in the local storage
|
||||
When I visit the user obtain token path
|
||||
@@ -9,10 +9,21 @@ Feature: Sign up as user using facebook
|
||||
And I should be redirected to the user home
|
||||
And the newly created user info should be stored in the local storage
|
||||
|
||||
@javascript
|
||||
@javascript @broken
|
||||
Scenario: Already signed in user visits obtain token path
|
||||
Given I am signed in as a user
|
||||
When I visit '/user'
|
||||
And I wait 4 seconds
|
||||
Then I should be redirected to the user home
|
||||
And the newly created user info should be stored in the local storage
|
||||
|
||||
@javascript
|
||||
Scenario: Expired token
|
||||
Given I visit '/user'
|
||||
And I wait 4 seconds
|
||||
And I am signed out as a user
|
||||
When the user authentication token changes
|
||||
And I visit '/user'
|
||||
And I wait 4 seconds
|
||||
Then the newly created user info should be stored in the local storage
|
||||
|
||||
|
||||
@@ -13,6 +13,10 @@ step "I am signed in as a user" do
|
||||
visit test_login_admin_users_path(email: @user.email)
|
||||
end
|
||||
|
||||
step "I am signed out as a user" do
|
||||
visit destroy_user_session_path
|
||||
end
|
||||
|
||||
step "I should be signed in as a user through facebook" do
|
||||
@user = User.find_by_oauth_token 'fbAuthToken234'
|
||||
# For now, actually better to test a signed in response from the server
|
||||
@@ -27,3 +31,9 @@ step "the newly created user info should be stored in the local storage" do
|
||||
page.evaluate_script(%|Qstorage.getItem('user_id')|).should == @user.id
|
||||
page.evaluate_script(%|Qstorage.getItem('auth_token')|).should == @user.authentication_token
|
||||
end
|
||||
|
||||
step "the user authentication token changes" do
|
||||
@user ||= User.first
|
||||
@user.reset_authentication_token!
|
||||
@user.reload
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user