spree_gateway 3.8.0 → 3.9.4

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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -11
  3. data/Gemfile +3 -1
  4. data/README.md +2 -2
  5. data/Rakefile +2 -2
  6. data/app/models/spree/gateway/stripe_ach_gateway.rb +1 -1
  7. data/app/models/spree/gateway/stripe_elements_gateway.rb +54 -0
  8. data/app/models/spree/gateway/stripe_gateway.rb +5 -0
  9. data/app/models/{spree → spree_gateway}/apple_pay_order_decorator.rb +2 -2
  10. data/app/models/{spree → spree_gateway}/apple_pay_payment_decorator.rb +2 -2
  11. data/app/models/spree_gateway/credit_card_decorator.rb +10 -0
  12. data/app/models/spree_gateway/order_decorator.rb +28 -0
  13. data/app/models/{spree → spree_gateway}/payment_decorator.rb +9 -2
  14. data/app/views/spree/checkout/_payment_confirm.html.erb +39 -0
  15. data/config/locales/en.yml +4 -0
  16. data/config/routes.rb +12 -0
  17. data/db/migrate/20200422114908_add_intent_key_to_payment.rb +5 -0
  18. data/lib/controllers/spree/api/v2/storefront/intents_controller.rb +27 -0
  19. data/lib/spree_frontend/controllers/spree/checkout_controller_decorator.rb +19 -0
  20. data/lib/spree_gateway/engine.rb +10 -0
  21. data/lib/spree_gateway/version.rb +1 -1
  22. data/lib/views/frontend/spree/checkout/payment/_stripe_elements.html.erb +2 -1
  23. data/spec/features/admin/stripe_elements_payment_spec.rb +20 -29
  24. data/spec/features/stripe_checkout_spec.rb +37 -23
  25. data/spec/features/stripe_elements_3ds_checkout_spec.rb +225 -0
  26. data/spec/models/gateway/authorize_net_spec.rb +1 -1
  27. data/spec/models/gateway/balanced_gateway_spec.rb +1 -1
  28. data/spec/models/gateway/banwire_spec.rb +1 -1
  29. data/spec/models/gateway/beanstream_spec.rb +1 -1
  30. data/spec/models/gateway/braintree_gateway_spec.rb +24 -13
  31. data/spec/models/gateway/card_save_spec.rb +1 -1
  32. data/spec/models/gateway/{data_cache_spec.rb → data_cash_spec.rb} +1 -1
  33. data/spec/models/gateway/epay_spec.rb +1 -1
  34. data/spec/models/gateway/eway_rapid_spec.rb +1 -1
  35. data/spec/models/gateway/eway_spec.rb +1 -1
  36. data/spec/models/gateway/moneris_spec.rb +1 -1
  37. data/spec/models/gateway/pay_junction_spec.rb +1 -1
  38. data/spec/models/gateway/pay_pal_spec.rb +1 -1
  39. data/spec/models/gateway/payflow_pro_spec.rb +1 -1
  40. data/spec/models/gateway/paymill_spec.rb +1 -1
  41. data/spec/models/gateway/pin_gateway_spec.rb +1 -1
  42. data/spec/models/gateway/quickpay_spec.rb +1 -1
  43. data/spec/models/gateway/sage_pay_spec.rb +1 -1
  44. data/spec/models/gateway/secure_pay_au_spec.rb +1 -1
  45. data/spec/models/gateway/stripe_ach_gateway_spec.rb +2 -1
  46. data/spec/models/gateway/stripe_gateway_spec.rb +1 -0
  47. data/spec/models/gateway/usa_epay_transaction_spec.rb +2 -2
  48. data/spec/models/gateway/worldpay_spec.rb +1 -1
  49. data/spec/models/spree/order_spec.rb +4 -2
  50. data/spec/support/order_walktrough.rb +73 -0
  51. data/spec/support/within_stripe_3ds_popup.rb +10 -0
  52. data/spree_gateway.gemspec +9 -3
  53. metadata +34 -28
  54. data/Appraisals +0 -14
  55. data/gemfiles/spree_4_1.gemfile +0 -8
  56. data/gemfiles/spree_4_2.gemfile +0 -8
  57. data/gemfiles/spree_master.gemfile +0 -8
