solidus_frontend 2.2.1 → 2.2.2

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: 02bdf3918a386c777f45234218b8759a5b5ef51f
4
- data.tar.gz: 182b9221127e63529ef431a6feec7484e1b847b9
3
+ metadata.gz: f80a15237e018ec72f6f3c37732bf4b48791274f
4
+ data.tar.gz: '05953613a4aae475826ac05522df13be3a0215e6'
5
5
  SHA512:
6
- metadata.gz: 54c857e8eb52290c27be43c916364cf017f900a605775de14578170e7063c947ecdea34ab2b67691673148c415283217dfcad0b9ac83077cc38f0e786e448e65
7
- data.tar.gz: e8ef9376b490fa6e2a78d8e1cb00583bcc1fef56eac1e1bffb0223782058a17293bcc4fb2d9829a97ae9b18c140a44b33db8f996f031f736abc4e39c1c1c331d
6
+ metadata.gz: 78f0d29ec7da1e242f51b99252446fd8ba8fd413ba5b6e3f7a0bfa9fbc4c4b87fb7d0c3d22519bf025313b55ac23509242ce8383aa3d71a81406f03a8142a965
7
+ data.tar.gz: 3cb69bb1575f3419018b6fff0cb0ce05622e2a10c79891a02d694432835257633ddab5b19fbbb5e5280b61bcc7eba166e419bf5ece5427fe6ea640ad00eee4c7
@@ -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
@@ -218,6 +218,53 @@ describe Spree::CheckoutController, type: :controller do
218
218
  end
219
219
  end
220
220
 
221
+ context "when in the payment state" do
222
+ let(:order) { create(:order_with_line_items) }
223
+ let(:payment_method) { create(:credit_card_payment_method) }
224
+
225
+ let(:params) do
226
+ {
227
+ state: 'payment',
228
+ order: {
229
+ payments_attributes: [
230
+ {
231
+ payment_method_id: payment_method.id.to_s,
232
+ source_attributes: attributes_for(:credit_card)
233
+ }
234
+ ]
235
+ }
236
+ }
237
+ end
238
+
239
+ before do
240
+ order.update_attributes! user: user
241
+ 3.times { order.next! } # should put us in the payment state
242
+ end
243
+
244
+ context 'with a permitted payment method' do
245
+ it 'sets the payment amount' do
246
+ post :update, params: params
247
+ order.reload
248
+ expect(order.state).to eq('confirm')
249
+ expect(order.payments.size).to eq(1)
250
+ expect(order.payments.first.amount).to eq(order.total)
251
+ end
252
+ end
253
+
254
+ context 'with an unpermitted payment method' do
255
+ before { payment_method.update!(available_to_users: false) }
256
+
257
+ it 'sets the payment amount' do
258
+ expect {
259
+ post :update, params: params
260
+ }.to raise_error(ActiveRecord::RecordNotFound)
261
+
262
+ expect(order.state).to eq('payment')
263
+ expect(order.payments).to be_empty
264
+ end
265
+ end
266
+ end
267
+
221
268
  context "when in the confirm state" do
222
269
  before do
223
270
  order.update_attributes! user: user
@@ -77,9 +77,9 @@ describe "Checkout", type: :feature, inaccessible: true do
77
77
 
78
78
  # Regression test for https://github.com/spree/spree/issues/2694 and https://github.com/spree/spree/issues/4117
79
79
  context "doesn't allow bad credit card numbers" do
80
+ let!(:payment_method) { create(:credit_card_payment_method) }
80
81
  before(:each) do
81
82
  order = OrderWalkthrough.up_to(:delivery)
82
- allow(order).to receive_messages(available_payment_methods: [create(:credit_card_payment_method)])
83
83
 
84
84
  user = create(:user)
85
85
  order.user = user
@@ -180,7 +180,8 @@ describe "Checkout", type: :feature, inaccessible: true do
180
180
  end
181
181
 
182
182
  context "user has payment sources", js: true do
183
- let(:bogus) { create(:credit_card_payment_method) }
183
+ before { Spree::PaymentMethod.all.each(&:really_destroy!) }
184
+ let!(:bogus) { create(:credit_card_payment_method) }
184
185
  let(:user) { create(:user) }
185
186
 
186
187
  let!(:credit_card) do
@@ -190,7 +191,6 @@ describe "Checkout", type: :feature, inaccessible: true do
190
191
  before do
191
192
  user.wallet.add(credit_card)
192
193
  order = OrderWalkthrough.up_to(:delivery)
193
- allow(order).to receive_messages(available_payment_methods: [bogus])
194
194
 
195
195
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
196
196
  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.2.1
4
+ version: 2.2.2
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-05-09 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.2.1
19
+ version: 2.2.2
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.2.1
26
+ version: 2.2.2
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.2.1
33
+ version: 2.2.2
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.2.1
40
+ version: 2.2.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: canonical-rails
43
43
  requirement: !ruby/object:Gem::Requirement