solidus_frontend 2.4.0 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_frontend might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f42a2df9f2600255c56ee5a7f7b34757d604901
4
- data.tar.gz: d45b5f07187488bbdefa4a819f8698d6bcee1f20
3
+ metadata.gz: 6fe4d98a9100810f94d3ef202311ca78e7d51ecb
4
+ data.tar.gz: 5ac0027c5f85f9a5e77ba18433eaa42dfc20f6bd
5
5
  SHA512:
6
- metadata.gz: f0c52fb11afbf64e56ea579a94311f5df441c67e16e5fa4dfffae754236fe4c949728ff785d9816e1ab68375c82793fc4babaa27554289f7bbbc73838ed4e57d
7
- data.tar.gz: bf6d46435322ca24b946133239f803af11f1f4fecc8b677573d113fdc5b2d3a4bf06df7386cb74279880cc68ee59291be95c604136ab031a598624b404865cae
6
+ metadata.gz: 0f7527ad71b706b7c015795fa5db7a9395d92f142cbcf88c2cf08b88a36737c909eae97781e4a2590840e4c4f7a0ed266a85a37946d8dd7d61f59a0dc8724794
7
+ data.tar.gz: e182d2a694c2032c10a969706d424e33265c38f1aa50161f6f5792824dba3486b2e66ee225a3cea775a49ed4d94010ffc38b9ac789594bc2cbf71ef76198f98b
@@ -81,9 +81,9 @@ describe Spree::CheckoutController, type: :controller do
81
81
  }
82
82
  end
83
83
 
84
+ let!(:payment_method) { create(:payment_method) }
84
85
  before do
85
86
  # Must have *a* shipping method and a payment method so updating from address works
86
- allow(order).to receive_messages available_payment_methods: [stub_model(Spree::PaymentMethod)]
87
87
  allow(order).to receive_messages ensure_available_shipping_rates: true
88
88
  order.line_items << FactoryGirl.create(:line_item)
89
89
  end
@@ -225,6 +225,53 @@ describe Spree::CheckoutController, type: :controller do
225
225
  end
226
226
  end
227
227
 
228
+ context "when in the payment state" do
229
+ let(:order) { create(:order_with_line_items) }
230
+ let(:payment_method) { create(:credit_card_payment_method) }
231
+
232
+ let(:params) do
233
+ {
234
+ state: 'payment',
235
+ order: {
236
+ payments_attributes: [
237
+ {
238
+ payment_method_id: payment_method.id.to_s,
239
+ source_attributes: attributes_for(:credit_card)
240
+ }
241
+ ]
242
+ }
243
+ }
244
+ end
245
+
246
+ before do
247
+ order.update_attributes! user: user
248
+ 3.times { order.next! } # should put us in the payment state
249
+ end
250
+
251
+ context 'with a permitted payment method' do
252
+ it 'sets the payment amount' do
253
+ post :update, params: params
254
+ order.reload
255
+ expect(order.state).to eq('confirm')
256
+ expect(order.payments.size).to eq(1)
257
+ expect(order.payments.first.amount).to eq(order.total)
258
+ end
259
+ end
260
+
261
+ context 'with an unpermitted payment method' do
262
+ before { payment_method.update!(available_to_users: false) }
263
+
264
+ it 'sets the payment amount' do
265
+ expect {
266
+ post :update, params: params
267
+ }.to raise_error(ActiveRecord::RecordNotFound)
268
+
269
+ expect(order.state).to eq('payment')
270
+ expect(order.payments).to be_empty
271
+ end
272
+ end
273
+ end
274
+
228
275
  context "when in the confirm state" do
229
276
  before do
230
277
  order.update_attributes! user: user
@@ -211,9 +211,9 @@ describe "Checkout", type: :feature, inaccessible: true do
211
211
 
212
212
  # Regression test for https://github.com/spree/spree/issues/2694 and https://github.com/spree/spree/issues/4117
213
213
  context "doesn't allow bad credit card numbers" do
214
+ let!(:payment_method) { create(:credit_card_payment_method) }
214
215
  before(:each) do
215
216
  order = OrderWalkthrough.up_to(:delivery)
216
- allow(order).to receive_messages(available_payment_methods: [create(:credit_card_payment_method)])
217
217
 
218
218
  user = create(:user)
219
219
  order.user = user
@@ -314,7 +314,8 @@ describe "Checkout", type: :feature, inaccessible: true do
314
314
  end
315
315
 
316
316
  context "user has payment sources", js: true do
317
- let(:bogus) { create(:credit_card_payment_method) }
317
+ before { Spree::PaymentMethod.all.each(&:really_destroy!) }
318
+ let!(:bogus) { create(:credit_card_payment_method) }
318
319
  let(:user) { create(:user) }
319
320
 
320
321
  let!(:credit_card) do
@@ -324,7 +325,6 @@ describe "Checkout", type: :feature, inaccessible: true do
324
325
  before do
325
326
  user.wallet.add(credit_card)
326
327
  order = OrderWalkthrough.up_to(:delivery)
327
- allow(order).to receive_messages(available_payment_methods: [bogus])
328
328
 
329
329
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
330
330
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-07 00:00:00.000000000 Z
11
+ date: 2017-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.4.0
19
+ version: 2.4.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.4.0
26
+ version: 2.4.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: solidus_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.4.0
33
+ version: 2.4.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 2.4.0
40
+ version: 2.4.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: canonical-rails
43
43
  requirement: !ruby/object:Gem::Requirement