@@ -1,53 +1,44 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Admin Panel Stripe elements payment', type: :feature, :js => true do
3
+ describe 'Admin Panel Stripe elements payment', type: :feature do
4
4
  stub_authorization!
5
5
 
6
- let!(:country) { create(:country, :states_required => true) }
7
- let!(:state) { create(:state, :country => country) }
6
+ let!(:country) { create(:country, states_required: true) }
7
+ let!(:state) { create(:state, country: country) }
8
8
  let!(:shipping_method) { create(:shipping_method) }
9
- let!(:stock_location) { create(:stock_location) }
10
- let!(:mug) { create(:product, :name => 'RoR Mug') }
11
- let!(:zone) { create(:zone) }
9
+ let!(:stock_location) { create(:stock_location) }
10
+ let!(:mug) { create(:product, name: 'RoR Mug') }
11
+ let!(:zone) { create(:zone) }
12
12
  let!(:stripe_elements_payment_method) do
13
13
  Spree::Gateway::StripeElementsGateway.create!(
14
- :name => 'Stripe Element',
15
- :preferred_secret_key => 'sk_test_VCZnDv3GLU15TRvn8i2EsaAN',
16
- :preferred_publishable_key => 'pk_test_Cuf0PNtiAkkMpTVC2gwYDMIg'
14
+ name: 'Stripe Element',
15
+ preferred_secret_key: 'sk_test_VCZnDv3GLU15TRvn8i2EsaAN',
16
+ preferred_publishable_key: 'pk_test_Cuf0PNtiAkkMpTVC2gwYDMIg',
17
+ stores: [::Spree::Store.default]
17
18
  )
18
19
  end
19
-
20
+
20
21
  let!(:order) { OrderWalkthrough.up_to(:payment) }
21
22
  before { visit spree.new_admin_order_payment_path(order.number) }
22
23
 
23
24
  it 'can process a valid payment' do
24
25
  fill_in_stripe_payment
25
26
  wait_for { !page.has_current_path?(spree.admin_order_payments_path(order.number)) }
26
-
27
+
27
28
  expect(page.body).to have_content('Payment has been successfully created!')
28
29
  expect(page).to have_current_path spree.admin_order_payments_path(order.number)
29
30
  end
30
-
31
- if Spree.version.to_f >= 4.1
32
- it 'shows an error with an invalid card name' do
33
- fill_in_stripe_payment(true)
34
31
 
35
- expect(page).to have_content("Credit card Name can't be blank")
36
- expect(page).to have_current_path spree.admin_order_payments_path(order.number)
37
- end
38
- else
39
- it 'can proces valid payment with invalid card name' do
40
- fill_in_stripe_payment(true)
41
- wait_for { !page.has_current_path?(spree.admin_order_payments_path(order.number)) }
32
+ it 'shows an error with an invalid card name' do
33
+ fill_in_stripe_payment(true)
42
34
 
43
- expect(page.body).to have_content('Payment has been successfully created!')
44
- expect(page).to have_current_path spree.admin_order_payments_path(order.number)
45
- end
35
+ expect(page).to have_content("Credit card Name can't be blank")
36
+ expect(page).to have_current_path spree.admin_order_payments_path(order.number)
46
37
  end
47
38
 
48
39
  it 'shows an error with an invalid card number' do
49
40
  fill_in_stripe_payment(false, true)
50
-
41
+
51
42
  expect(page).to have_content('The card number is not a valid credit card number.')
52
43
  expect(page).to have_current_path spree.new_admin_order_payment_path(order.number)
53
44
  end
@@ -62,7 +53,7 @@ describe 'Admin Panel Stripe elements payment', type: :feature, :js => true do
62
53
  it 'shows an error with an invalid card expiration' do
63
54
  fill_in_stripe_payment(false, false, false, true)
64
55
 
65
- if Spree.version.to_f >= 4.1
56
+ if Spree.version.to_f >= 4.1 || Spree.version.to_f >= 3.7
66
57
  expect(page).to have_content('Credit card Month is not a number')
67
58
  expect(page).to have_content('Credit card Year is not a number')
68
59
  expect(page).to have_current_path spree.admin_order_payments_path(order.number)
@@ -83,7 +74,7 @@ describe 'Admin Panel Stripe elements payment', type: :feature, :js => true do
83
74
 
84
75
  def fill_in_card_number(invalid_number)
