From faaa06f0dcb04dcb234c19d92b60f1f5e56f2bea Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Wed, 1 Oct 2014 11:29:31 +0200 Subject: [PATCH] add failing spec --- spec/acceptance/users/sign_up_with_facebook.feature | 10 +++++++++- spec/acceptance_steps/global_list_steps.rb | 4 ---- spec/acceptance_steps/users/authentication_steps.rb | 9 +++++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/spec/acceptance/users/sign_up_with_facebook.feature b/spec/acceptance/users/sign_up_with_facebook.feature index 71c847de..3d3f9ea2 100644 --- a/spec/acceptance/users/sign_up_with_facebook.feature +++ b/spec/acceptance/users/sign_up_with_facebook.feature @@ -3,7 +3,7 @@ Feature: Sign up as user using facebook @javascript Scenario: Happy flow - Given There is no user information stored in the local storage + Given there is no user information stored in the local storage When I visit the user obtain token path Then I should be signed in as a user through facebook When I wait 4 seconds @@ -28,5 +28,13 @@ Feature: Sign up as user using facebook And I wait 4 seconds Then the newly created user info should be stored in the local storage + @javascipt + Scenario: Authenciation when there is a list already active + Given there is a confirmed and open supplier + And there is a user + And the user has an active order + When the user authenticates with facebook + Then the user should be redirected to the active list page + Scenario: Facebook problem OmniAuth.config.mock_auth[:facebook] = :invalid_credentials Scenario: Valid facebook login, but declines information requested by scope diff --git a/spec/acceptance_steps/global_list_steps.rb b/spec/acceptance_steps/global_list_steps.rb index 4e7967e6..ed80c744 100644 --- a/spec/acceptance_steps/global_list_steps.rb +++ b/spec/acceptance_steps/global_list_steps.rb @@ -36,7 +36,3 @@ step 'a new order on a table in another section is created' do @new_list = create :list, section: @other_section, table: @other_table, supplier: @supplier, user_ids: [@user.id] @new_order = @new_list.place_order(products: {@product.id => 3}, user: @user) end - -step "I am signed in as a user" do - step "I visit the user obtain token path" -end diff --git a/spec/acceptance_steps/users/authentication_steps.rb b/spec/acceptance_steps/users/authentication_steps.rb index 64200a9d..4d93bd50 100644 --- a/spec/acceptance_steps/users/authentication_steps.rb +++ b/spec/acceptance_steps/users/authentication_steps.rb @@ -1,5 +1,5 @@ -step "There is no user information stored in the local storage" do +step "there is no user information stored in the local storage" do visit '/' page.execute_script %|Qstorage = window.localStorage| page.evaluate_script(%|Qstorage.getItem('user_id')|).should be_blank @@ -10,8 +10,13 @@ step "I visit the user obtain token path" do visit user_root_path # obtain token through ember application end -step "I am signed in as a user" do +step "there is a user" do @user ||= create :user +end + +step "I am signed in as a user" do + step "there is a confirmed and open supplier" + step "there is a user" visit test_login_admin_users_path(email: @user.email) end