Files
mozo-backend/spec/acceptance_steps/users/authentication_steps.rb
T
2013-11-06 15:58:23 +01:00

30 lines
1.0 KiB
Ruby

step "There is no user information stored in the local storage" do
page.evaluate_script(%|Qstorage.getItem('user_id')|).should be_blank
page.evaluate_script(%|Qstorage.getItem('auth_token')|).should be_blank
end
step "I visit the user obtain token path" do
visit user_obtain_token_path
end
step "I am signed in as a user" do
@user ||= create :user
visit test_login_admin_users_path(email: @user.email)
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
step "the newly created user info should be stored in the local storage"
end
step "I should be redirected to the user home" do
page.current_path.should == user_root_path
end
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