solidus_auth_devise 2.5.9 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/.git-blame-ignore-revs +2 -0
  3. data/.github/workflows/test.yml +22 -0
  4. data/.rubocop.yml +0 -8
  5. data/Gemfile +33 -19
  6. data/README.md +1 -1
  7. data/Rakefile +5 -5
  8. data/app/models/spree/user.rb +3 -12
  9. data/app/patches/controllers/solidus_auth_devise/application_controller_patch.rb +29 -0
  10. data/bin/rspec +16 -0
  11. data/config/initializers/devise.rb +7 -5
  12. data/config/routes.rb +31 -31
  13. data/db/default/users.rb +5 -5
  14. data/db/migrate/20101026184949_create_users.rb +19 -19
  15. data/db/migrate/20101026184950_rename_columns_for_devise.rb +1 -3
  16. data/db/migrate/20101214150824_convert_user_remember_field.rb +1 -1
  17. data/db/migrate/20120203010234_add_reset_password_sent_at_to_spree_users.rb +1 -1
  18. data/db/migrate/20120605211305_make_users_email_index_unique.rb +1 -1
  19. data/db/migrate/20140904000425_add_deleted_at_to_users.rb +1 -1
  20. data/db/migrate/20141002154641_add_confirmable_to_users.rb +1 -1
  21. data/db/migrate/20190125170630_add_reset_password_token_index_to_spree_users.rb +3 -3
  22. data/db/migrate/20200417153503_add_unconfirmed_email_to_spree_users.rb +1 -1
  23. data/db/seeds.rb +1 -1
  24. data/lib/controllers/backend/spree/admin/user_passwords_controller.rb +3 -3
  25. data/lib/controllers/backend/spree/admin/user_sessions_controller.rb +7 -7
  26. data/lib/controllers/frontend/spree/user_confirmations_controller.rb +1 -1
  27. data/lib/controllers/frontend/spree/user_passwords_controller.rb +2 -2
  28. data/lib/controllers/frontend/spree/user_registrations_controller.rb +2 -2
  29. data/lib/controllers/frontend/spree/user_sessions_controller.rb +6 -6
  30. data/lib/controllers/frontend/spree/users_controller.rb +5 -4
  31. data/lib/generators/solidus/auth/install/install_generator.rb +7 -7
  32. data/lib/generators/solidus/auth/install/templates/config/initializers/devise.rb.erb +4 -0
  33. data/lib/generators/solidus_auth_devise/install/install_generator.rb +2 -2
  34. data/lib/{decorators/backend/controllers/spree/admin/base_controller_decorator.rb → patches/backend/controllers/solidus_auth_devise/admin/base_controller_patch.rb} +2 -2
  35. data/lib/patches/backend/controllers/solidus_auth_devise/admin/orders/customer_details_controller_patch.rb +28 -0
  36. data/lib/{decorators/frontend/controllers/spree/checkout_controller_decorator.rb → patches/frontend/controllers/solidus_auth_devise/checkout_controller_patch.rb} +7 -7
  37. data/lib/solidus_auth_devise/configuration.rb +1 -1
  38. data/lib/solidus_auth_devise/engine.rb +1 -1
  39. data/lib/solidus_auth_devise/version.rb +1 -1
  40. data/lib/solidus_auth_devise.rb +9 -11
  41. data/lib/spree/auth/engine.rb +10 -15
  42. data/lib/spree/auth/version.rb +1 -1
  43. data/lib/tasks/auth.rake +1 -1
  44. data/solidus_auth_devise.gemspec +20 -21
  45. metadata +19 -96
  46. data/.circleci/config.yml +0 -73
  47. data/.rubocop_todo.yml +0 -397
  48. data/lib/decorators/backend/controllers/spree/admin/orders/customer_details_controller_decorator.rb +0 -22
  49. data/lib/generators/solidus/auth/install/templates/config/initializers/devise.rb +0 -3
  50. data/lib/spree/authentication_helpers.rb +0 -27
  51. data/spec/controllers/spree/admin/base_controller_spec.rb +0 -53
  52. data/spec/controllers/spree/admin/user_passwords_controller_spec.rb +0 -14
  53. data/spec/controllers/spree/admin/user_sessions_controller_spec.rb +0 -20
  54. data/spec/controllers/spree/base_controller_spec.rb +0 -53
  55. data/spec/controllers/spree/checkout_controller_spec.rb +0 -192
  56. data/spec/controllers/spree/products_controller_spec.rb +0 -24
  57. data/spec/controllers/spree/user_passwords_controller_spec.rb +0 -45
  58. data/spec/controllers/spree/user_registrations_controller_spec.rb +0 -97
  59. data/spec/controllers/spree/user_sessions_controller_spec.rb +0 -125
  60. data/spec/controllers/spree/users_controller_spec.rb +0 -79
  61. data/spec/factories/confirmed_user.rb +0 -9
  62. data/spec/features/account_spec.rb +0 -59
  63. data/spec/features/admin/password_reset_spec.rb +0 -80
  64. data/spec/features/admin/products_spec.rb +0 -10
  65. data/spec/features/admin/sign_in_spec.rb +0 -45
  66. data/spec/features/admin/sign_out_spec.rb +0 -42
  67. data/spec/features/admin_permissions_spec.rb +0 -47
  68. data/spec/features/change_email_spec.rb +0 -27
  69. data/spec/features/checkout_spec.rb +0 -158
  70. data/spec/features/confirmation_spec.rb +0 -28
  71. data/spec/features/order_spec.rb +0 -59
  72. data/spec/features/password_reset_spec.rb +0 -37
  73. data/spec/features/sign_in_spec.rb +0 -53
  74. data/spec/features/sign_out_spec.rb +0 -26
  75. data/spec/features/sign_up_spec.rb +0 -31
  76. data/spec/mailers/user_mailer_spec.rb +0 -47
  77. data/spec/models/order_spec.rb +0 -27
  78. data/spec/models/user_spec.rb +0 -103
  79. data/spec/requests/spree/frontend/user_update_spec.rb +0 -42
  80. data/spec/spec_helper.rb +0 -33
  81. data/spec/support/ability.rb +0 -17
  82. data/spec/support/authentication_helpers.rb +0 -16
  83. data/spec/support/confirm_helpers.rb +0 -27
  84. data/spec/support/email.rb +0 -7
  85. data/spec/support/features/fill_addresses_fields.rb +0 -29
  86. data/spec/support/preferences.rb +0 -13
  87. data/spec/support/spree.rb +0 -11