85
76
  number = invalid_number ? '123' : '4242 4242 4242 4242'
86
- fill_in_field('Card Number *', '#card_number1', number)
77
+ fill_in_field('Card Number *', "#card_number#{stripe_elements_payment_method.id}", number)
87
78
  end
88
79
 
89
80
  def fill_in_card_expiration(invalid_expiration)
@@ -91,7 +82,7 @@ describe 'Admin Panel Stripe elements payment', type: :feature, :js => true do
91
82
  invalid_expiry = Spree.version.to_f >= 4.2 ? '01/' : '01 / '
92
83
 
93
84
  card_expiry = invalid_expiration ? invalid_expiry : valid_expiry
94
- fill_in_field('Expiration *', '#card_expiry1', card_expiry)
85
+ fill_in_field('Expiration *', "#card_expiry#{stripe_elements_payment_method.id}", card_expiry)
95
86
  end
96
87
 
97
88
  def fill_in_cvc(invalid_code)
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Stripe checkout", type: :feature do
3
+ describe "Stripe checkout", type: :feature, js: true do
4
4
  let!(:country) { create(:country, :states_required => true) }
5
5
  let!(:state) { create(:state, :country => country) }
6
6
  let!(:shipping_method) { create(:shipping_method) }
@@ -8,15 +8,21 @@ describe "Stripe checkout", type: :feature do
8
8
  let!(:mug) { create(:product, :name => "RoR Mug") }
9
9
  let!(:stripe_payment_method) do
10
10
  Spree::Gateway::StripeGateway.create!(
11
- :name => "Stripe",
12
- :preferred_secret_key => "sk_test_VCZnDv3GLU15TRvn8i2EsaAN",
13
- :preferred_publishable_key => "pk_test_Cuf0PNtiAkkMpTVC2gwYDMIg"
11
+ name: 'Stripe',
12
+ preferred_secret_key: 'sk_test_VCZnDv3GLU15TRvn8i2EsaAN',
13
+ preferred_publishable_key: 'pk_test_Cuf0PNtiAkkMpTVC2gwYDMIg',
14
+ stores: [::Spree::Store.default]
14
15
  )
15
16
  end
16
17
 
17
18
  let!(:zone) { create(:zone) }
18
19
 
19
20
  before do
21
+ if Spree.version.to_f >= 4.2
22
+ payment_method = Spree::PaymentMethod.first
23
+ payment_method.update!(stores: [Spree::Store.first])
24
+ end
25
+
20
26
  user = create(:user)
21
27
 
22
28
  order = OrderWalkthrough.up_to(:delivery)
@@ -42,7 +48,7 @@ describe "Stripe checkout", type: :feature do
42
48
  end
43
49
 
44
50
  # This will pass the CC data to the server and the StripeGateway class handles it
45
- it "can process a valid payment (without JS)" do
51
+ it "can process a valid payment (without JS)", js: false do
46
52
  fill_in 'card_number', with: '4242 4242 4242 4242'
47
53
  fill_in 'card_code', with: '123'
48
54
  fill_in 'card_expiry', with: "01 / #{Time.current.year + 1}"
@@ -56,12 +62,10 @@ describe "Stripe checkout", type: :feature do
56
62
 
57
63
  # This will fetch a token from Stripe.com and then pass that to the webserver.
58
64
  # The server then processes the payment using that token.
59
- it "can process a valid payment (with JS)", :js => true do
60
- fill_in 'card_number', with: '4242 4242 4242 4242'
61
- # Otherwise ccType field does not get updated correctly
62
- page.execute_script("$('.cardNumber').trigger('change')")
65
+ it "can process a valid payment (with JS)" do
66
+ fill_in_with_force('card_number', with: "4242424242424242")
67
+ fill_in_with_force('card_expiry', with: "01 / #{Time.current.year + 1}")
63
68
  fill_in 'card_code', with: '123'
64
- fill_in 'card_expiry', with: "01 / #{Time.current.year + 1}"
65
69
  click_button "Save and Continue"
66
70
  wait_for_stripe # Wait for Stripe API to return + form to submit
67
71
  expect(page).to have_css('#checkout_form_confirm')
@@ -72,18 +76,23 @@ describe "Stripe checkout", type: :feature do
72
76
  expect(page).to have_content(order.number)
73
77
  end
74
78
 
