solidus_frontend 2.0.2 → 2.0.3

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: 233141f1cdd71e910f0c2e3f62ee8e60c397b126
4
- data.tar.gz: 2b5a23e34598aba2514068b2c6d919dd0c734ad8
3
+ metadata.gz: 5a591e9eca8f2ad1af78d06df64f1fb92f0dbdd2
4
+ data.tar.gz: 863b02f73442a2bc21e8d1013795ce016192b091
5
5
  SHA512:
6
- metadata.gz: bbe0f7315f1f404467ba99767e3d7c76335c07e607e9c35895253440f105c8fad3e4108c63bd7ea924dfd00110a418a8cacbab0c1802eda0224f0a0d0ccc31bb
7
- data.tar.gz: d65d5f13ce0a06ff91090f6da83f0622cf8c8084bfbdbbe473803ec7c03478ba39c70ee7e88db84852b2f1214dc3b7a5096ee77a6c02d6b98614a83fdddff0a8
6
+ metadata.gz: ccb8362c714272e32fe20b7ea0777c29e20a61b790bfefbec1dd626855aa7653228053919ba60234ebe2953890c3954a7e2cd3ccc36d45d15ec65d95a8857dfb
7
+ data.tar.gz: '09b911642991cf16896b1e3722382560724a51a72031d0880c1b3f9bad568509cc41e083694d59279c6f820a78ef65d07eb4db855dfaef0a05cca30b75fe0158'
@@ -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!(display_on: "back_end") }
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
@@ -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: 2.0.2
4
+ version: 2.0.3
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: 2.0.2
19
+ version: 2.0.3
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.0.2
26
+ version: 2.0.3
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.0.2
33
+ version: 2.0.3
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.0.2
40
+ version: 2.0.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: canonical-rails
43
43
  requirement: !ruby/object:Gem::Requirement