solidus_frontend 1.4.1 → 1.4.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: 969a1e41b8f624f8d789e49fc31524326b4b53f4
4
- data.tar.gz: 347655393620652deb75193b920039a3fc96e14a
3
+ metadata.gz: b7445b5735390ba324b5f17292bba51efc77791d
4
+ data.tar.gz: 693055e8dab2d88cf9a23dd12cc7b604e1f3498d
5
5
  SHA512:
6
- metadata.gz: ba5956f088862e33d5d25ff22c6bb1f17a5d272b961b856be40400267b9a5d18f21cd19afd5a1b45dc3f4a46d7b33ded911fb222e5860fc61b29dcbdbf2bb474
7
- data.tar.gz: 7848c77f7e7f25cdaf6cd8b15ba61105a47407fdc85a7cd6a608776c22883bb623b07a7ce105121ba742d01ff13080726ee7a301793e4592777d1dcd207a1178
6
+ metadata.gz: 0e46e8d7c528f35c9d4fd2bfa8828cc807d5f7bb319437b11420b5ebb822b935bc74f6178e098cf61587c5d4e77246b834b7f6c7d461db437d248e773757a008
7
+ data.tar.gz: 4c822282eddb16600a3c1d930aec9d329d1c2ba408982a77cba7b184f4483302f60dce1485ee05b1b0c6141ccdfd25019b3071a3c7252c8d29eafe98a1332dbe
@@ -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
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!(display_on: "back_end") }
256
+
257
+ it 'sets the payment amount' do
258
+ expect {
259
+ post :update, 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
@@ -189,7 +190,6 @@ describe "Checkout", type: :feature, inaccessible: true do
189
190
 
190
191
  before do
191
192
  order = OrderWalkthrough.up_to(:delivery)
192
- allow(order).to receive_messages(available_payment_methods: [bogus])
193
193
 
194
194
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
195
195
  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: 1.4.1
4
+ version: 1.4.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-06-08 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: 1.4.1
19
+ version: 1.4.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: 1.4.1
26
+ version: 1.4.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: 1.4.1
33
+ version: 1.4.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: 1.4.1
40
+ version: 1.4.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: canonical-rails
43
43
  requirement: !ruby/object:Gem::Requirement