75
- it "shows an error with an invalid credit card number", :js => true do
79
+ it "shows an error with an invalid credit card number" do
76
80
  # Card number is NOT valid. Fails Luhn checksum
77
81
  fill_in 'card_number', with: '4242 4242 4242 4249'
78
82
  click_button "Save and Continue"
79
83
  wait_for_stripe
80
- expect(page).to have_content("Your card number is incorrect")
81
- expect(page).to have_css('.has-error #card_number.error')
84
+ if Spree.version.to_f >= 3.7 and Spree.version.to_f <= 4.1
85
+ expect(page).to have_content("The card number is not a valid credit card number")
86
+ end
87
+ if Spree.version.to_f >= 4.2
88
+ expect(page).to have_content("Your card number is incorrect")
89
+ expect(page).to have_css('.has-error #card_number.error')
90
+ end
82
91
  end
83
92
 
84
- it "shows an error with invalid security fields", :js => true do
85
- fill_in 'card_number', with: '4242 4242 4242 4242'
86
- fill_in 'card_expiry', with: "01 / #{Time.current.year + 1}"
93
+ it "shows an error with invalid security fields" do
94
+ fill_in_with_force('card_number', with: "4242424242424242")
95
+ fill_in_with_force('card_expiry', with: "01 / #{Time.current.year + 1}")
87
96
  fill_in 'card_code', with: '99'
88
97
  click_button "Save and Continue"
89
98
  wait_for_stripe
@@ -93,10 +102,10 @@ describe "Stripe checkout", type: :feature do
93
102
 
94
103
  # this scenario will not occur on Spree 4.2 due to swapping jquery.payment to cleave
95
104
  # see https://github.com/spree/spree/pull/10363
96
- it "shows an error with invalid expiry month field", :js => true do
97
- skip if Spree.version.to_f >= 4.2
98
- fill_in 'card_number', with: '4242 4242 4242 4242'
99
- fill_in 'card_expiry', :with => "00 / #{Time.now.year + 1}"
105
+ it "shows an error with invalid expiry month field" do
106
+ skip if Spree.version.to_f >= 4.2
107
+ fill_in_with_force('card_number', with: "4242424242424242")
108
+ fill_in_with_force('card_expiry', with: "00 / #{Time.current.year + 1}")
100
109
  fill_in 'card_code', with: '123'
101
110
  click_button "Save and Continue"
102
111
  wait_for_stripe
@@ -104,9 +113,9 @@ describe "Stripe checkout", type: :feature do
104
113
  expect(page).to have_css('.has-error #card_expiry.error')
105
114
  end
106
115
 
107
- it "shows an error with invalid expiry year field", :js => true do
108
- fill_in 'card_number', with: '4242 4242 4242 4242'
109
- fill_in 'card_expiry', with: '12 / '
116
+ it "shows an error with invalid expiry year field" do
117
+ fill_in_with_force('card_number', with: "4242424242424242")
118
+ fill_in_with_force('card_expiry', with: "12 / ")
110
119
  fill_in 'card_code', with: '123'
111
120
  click_button "Save and Continue"
112
121
  wait_for_stripe
@@ -114,3 +123,8 @@ describe "Stripe checkout", type: :feature do
114
123
  expect(page).to have_css('.has-error #card_expiry.error')
115
124
  end
116
125
  end
