solidus_frontend 2.3.0 → 2.3.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 +4 -4
- data/spec/controllers/spree/checkout_controller_spec.rb +48 -1
- data/spec/features/checkout_spec.rb +3 -3
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4d176efa0436e1940a95991523624736fb3d1e0
|
4
|
+
data.tar.gz: af932af8026330bf6bff2f79d494a870ef9c8cb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12f0588f86bd39eac042c2b3c10cab6eb7f6e979592eab4dbcb75e0c4ebf54f833d9babdd0c6791d60fc18927bbdbdaf5ed3bbb52c76280f28e22f92562df1c0
|
7
|
+
data.tar.gz: 337973a26fa1bdd7854235f3b7fe8d7d4f26e39f7b1bdb84b348d4ef0ad91552da8ea5490db89c582607d7048a837919e4000fca868ce23c3e5ec8303b8ef513
|
@@ -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
|
-
|
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.3.
|
4
|
+
version: 2.3.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
|
+
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.3.
|
19
|
+
version: 2.3.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.3.
|
26
|
+
version: 2.3.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.3.
|
33
|
+
version: 2.3.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.3.
|
40
|
+
version: 2.3.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: canonical-rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|