@@ -1,80 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.feature 'Admin - Reset Password', type: :feature do
4
- let!(:store) { create(:store) }
5
-
6
- background do
7
- ActionMailer::Base.default_url_options[:host] = 'http://example.com'
8
- end
9
-
10
- context 'when an account with this email address exists' do
11
- let!(:user) { create(:user, email: 'foobar@example.com', password: 'secret', password_confirmation: 'secret') }
12
-
13
- scenario 'allows a user to supply an email for the password reset' do
14
- visit spree.admin_login_path
15
- click_link 'Forgot Password?'
16
- fill_in_email
17
- click_button 'Reset my password'
18
- expect(page).to have_text 'you will receive an email with instructions'
19
- end
20
- end
21
-
22
- # Revealing that an admin email address is not found allows an attacker to
23
- # find admin account email addresses by trying email addresses until this
24
- # error is not shown.
25
- scenario 'does not reveal email addresses if they are not found' do
26
- visit spree.admin_login_path
27
- click_link 'Forgot Password?'
28
- fill_in_email
29
- click_button 'Reset my password'
30
- expect(page).to_not have_text "Email not found"
31
- expect(page).to have_text 'you will receive an email with instructions'
32
- end
33
-
34
- def fill_in_email
35
- fill_in 'Email', with: 'foobar@example.com'
36
- end
37
-
38
- context 'password management' do
39
- let!(:admin) do
40
- create(:admin_user,
41
- email: 'admin@example.com',
42
- password: 'secret',
43
- password_confirmation: 'secret'
44
- )
45
- end
46
-
47
- let!(:user) do
48
- create(:user,
49
- email: 'user@example.com',
50
- password: 'test123',
51
- password_confirmation: 'test123'
52
- )
53
- end
54
-
55
- before do
56
- visit spree.admin_login_path
57
- fill_in 'Email', with: admin.email
58
- fill_in 'Password', with: admin.password
59
- click_button 'Login'
60
- visit spree.admin_users_path
61
- end
62
-
63
- context 'if currently logged-in admin' do
64
- context "clicks on an user's page" do
65
- it 'can reset its password' do
66
- within("#spree_user_#{user.id}") do
67
- click_link user.email
68
- end
69
-
70
- click_button 'Reset password'
71
- expect(page).to have_content(
72
- 'If an account with that email address exists, '\
73
- 'you will receive an email with instructions about '\
74
- 'how to reset your password in a few minutes.'
75
- )
76
- end
77
- end
78
- end
79
- end
80
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.feature 'Admin products', type: :feature do
4
- context 'as anonymous user' do
5
- # Regression test for #1250
6
- scenario 'redirects to login page when attempting to access product listing' do
7
- expect { visit spree.admin_products_path }.not_to raise_error
8
- end
9
- end
10
- end
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.feature 'Admin - Sign In', type: :feature do
4
- background do
5
- @user = create(:admin_user, email: 'email@person.com')
6
- visit spree.admin_login_path
7
- end
8
-
9
- scenario 'asks user to sign in' do
10
- visit spree.admin_path
11
- expect(page).not_to have_text 'Authorization Failure'
12
- end
13
-
14
- scenario 'lets a user sign in successfully' do
15
- fill_in 'Email', with: @user.email
16
- fill_in 'Password', with: 'secret'
17
- click_button 'Login'
18
-
19
- expect(page).to have_text 'Logged in successfully'
20
- expect(page).not_to have_text 'Login'
21
- expect(page).to have_text 'Logout'
22
- expect(current_path).to eq '/admin/orders'
23
- end
24
-
25
- scenario 'shows validation erros' do
26
- fill_in 'Email', with: @user.email
27
- fill_in 'Password', with: 'wrong_password'
28
- click_button 'Login'
29
-
30
- expect(page).to have_text 'Invalid email or password'
31
- expect(page).to have_text 'Login'
32
- end
33
-
34
- scenario 'allows a user to access a restricted page after logging in' do
35
- user = create(:admin_user, email: 'admin@person.com')
36
- visit spree.admin_path
37
-
38
- fill_in 'Email', with: user.email
39
- fill_in 'Password', with: 'secret'
40
- click_button 'Login'
41
-
42
- expect(page).to have_text 'admin@person.com'
43
- expect(current_path).to eq '/admin/orders'
44
- end
45
- end
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.feature 'Admin - Sign Out', type: :feature, js: true do
4
- given!(:user) do
5
- create :user, email: 'email@person.com'
6
- end
7
-
8
- background do
9
- visit spree.admin_login_path
10
- fill_in 'Email', with: user.email
11
- fill_in 'Password', with: 'secret'
12
- # Regression test for #1257
13
- check 'Remember me'
14
- click_button 'Login'
15
- end
16
-
17
- scenario 'allows a signed in user to logout' do
18
- click_logout_link
19
- visit spree.admin_login_path
20
- expect(page).to have_text 'Login'
21
- expect(page).not_to have_text 'Logout'
22
- end
23
-
24
- def click_logout_link
25
- new_version? ? logout_new_version : logout_old_version
26
- end
27
-
28
- def new_version?
29
- Gem::Requirement.new('>= 4.2').satisfied_by?(Spree.solidus_gem_version)
30
- end
31
-
32
- def logout_new_version
33
- find('details div', text: user.email, wait: 10).click
34
- within('details') do
35
- click_link 'Logout'
36
- end
37
- end
38
-
39
- def logout_old_version
40
- click_link 'Logout'
41
- end
42
- end
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.feature 'Admin Permissions', type: :feature do
4
- context 'orders' do
5
- background do
6
- user = create(:admin_user, email: 'admin@person.com', password: 'password', password_confirmation: 'password')
7
- Spree::Ability.register_ability(AbilityDecorator)
8
- visit spree.login_path
9
-
10
- fill_in 'Email', with: user.email
11
- fill_in 'Password', with: user.password
12
- click_button 'Login'
13
- end
14
-
15
- context 'admin is restricted from accessing orders' do
16
- scenario 'can not list orders' do
17
- visit spree.admin_orders_path
18
- expect(page).to have_text 'Authorization Failure'
19
- end
20
-
21
- scenario 'can not edit orders' do
22
- create(:order, number: 'R123')
23
- visit spree.edit_admin_order_path('R123')
24
- expect(page).to have_text 'Authorization Failure'
25
- end
26
-
27
- scenario 'can not new orders' do
28
- visit spree.new_admin_order_path
29
- expect(page).to have_text 'Authorization Failure'
30
- end
31
- end
32
-
33
- context "admin is restricted from accessing an order's customer details" do
34
- given(:order) { create(:order_with_totals) }
35
-
36
- scenario 'can not list customer details for an order' do
37
- visit spree.admin_order_customer_path(order)
38
- expect(page).to have_text 'Authorization Failure'
39
- end
40
-
41
- scenario "can not edit an order's customer details" do
42
- visit spree.edit_admin_order_customer_path(order)
43
- expect(page).to have_text 'Authorization Failure'
44
- end
45
- end
46
- end
47
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.feature 'Change email', type: :feature do
4
- background do
5
- stub_spree_preferences(Spree::Auth::Config, signout_after_password_change: false)
6
-
7
- user = create(:user)
8
- visit spree.root_path
9
- click_link 'Login'
10
-
11
- fill_in 'spree_user[email]', with: user.email
12
- fill_in 'spree_user[password]', with: 'secret'
13
- click_button 'Login'
14
-
15
- visit spree.edit_account_path
16
- end
17
-
18
- scenario 'work with correct password' do
19
- fill_in 'user_email', with: 'tests@example.com'
20
- fill_in 'user_password', with: 'password'
21
- fill_in 'user_password_confirmation', with: 'password'
22
- click_button 'Update'
23
-
24
- expect(page).to have_text 'Account updated'
25
- expect(page).to have_text 'tests@example.com'
26
- end
27
- end
@@ -1,158 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.feature 'Checkout', :js, type: :feature do
4
- given!(:store) { create(:store) }
5
- given!(:country) { create(:country, name: 'United States', states_required: true) }
6
- given!(:state) { create(:state, name: 'Maryland', country: country) }
7
- given!(:shipping_method) do
8
- shipping_method = create(:shipping_method)
9
- calculator = Spree::Calculator::Shipping::PerItem.create!(calculable: shipping_method, preferred_amount: 10)
10
- shipping_method.calculator = calculator
11
- shipping_method.tap(&:save)
12
- end
13
-
14
- given!(:zone) { create(:zone) }
15
- given!(:address) { create(:address, state: state, country: country) }
16
- given!(:payment_method){ create :check_payment_method }
17
-
18
- background do
19
- @product = create(:product, name: 'RoR Mug')
20
- @product.master.stock_items.first.set_count_on_hand(1)
21
-
22
- # Bypass gateway error on checkout | ..or stub a gateway
23
- stub_spree_preferences(allow_checkout_on_gateway_error: true)
24
-
25
- visit spree.root_path
26
- end
27
-
28
- # Regression test for https://github.com/solidusio/solidus/issues/1588
29
- scenario 'leaving and returning to address step' do
30
- stub_spree_preferences(Spree::Auth::Config, registration_step: true)
31
- click_link 'RoR Mug'
32
- click_button 'Add To Cart'
33
- within('h1') { expect(page).to have_text 'Shopping Cart' }
34
- click_button 'Checkout'
35
-
36
- within '#guest_checkout' do
37
- fill_in 'Email', with: 'test@example.com'
38
- end
39
- click_on 'Continue'
40
-
41
- click_on 'Cart'
42
-
43
- click_on 'Checkout'
44
-
45
- expect(page).to have_content "Billing Address"
46
- end
47
-
48
- context 'without payment being required' do
49
- scenario 'allow a visitor to checkout as guest, without registration' do
50
- click_link 'RoR Mug'
51
- click_button 'Add To Cart'
52
- within('h1') { expect(page).to have_text 'Shopping Cart' }
53
- click_button 'Checkout'
54
-
55
- expect(page).to have_content(/Checkout as a Guest/i)
56
-
57
- within('#guest_checkout') { fill_in 'Email', with: 'spree@test.com' }
58
- click_button 'Continue'
59
-
60
- expect(page).to have_text(/Billing Address/i)
61
- expect(page).to have_text(/Shipping Address/i)
62
-
63
- fill_addresses_fields_with(address)
64
- click_button 'Save and Continue'
65
-
66
- click_button 'Save and Continue'
67
- click_button 'Save and Continue'
68
- click_button 'Place Order'
69
-
70
- expect(page).to have_text 'Your order has been processed successfully'
71
- end
72
-
73
- scenario 'associate an uncompleted guest order with user after logging in' do
74
- user = create(:user, email: 'email@person.com', password: 'password', password_confirmation: 'password')
75
- click_link 'RoR Mug'
76
- click_button 'Add To Cart'
77
-
78
- visit spree.login_path
79
- fill_in 'Email', with: user.email
80
- fill_in 'Password', with: user.password
81
- click_button 'Login'
82
- click_link 'Cart'
83
-
84
- expect(page).to have_text 'RoR Mug'
85
- within('h1') { expect(page).to have_text 'Shopping Cart' }
86
-
87
- click_button 'Checkout'
88
-
89
- fill_addresses_fields_with(address)
90
- click_button 'Save and Continue'
91
-
92
- click_button 'Save and Continue'
93
- click_button 'Save and Continue'
94
- click_button 'Place Order'
95
-
96
- expect(page).to have_text 'Your order has been processed successfully'
97
- expect(Spree::Order.first.user).to eq user
98
- end
99
-
100
- # Regression test for #890
101
- scenario 'associate an incomplete guest order with user after successful password reset' do
102
- create(:user, email: 'email@person.com', password: 'password', password_confirmation: 'password')
103
- click_link 'RoR Mug'
104
- click_button 'Add To Cart'
105
-
106
- visit spree.login_path
107
- click_link 'Forgot Password?'
108
- fill_in 'spree_user_email', with: 'email@person.com'
109
- click_button 'Reset my password'
110
-
111
- # Need to do this now because the token stored in the DB is the encrypted version
112
- # The 'plain-text' version is sent in the email and there's one way to get that!
113
- reset_password_email = ActionMailer::Base.deliveries.first
114
- token_url_regex = /\/user\/spree_user\/password\/edit\?reset_password_token=(.*)$/
115
- token = token_url_regex.match(reset_password_email.body.to_s)[1]
116
-
117
- visit spree.edit_spree_user_password_path(reset_password_token: token)
118
- fill_in 'Password', with: 'password'
119
- fill_in 'Password Confirmation', with: 'password'
120
- click_button 'Update'
121
-
122
- click_link 'Cart'
123
- click_button 'Checkout'
124
-
125
- fill_addresses_fields_with(address)
126
- click_button 'Save and Continue'
127
-
128
- expect(page).not_to have_text 'Email is invalid'
129
- end
130
-
131
- scenario 'allow a user to register during checkout' do
132
- click_link 'RoR Mug'
133
- click_button 'Add To Cart'
134
- click_button 'Checkout'
135
-
136
- expect(page).to have_text 'Registration'
137
-
138
- click_link 'Create a new account'
139
-
140
- fill_in 'Email', with: 'email@person.com'
141
- fill_in 'Password', with: 'spree123'
142
- fill_in 'Password Confirmation', with: 'spree123'
143
- click_button 'Create'
144
-
145
- expect(page).to have_text 'You have signed up successfully.'
146
-
147
- fill_addresses_fields_with(address)
148
- click_button 'Save and Continue'
149
-
150
- click_button 'Save and Continue'
151
- click_button 'Save and Continue'
152
- click_button 'Place Order'
153
-
154
- expect(page).to have_text 'Your order has been processed successfully'
155
- expect(Spree::Order.first.user).to eq Spree::User.find_by(email: 'email@person.com')
156
- end
157
- end
158
- end
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.feature 'Confirmation' do
6
- before do
7
- allow(Spree::UserMailer).to receive(:confirmation_instructions)
8
- .and_return(double(deliver: true))
9
- end
10
-
11
- let!(:store) { create(:store) }
12
-
13
- background do
14
- ActionMailer::Base.default_url_options[:host] = 'http://example.com'
15
- end
16
-
17
- scenario 'create a new user', js: true, confirmable: false do
18
- visit spree.signup_path
19
-
20
- fill_in 'Email', with: 'email@person.com'
21
- fill_in 'Password', with: 'password'
22
- fill_in 'Password Confirmation', with: 'password'
23
- click_button 'Create'
24
-
25
- expect(page).to have_text 'You have signed up successfully.'
26
- expect(Spree::User.last.confirmed?).to be(false)
27
- end
28
- end
@@ -1,59 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.feature 'Orders', :js, type: :feature do
4
- scenario 'allow a user to view their cart at any time' do
5
- visit spree.cart_path
6
- expect(page).to have_text 'Your cart is empty'
7
- end
8
-
9
- # regression test for spree/spree#1687
10
- scenario 'merge incomplete orders from different sessions' do
11
- create(:store)
12
- create(:product, name: 'RoR Mug')
13
- create(:product, name: 'RoR Shirt')
14
-
15
- user = create(:user, email: 'email@person.com', password: 'password', password_confirmation: 'password')
16
-
17
- using_session('first') do
18
- visit spree.root_path
19
-
20
- click_link 'RoR Mug'
21
- click_button 'Add To Cart'
22
-
23
- visit spree.login_path
24
- fill_in 'Email', with: user.email
25
- fill_in 'Password', with: user.password
26
- click_button 'Login'
27
-
28
- click_link 'Cart'
29
- expect(page).to have_text 'RoR Mug'
30
- end
31
-
32
- using_session('second') do
33
- visit spree.root_path
34
-
35
- click_link 'RoR Shirt'
36
- click_button 'Add To Cart'
37
-
38
- visit spree.login_path
39
- fill_in 'Email', with: user.email
40
- fill_in 'Password', with: user.password
41
- click_button 'Login'
42
-
43
- # Order should have been merged with first session
44
- click_link 'Cart'
45
- expect(page).to have_text 'RoR Mug'
46
- expect(page).to have_text 'RoR Shirt'
47
- end
48
-
49
- using_session('first') do
50
- visit spree.root_path
51
-
52
- click_link 'Cart'
53
-
54
- # Order should have been merged with second session
55
- expect(page).to have_text 'RoR Mug'
56
- expect(page).to have_text 'RoR Shirt'
57
- end
58
- end
59
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.feature 'Reset Password', type: :feature do
4
- let!(:store) { create(:store) }
5
-
6
- background do
7
- ActionMailer::Base.default_url_options[:host] = 'http://example.com'
8
- end
9
-
10
- context 'when an account with this email address exists' do
11
- let!(:user) { create(:user, email: 'foobar@example.com', password: 'secret', password_confirmation: 'secret') }
12
-
13
- scenario 'allows a user to supply an email for the password reset' do
14
- visit spree.login_path
15
- click_link 'Forgot Password?'
16
- fill_in_email
17
- click_button 'Reset my password'
18
- expect(page).to have_text 'you will receive an email with instructions'
19
- end
20
- end
21
-
22
- # Test that we are extending the functionality from
23
- # https://github.com/solidusio/solidus_auth_devise/pull/155
24
- # to the non-admin login
25
- scenario 'does not reveal email addresses if they are not found' do
26
- visit spree.login_path
27
- click_link 'Forgot Password?'
28
- fill_in_email
29
- click_button 'Reset my password'
30
- expect(page).to_not have_text "Email not found"
31
- expect(page).to have_text 'you will receive an email with instructions'
32
- end
33
-
34
- def fill_in_email
35
- fill_in 'Email', with: 'foobar@example.com'
36
- end
37
- end
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.feature 'Sign In', type: :feature do
4
- background do
5
- @user = create(:user, email: 'email@person.com', password: 'secret', password_confirmation: 'secret')
6
- visit spree.login_path
7
- end
8
-
9
- scenario 'ask user to sign in' do
10
- visit spree.admin_path
11
- expect(page).not_to have_text 'Authorization Failure'
12
- end
13
-
14
- scenario 'let a user sign in successfully' do
15
- fill_in 'Email', with: @user.email
16
- fill_in 'Password', with: @user.password
17
- click_button 'Login'
18
-
19
- expect(page).to have_text 'Logged in successfully'
20
- expect(page).not_to have_text 'Login'
21
- expect(page).to have_text 'Logout'
22
- expect(current_path).to eq '/'
23
- end
24
-
25
- scenario 'show validation erros' do
26
- fill_in 'Email', with: @user.email
27
- fill_in 'Password', with: 'wrong_password'
28
- click_button 'Login'
29
-
30
- expect(page).to have_text 'Invalid email or password'
31
- expect(page).to have_text 'Login'
32
- end
33
-
34
- scenario 'allow a user to access a restricted page after logging in' do
35
- user = create(:admin_user, email: 'admin@person.com', password: 'password', password_confirmation: 'password')
36
- visit spree.admin_path
37
-
38
- fill_in 'Email', with: user.email
39
- fill_in 'Password', with: user.password
40
- click_button 'Login'
41
-
42
- expect(page).to have_text 'admin@person.com'
43
- expect(current_path).to eq '/admin/orders'
44
- end
45
-
46
- it "should store the user previous location" do
47
- visit spree.account_path
48
- fill_in "Email", with: @user.email
49
- fill_in "Password", with: @user.password
50
- click_button "Login"
51
- expect(current_path).to eq "/account"
52
- end
53
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.feature 'Sign Out', type: :feature, js: true do
4
- given!(:user) do
5
- create(:user,
6
- email: 'email@person.com',
7
- password: 'secret',
8
- password_confirmation: 'secret')
9
- end
10
-
11
- background do
12
- visit spree.login_path
13
- fill_in 'Email', with: user.email
14
- fill_in 'Password', with: user.password
15
- # Regression test for #1257
16
- check 'Remember me'
17
- click_button 'Login'
18
- end
19
-
20
- scenario 'allow a signed in user to logout' do
21
- click_link 'Logout'
22
- visit spree.root_path
23
- expect(page).to have_text 'LOGIN'
24
- expect(page).not_to have_text 'LOGOUT'
25
- end
26
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.feature 'Sign Up', type: :feature do
4
- context 'with valid data' do
5
- scenario 'create a new user' do
6
- visit spree.signup_path
7
-
8
- fill_in 'Email', with: 'email@person.com'
9
- fill_in 'Password', with: 'password'
10
- fill_in 'Password Confirmation', with: 'password'
11
- click_button 'Create'
12
-
13
- expect(page).to have_text 'You have signed up successfully.'
14
- expect(Spree::User.count).to eq(1)
15
- end
16
- end
17
-
18
- context 'with invalid data' do
19
- scenario 'does not create a new user' do
20
- visit spree.signup_path
21
-
22
- fill_in 'Email', with: 'email@person.com'
23
- fill_in 'Password', with: 'password'
24
- fill_in 'Password Confirmation', with: ''
25
- click_button 'Create'
26
-
27
- expect(page).to have_css '#errorExplanation'
28
- expect(Spree::User.count).to eq(0)
29
- end
30
- end
31
- end