126
+
127
+ def fill_in_with_force(locator, with:)
128
+ field_id = find_field(locator)[:id]
129
+ page.execute_script("document.getElementById('#{field_id}').value = '#{with}';")
130
+ end
@@ -0,0 +1,225 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe 'Stripe Elements 3ds checkout', type: :feature, js: true do
6
+ let!(:product) { create(:product, name: 'RoR Mug') }
7
+ let!(:stripe_payment_method) do
8
+ Spree::Gateway::StripeElementsGateway.create!(
9
+ name: 'Stripe',
10
+ preferred_secret_key: 'sk_test_VCZnDv3GLU15TRvn8i2EsaAN',
11
+ preferred_publishable_key: 'pk_test_Cuf0PNtiAkkMpTVC2gwYDMIg',
12
+ preferred_intents: preferred_intents,
13
+ stores: [::Spree::Store.default]
14
+ )
15
+ end
16
+
17
+ before do
18
+ user = create(:user)
19
+ order = OrderWalkthrough.up_to(:confirm)
20
+ expect(order).to receive(:confirmation_required?).and_return(true).at_least(:once)
21
+
22
+ order.reload
23
+ order.user = user
24
+ payment = order.payments.first
25
+ payment.source = create(:credit_card, number: card_number)
26
+ payment.save!
27
+
28
+ allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
29
+ allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
30
+ allow_any_instance_of(Spree::CheckoutController).to receive_messages(skip_state_validation?: true)
31
+ allow_any_instance_of(Spree::OrdersController).to receive_messages(try_spree_current_user: user)
32
+
33
+ add_to_cart(product)
34
+
35
+ if Spree.version.to_f >= 3.7 and Spree.version.to_f < 4.1
36
+ find("#checkout-link").click
37
+ else
38
+ click_link 'checkout'
39
+ click_button 'Place Order'
40
+ end
41
+ end
42
+
43
+ describe 'when intents are disabled' do
44
+ let(:preferred_intents) { false }
45
+
46
+ context 'and credit card does not require 3ds authentication' do
47
+ let(:card_number) { '4242424242424242' }
48
+
49
+ if Spree.version.to_f >= 3.7 and Spree.version.to_f < 4.1
50
+ it 'should place order without 3ds authentication', driver: :selenium_chrome_headless do
51
+ click_button 'Save and Continue'
52
+ click_button 'Save and Continue'
53
+
54
+ within_frame 0 do
55
+ fill_in 'cardnumber', with: card_number
56
+ fill_in 'exp-date', with: "01 / #{Time.current.strftime('%y').to_i + 3}"
57
+ fill_in 'cvc', with: "222"
58
+ end
59
+
60
+ click_button 'Save and Continue'
61
+ click_button 'Place Order'
62
+
63
+ expect(page).to have_content('Your order has been processed successfully')
64
+ order = Spree::Order.complete.last
65
+ expect(page.current_url).to include("/orders/#{order.number}")
66
+ expect(page).to have_content(order.number)
67
+ end
68
+ else
69
+ it 'should place order without 3ds authentication' do
70
+ expect(page).to have_content('Order placed successfully')
71
+ order = Spree::Order.complete.last
72
+ expect(page.current_url).to include("/orders/#{order.number}")
73
+ expect(page).to have_content(order.number)
74
+ end
75
+ end
76
+ end
77
+
78
+ context 'and credit card does require 3ds authentication' do
79
+ let(:card_number) { '4000000000003220' }
80
+
81
+ if Spree.version.to_f >= 3.7 and Spree.version.to_f < 4.1
82
+ it 'should not place the order', driver: :selenium_chrome_headless do
83
+ click_button 'Save and Continue'
84
+ click_button 'Save and Continue'
85
+
86
+ within_frame 0 do
87
+ fill_in 'cardnumber', with: card_number
88
+ fill_in 'exp-date', with: "01 / #{Time.current.strftime('%y').to_i + 3}"
89
+ fill_in 'cvc', with: "222"
90
+ end
91
+
92
+ click_button 'Save and Continue'
93
+ click_button 'Place Order'
94
+
95
+ expect(page).to have_content('Your card was declined. This transaction requires authentication.')
96
+ expect(Spree::Order.complete.last).to be_nil
97
+ end
98
+
99
+ else
100
+ it 'should not place the order' do
101
+ expect(page).to have_content('Your card was declined. This transaction requires authentication.')
102
+ expect(Spree::Order.complete.last).to be_nil
103
+ end
104
+ end
105
+ end
106
+ end
107
+
108
+ describe 'when intents are enabled' do
109
+ let(:preferred_intents) { true }
110
+
111
+ context 'and credit card does not require 3ds authentication' do
112
+ let(:card_number) { '4242424242424242' }
113
+
114
+ if Spree.version.to_f >= 3.7 and Spree.version.to_f < 4.1
115
+ it 'should successfully place order without 3ds authentication', driver: :selenium_chrome_headless do
116
+ click_button 'Save and Continue'
117
+ click_button 'Save and Continue'
118
+
119
+ within_frame 0 do
120
+ fill_in 'cardnumber', with: card_number
121
+ fill_in 'exp-date', with: "01 / #{Time.current.strftime('%y').to_i + 3}"
122
+ fill_in 'cvc', with: "222"
123
+ end
124
+
125
+ click_button 'Save and Continue'
126
+ click_button 'Place Order'
127
+
128
+ expect(page).to have_content('Your order has been processed successfully')
129
+ order = Spree::Order.complete.last
130
+ expect(page.current_url).to include("/orders/#{order.number}")
131
+ expect(page).to have_content(order.number)
132
+ end
133
+ else
134
+ it 'should successfully place order without 3ds authentication' do
135
+ expect(page).to have_content('Order placed successfully')
136
+ order = Spree::Order.complete.last
137
+ expect(page.current_url).to include("/orders/#{order.number}")
138
+ expect(page).to have_content(order.number)
139
+ end
140
+ end
141
+ end
142
+
143
+ context 'when credit card does require 3ds authentication' do
144
+ let(:card_number) { '4000000000003220' }
145
+
146
+ context 'and authentication is successful' do
147
+ if Spree.version.to_f >= 3.7 and Spree.version.to_f < 4.1
148
+ it 'should place order after 3ds authentication', driver: :selenium_chrome_headless do
149
+ click_button 'Save and Continue'
150
+ click_button 'Save and Continue'
151
+
152
+ within_frame 0 do
153
+ fill_in 'cardnumber', with: card_number
154
+ fill_in 'exp-date', with: "01 / #{Time.current.strftime('%y').to_i + 3}"
155
+ fill_in 'cvc', with: "222"
156
+ end
157
+
158
+ click_button 'Save and Continue'
159
+ click_button 'Place Order'
160
+
161
+ within_stripe_3ds_popup do
162
+ click_button('Complete')
163
+ end
164
+
165
+ expect(page).to have_content('Your order has been processed successfully')
166
+ order = Spree::Order.complete.last
167
+ expect(page.current_url).to include("/orders/#{order.number}")
168
+ expect(page).to have_content(order.number)
169
+ end
170
+
171
+ else
172
+ it 'should place order after 3ds authentication' do
173
+ within_stripe_3ds_popup do
174
+ click_button('Complete')
175
+ end
176
+
177
+ expect(page).to have_content('Order placed successfully')
178
+ order = Spree::Order.complete.last
179
+ expect(page.current_url).to include("/orders/#{order.number}")
180
+ expect(page).to have_content(order.number)
181
+ end
182
+ end
183
+ end
184
+
185
+ context 'and authentication is unsuccessful' do
186
+
187
+ if Spree.version.to_f >= 3.7 and Spree.version.to_f < 4.1
188
+ it 'should not place order after 3ds authentication', driver: :selenium_chrome_headless do
189
+ click_button 'Save and Continue'
190
+ click_button 'Save and Continue'
191
+
192
+ within_frame 0 do
193
+ fill_in 'cardnumber', with: card_number
194
+ fill_in 'exp-date', with: "01 / #{Time.current.strftime('%y').to_i + 3}"
195
+ fill_in 'cvc', with: "222"
196
+ end
197
+
198
+ click_button 'Save and Continue'
199
+ click_button 'Place Order'
200
+
201
+ within_stripe_3ds_popup do
202
+ click_button('Fail')
203
+ end
204
+
205
+ expect(page).to_not have_content('Order placed successfully')
206
+ expect(page).to have_content('We are unable to authenticate your payment method.')
207
+ expect(page).to have_content('Please choose a different payment method and try again.')
208
+ expect(Spree::Order.complete.last).to be_nil
209
+ end
210
+ else
211
+ it 'should not place order after 3ds authentication' do
212
+ within_stripe_3ds_popup do
213
+ click_button('Fail')
214
+ end
215
+
216
+ expect(page).to_not have_content('Order placed successfully')
217
+ expect(page).to have_content('We are unable to authenticate your payment method.')
218
+ expect(page).to have_content('Please choose a different payment method and try again.')
219
+ expect(Spree::Order.complete.last).to be_nil
220
+ end
221
+ end
222
+ end
223
+ end
224
+ end
225
+ end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Spree::Gateway::AuthorizeNet do
4
- let (:gateway) { described_class.create!(name: 'Authorize.net') }
4
+ let (:gateway) { described_class.create!(name: 'Authorize.net', stores: [::Spree::Store.default]) }
5
5
 
6
6
  context '.provider_class' do
7
7
  it 'is a AuthorizeNet gateway' do