solidus_frontend 1.4.2 → 2.0.0.beta1
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/controller_extension_spec.rb +8 -8
- data/spec/controllers/spree/checkout_controller_spec.rb +30 -77
- data/spec/controllers/spree/orders_controller_ability_spec.rb +12 -12
- data/spec/controllers/spree/orders_controller_spec.rb +8 -8
- data/spec/controllers/spree/orders_controller_transitions_spec.rb +1 -1
- data/spec/controllers/spree/products_controller_spec.rb +3 -3
- data/spec/controllers/spree/taxons_controller_spec.rb +1 -1
- data/spec/features/checkout_spec.rb +3 -44
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35174a1d86fe3e4bf14e4ce01f7815bb64b5e2e3
|
4
|
+
data.tar.gz: f9814143d0540e844f6d14700a90b6641c7a94dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4ed00cda57de1509187aeacc3229787f38d37f0eb4dcb7fb6ff773b51cd2f11d8f2a2971b6bfc32568f07db8bbc697e4582a2f8ac1c84c3ade67555de88259b
|
7
|
+
data.tar.gz: 837ecdfe8f42f43bf91aae9af8878ff66b818affbfa53772d6f4224a5215e555a146c1982bb0934df9d5db21d244011bb532f570368ca294932b9634e608c1b6
|
@@ -6,7 +6,7 @@ require 'spec_helper'
|
|
6
6
|
class Spree::CustomController < Spree::BaseController
|
7
7
|
def index
|
8
8
|
respond_with(Spree::Address.new) do |format|
|
9
|
-
format.html { render
|
9
|
+
format.html { render plain: "neutral" }
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -42,7 +42,7 @@ describe Spree::CustomController, type: :controller do
|
|
42
42
|
private
|
43
43
|
|
44
44
|
def success_method
|
45
|
-
render
|
45
|
+
render plain: 'success!!!'
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -59,8 +59,8 @@ describe Spree::CustomController, type: :controller do
|
|
59
59
|
context "render" do
|
60
60
|
before do
|
61
61
|
Spree::CustomController.instance_eval do
|
62
|
-
respond_override({ index: { html: { success: lambda { render(
|
63
|
-
respond_override({ index: { html: { failure: lambda { render(
|
62
|
+
respond_override({ index: { html: { success: lambda { render(plain: 'success!!!') } } } })
|
63
|
+
respond_override({ index: { html: { failure: lambda { render(plain: 'failure!!!') } } } })
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
@@ -77,7 +77,7 @@ describe Spree::CustomController, type: :controller do
|
|
77
77
|
before do
|
78
78
|
Spree::CustomController.instance_eval do
|
79
79
|
respond_override({ index: { html: { success: lambda { redirect_to('/cart') } } } })
|
80
|
-
respond_override({ index: { html: { failure: lambda { render(
|
80
|
+
respond_override({ index: { html: { failure: lambda { render(plain: 'failure!!!') } } } })
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -93,8 +93,8 @@ describe Spree::CustomController, type: :controller do
|
|
93
93
|
before do
|
94
94
|
Spree::CustomController.instance_eval do
|
95
95
|
respond_to :html
|
96
|
-
respond_override({ create: { html: { success: lambda { render(
|
97
|
-
respond_override({ create: { html: { failure: lambda { render(
|
96
|
+
respond_override({ create: { html: { success: lambda { render(plain: 'success!!!') } } } })
|
97
|
+
respond_override({ create: { html: { failure: lambda { render(plain: 'failure!!!') } } } })
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -110,7 +110,7 @@ describe Spree::CustomController, type: :controller do
|
|
110
110
|
context 'A different controllers respond_override. Regression test for #1301' do
|
111
111
|
before do
|
112
112
|
Spree::CheckoutController.instance_eval do
|
113
|
-
respond_override({ index: { html: { success: lambda { render(
|
113
|
+
respond_override({ index: { html: { success: lambda { render(plain: 'success!!!') } } } })
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
@@ -20,31 +20,31 @@ describe Spree::CheckoutController, type: :controller do
|
|
20
20
|
it 'should check if the user is authorized for :edit' do
|
21
21
|
expect(controller).to receive(:authorize!).with(:edit, order, token)
|
22
22
|
request.cookie_jar.signed[:guest_token] = token
|
23
|
-
get :edit, { state: 'address' }
|
23
|
+
get :edit, params: { state: 'address' }
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should redirect to the cart path unless checkout_allowed?" do
|
27
27
|
allow(order).to receive_messages checkout_allowed?: false
|
28
|
-
get :edit, { state: "delivery" }
|
28
|
+
get :edit, params: { state: "delivery" }
|
29
29
|
expect(response).to redirect_to(spree.cart_path)
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should redirect to the cart path if current_order is nil" do
|
33
33
|
allow(controller).to receive(:current_order).and_return(nil)
|
34
|
-
get :edit, { state: "delivery" }
|
34
|
+
get :edit, params: { state: "delivery" }
|
35
35
|
expect(response).to redirect_to(spree.cart_path)
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should redirect to cart if order is completed" do
|
39
39
|
allow(order).to receive_messages(completed?: true)
|
40
|
-
get :edit, { state: "address" }
|
40
|
+
get :edit, params: { state: "address" }
|
41
41
|
expect(response).to redirect_to(spree.cart_path)
|
42
42
|
end
|
43
43
|
|
44
44
|
# Regression test for https://github.com/spree/spree/issues/2280
|
45
45
|
it "should redirect to current step trying to access a future step" do
|
46
46
|
order.update_column(:state, "address")
|
47
|
-
get :edit, { state: "delivery" }
|
47
|
+
get :edit, params: { state: "delivery" }
|
48
48
|
expect(response).to redirect_to spree.checkout_state_path("address")
|
49
49
|
end
|
50
50
|
|
@@ -58,7 +58,7 @@ describe Spree::CheckoutController, type: :controller do
|
|
58
58
|
it "should associate the order with a user" do
|
59
59
|
order.update_column :user_id, nil
|
60
60
|
expect(order).to receive(:associate_user!).with(user)
|
61
|
-
get :edit, {
|
61
|
+
get :edit, session: { order_id: 1 }
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
@@ -67,12 +67,12 @@ describe Spree::CheckoutController, type: :controller do
|
|
67
67
|
it 'should check if the user is authorized for :edit' do
|
68
68
|
expect(controller).to receive(:authorize!).with(:edit, order, token)
|
69
69
|
request.cookie_jar.signed[:guest_token] = token
|
70
|
-
post :update, { state: 'address' }
|
70
|
+
post :update, params: { state: 'address' }
|
71
71
|
end
|
72
72
|
|
73
73
|
context "save successful" do
|
74
74
|
def post_address
|
75
|
-
post :update, {
|
75
|
+
post :update, params: {
|
76
76
|
state: "address",
|
77
77
|
order: {
|
78
78
|
bill_address_attributes: address_params,
|
@@ -81,9 +81,9 @@ describe Spree::CheckoutController, type: :controller do
|
|
81
81
|
}
|
82
82
|
end
|
83
83
|
|
84
|
-
let!(:payment_method) { create(:payment_method) }
|
85
84
|
before do
|
86
85
|
# 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
|
@@ -95,7 +95,7 @@ describe Spree::CheckoutController, type: :controller do
|
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should assign order" do
|
98
|
-
post :update, { state: "address" }
|
98
|
+
post :update, params: { state: "address" }
|
99
99
|
expect(assigns[:order]).not_to be_nil
|
100
100
|
end
|
101
101
|
|
@@ -112,7 +112,7 @@ describe Spree::CheckoutController, type: :controller do
|
|
112
112
|
context "current_user respond to save address method" do
|
113
113
|
it "calls persist order address on user" do
|
114
114
|
expect(user).to receive(:persist_order_address)
|
115
|
-
post :update, {
|
115
|
+
post :update, params: {
|
116
116
|
state: "address",
|
117
117
|
order: {
|
118
118
|
bill_address_attributes: address_params,
|
@@ -125,7 +125,7 @@ describe Spree::CheckoutController, type: :controller do
|
|
125
125
|
|
126
126
|
context "current_user doesnt respond to persist_order_address" do
|
127
127
|
it "doesnt raise any error" do
|
128
|
-
post :update, {
|
128
|
+
post :update, params: {
|
129
129
|
state: "address",
|
130
130
|
order: {
|
131
131
|
bill_address_attributes: address_params,
|
@@ -145,7 +145,7 @@ describe Spree::CheckoutController, type: :controller do
|
|
145
145
|
|
146
146
|
context "with a billing and shipping address" do
|
147
147
|
subject do
|
148
|
-
post :update, {
|
148
|
+
post :update, params: {
|
149
149
|
state: "address",
|
150
150
|
order: {
|
151
151
|
bill_address_attributes: order.bill_address.attributes.except("created_at", "updated_at").compact,
|
@@ -210,7 +210,7 @@ describe Spree::CheckoutController, type: :controller do
|
|
210
210
|
end
|
211
211
|
|
212
212
|
it 'sets the payment amount' do
|
213
|
-
post :update, params
|
213
|
+
post :update, params: params
|
214
214
|
order.reload
|
215
215
|
expect(order.state).to eq('new_step')
|
216
216
|
expect(order.payments.size).to eq(1)
|
@@ -218,53 +218,6 @@ 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
|
-
|
268
221
|
context "when in the confirm state" do
|
269
222
|
before do
|
270
223
|
order.update_attributes! user: user
|
@@ -278,17 +231,17 @@ describe Spree::CheckoutController, type: :controller do
|
|
278
231
|
|
279
232
|
# This inadvertently is a regression test for https://github.com/spree/spree/issues/2694
|
280
233
|
it "should redirect to the order view" do
|
281
|
-
post :update, { state: "confirm" }
|
234
|
+
post :update, params: { state: "confirm" }
|
282
235
|
expect(response).to redirect_to spree.order_path(order)
|
283
236
|
end
|
284
237
|
|
285
238
|
it "should populate the flash message" do
|
286
|
-
post :update, { state: "confirm" }
|
239
|
+
post :update, params: { state: "confirm" }
|
287
240
|
expect(flash.notice).to eq(Spree.t(:order_processed_successfully))
|
288
241
|
end
|
289
242
|
|
290
243
|
it "should remove completed order from current_order" do
|
291
|
-
post :update, { state: "confirm" }, { order_id: "foofah" }
|
244
|
+
post :update, params: { state: "confirm" }, session: { order_id: "foofah" }
|
292
245
|
expect(assigns(:current_order)).to be_nil
|
293
246
|
expect(assigns(:order)).to eql controller.current_order
|
294
247
|
end
|
@@ -302,16 +255,16 @@ describe Spree::CheckoutController, type: :controller do
|
|
302
255
|
end
|
303
256
|
|
304
257
|
it "should not assign order" do
|
305
|
-
post :update, { state: "address", email: '' }
|
258
|
+
post :update, params: { state: "address", email: '' }
|
306
259
|
expect(assigns[:order]).not_to be_nil
|
307
260
|
end
|
308
261
|
|
309
262
|
it "should not change the order state" do
|
310
|
-
post :update, { state: 'address' }
|
263
|
+
post :update, params: { state: 'address' }
|
311
264
|
end
|
312
265
|
|
313
266
|
it "should render the edit template" do
|
314
|
-
post :update, { state: 'address' }
|
267
|
+
post :update, params: { state: 'address' }
|
315
268
|
expect(response).to render_template :edit
|
316
269
|
end
|
317
270
|
end
|
@@ -321,11 +274,11 @@ describe Spree::CheckoutController, type: :controller do
|
|
321
274
|
|
322
275
|
it "should not change the state if order is completed" do
|
323
276
|
expect(order).not_to receive(:update_attribute)
|
324
|
-
post :update, { state: "confirm" }
|
277
|
+
post :update, params: { state: "confirm" }
|
325
278
|
end
|
326
279
|
|
327
280
|
it "should redirect to the cart_path" do
|
328
|
-
post :update, { state: "confirm" }
|
281
|
+
post :update, params: { state: "confirm" }
|
329
282
|
expect(response).to redirect_to spree.cart_path
|
330
283
|
end
|
331
284
|
end
|
@@ -334,7 +287,7 @@ describe Spree::CheckoutController, type: :controller do
|
|
334
287
|
before do
|
335
288
|
order.update_attributes! user: user
|
336
289
|
allow(order).to receive(:next).and_raise(Spree::Core::GatewayError.new("Invalid something or other."))
|
337
|
-
post :update, { state: "address" }
|
290
|
+
post :update, params: { state: "address" }
|
338
291
|
end
|
339
292
|
|
340
293
|
it "should render the edit template and display exception message" do
|
@@ -365,7 +318,7 @@ describe Spree::CheckoutController, type: :controller do
|
|
365
318
|
end
|
366
319
|
|
367
320
|
it "due to the order having errors" do
|
368
|
-
put :update, state: order.state, order: {}
|
321
|
+
put :update, params: { state: order.state, order: {} }
|
369
322
|
expect(flash[:error]).to eq("Base error\nAdjustments error")
|
370
323
|
expect(response).to redirect_to(spree.checkout_state_path('address'))
|
371
324
|
end
|
@@ -400,7 +353,7 @@ describe Spree::CheckoutController, type: :controller do
|
|
400
353
|
expect(order.shipments.count).to eq(1)
|
401
354
|
order.shipments.first.shipping_rates.delete_all
|
402
355
|
order.update_attributes(state: 'confirm')
|
403
|
-
put :update, state: order.state, order: {}
|
356
|
+
put :update, params: { state: order.state, order: {} }
|
404
357
|
expect(flash[:error]).to eq(Spree.t(:items_cannot_be_shipped))
|
405
358
|
expect(response).to redirect_to(spree.checkout_state_path('confirm'))
|
406
359
|
end
|
@@ -428,7 +381,7 @@ describe Spree::CheckoutController, type: :controller do
|
|
428
381
|
|
429
382
|
it "fails to transition from payment to complete" do
|
430
383
|
allow_any_instance_of(Spree::Payment).to receive(:process!).and_raise(Spree::Core::GatewayError.new(Spree.t(:payment_processing_failed)))
|
431
|
-
put :update, state: order.state, order: {}
|
384
|
+
put :update, params: { state: order.state, order: {} }
|
432
385
|
expect(flash[:error]).to eq(Spree.t(:payment_processing_failed))
|
433
386
|
end
|
434
387
|
end
|
@@ -450,7 +403,7 @@ describe Spree::CheckoutController, type: :controller do
|
|
450
403
|
|
451
404
|
context "and back orders are not allowed" do
|
452
405
|
before do
|
453
|
-
post :update, { state: "payment" }
|
406
|
+
post :update, params: { state: "payment" }
|
454
407
|
end
|
455
408
|
|
456
409
|
it "should redirect to cart" do
|
@@ -472,12 +425,12 @@ describe Spree::CheckoutController, type: :controller do
|
|
472
425
|
|
473
426
|
it "doesn't set shipping address on the order" do
|
474
427
|
expect(order).to_not receive(:ship_address=)
|
475
|
-
post :update, state: order.state
|
428
|
+
post :update, params: { state: order.state }
|
476
429
|
end
|
477
430
|
|
478
431
|
it "doesn't remove unshippable items before payment" do
|
479
432
|
expect {
|
480
|
-
post :update, { state: "payment" }
|
433
|
+
post :update, params: { state: "payment" }
|
481
434
|
}.to_not change { order.line_items }
|
482
435
|
end
|
483
436
|
end
|
@@ -487,7 +440,7 @@ describe Spree::CheckoutController, type: :controller do
|
|
487
440
|
allow(controller).to receive_messages check_authorization: true
|
488
441
|
|
489
442
|
expect {
|
490
|
-
post :update, { state: "payment" }
|
443
|
+
post :update, params: { state: "payment" }
|
491
444
|
}.to change { order.line_items.to_a.size }.from(1).to(0)
|
492
445
|
end
|
493
446
|
end
|
@@ -25,22 +25,22 @@ module Spree
|
|
25
25
|
context '#populate' do
|
26
26
|
it 'should check if user is authorized for :edit' do
|
27
27
|
expect(controller).to receive(:authorize!).with(:edit, order, token)
|
28
|
-
post :populate, token: token
|
28
|
+
post :populate, params: { token: token }
|
29
29
|
end
|
30
30
|
it "should check against the specified order" do
|
31
31
|
expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
|
32
|
-
post :populate, id: specified_order.number, token: token
|
32
|
+
post :populate, params: { id: specified_order.number, token: token }
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
context '#edit' do
|
37
37
|
it 'should check if user is authorized for :edit' do
|
38
38
|
expect(controller).to receive(:authorize!).with(:edit, order, token)
|
39
|
-
get :edit, token: token
|
39
|
+
get :edit, params: { token: token }
|
40
40
|
end
|
41
41
|
it "should check against the specified order" do
|
42
42
|
expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
|
43
|
-
get :edit, id: specified_order.number, token: token
|
43
|
+
get :edit, params: { id: specified_order.number, token: token }
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -48,30 +48,30 @@ module Spree
|
|
48
48
|
it 'should check if user is authorized for :edit' do
|
49
49
|
allow(order).to receive :update_attributes
|
50
50
|
expect(controller).to receive(:authorize!).with(:edit, order, token)
|
51
|
-
post :update, order: { email: "foo@bar.com" }, token: token
|
51
|
+
post :update, params: { order: { email: "foo@bar.com" }, token: token }
|
52
52
|
end
|
53
53
|
it "should check against the specified order" do
|
54
54
|
allow(order).to receive :update_attributes
|
55
55
|
expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
|
56
|
-
post :update, order: { email: "foo@bar.com" }, id: specified_order.number, token: token
|
56
|
+
post :update, params: { order: { email: "foo@bar.com" }, id: specified_order.number, token: token }
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
60
|
context '#empty' do
|
61
61
|
it 'should check if user is authorized for :edit' do
|
62
62
|
expect(controller).to receive(:authorize!).with(:edit, order, token)
|
63
|
-
post :empty, token: token
|
63
|
+
post :empty, params: { token: token }
|
64
64
|
end
|
65
65
|
it "should check against the specified order" do
|
66
66
|
expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
|
67
|
-
post :empty, id: specified_order.number, token: token
|
67
|
+
post :empty, params: { id: specified_order.number, token: token }
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
context "#show" do
|
72
72
|
it "should check against the specified order" do
|
73
73
|
expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
|
74
|
-
get :show, id: specified_order.number, token: token
|
74
|
+
get :show, params: { id: specified_order.number, token: token }
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
@@ -83,19 +83,19 @@ module Spree
|
|
83
83
|
context 'when token parameter present' do
|
84
84
|
it 'always ooverride existing token when passing a new one' do
|
85
85
|
cookies.signed[:guest_token] = "soo wrong"
|
86
|
-
get :show, { id: 'R123', token: order.guest_token }
|
86
|
+
get :show, params: { id: 'R123', token: order.guest_token }
|
87
87
|
expect(cookies.signed[:guest_token]).to eq(order.guest_token)
|
88
88
|
end
|
89
89
|
|
90
90
|
it 'should store as guest_token in session' do
|
91
|
-
get :show, { id: 'R123', token: order.guest_token }
|
91
|
+
get :show, params: { id: 'R123', token: order.guest_token }
|
92
92
|
expect(cookies.signed[:guest_token]).to eq(order.guest_token)
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
96
|
context 'when no token present' do
|
97
97
|
it 'should respond with 404' do
|
98
|
-
get :show, { id: 'R123' }
|
98
|
+
get :show, params: { id: 'R123' }
|
99
99
|
expect(response.code).to eq('404')
|
100
100
|
end
|
101
101
|
end
|
@@ -16,7 +16,7 @@ describe Spree::OrdersController, type: :controller do
|
|
16
16
|
|
17
17
|
context "#populate" do
|
18
18
|
it "should create a new order when none specified" do
|
19
|
-
post :populate
|
19
|
+
post :populate
|
20
20
|
expect(cookies.signed[:guest_token]).not_to be_blank
|
21
21
|
expect(Spree::Order.find_by_guest_token(cookies.signed[:guest_token])).to be_persisted
|
22
22
|
end
|
@@ -24,7 +24,7 @@ describe Spree::OrdersController, type: :controller do
|
|
24
24
|
context "with Variant" do
|
25
25
|
it "should handle population" do
|
26
26
|
expect do
|
27
|
-
post :populate, variant_id: variant.id, quantity: 5
|
27
|
+
post :populate, params: { variant_id: variant.id, quantity: 5 }
|
28
28
|
end.to change { user.orders.count }.by(1)
|
29
29
|
order = user.orders.last
|
30
30
|
expect(response).to redirect_to spree.cart_path
|
@@ -44,7 +44,7 @@ describe Spree::OrdersController, type: :controller do
|
|
44
44
|
and_return(["Order population failed"])
|
45
45
|
)
|
46
46
|
|
47
|
-
post :populate, variant_id: variant.id, quantity: 5
|
47
|
+
post :populate, params: { variant_id: variant.id, quantity: 5 }
|
48
48
|
|
49
49
|
expect(response).to redirect_to(spree.root_path)
|
50
50
|
expect(flash[:error]).to eq("Order population failed")
|
@@ -55,7 +55,7 @@ describe Spree::OrdersController, type: :controller do
|
|
55
55
|
|
56
56
|
post(
|
57
57
|
:populate,
|
58
|
-
variant_id: variant.id, quantity: -1
|
58
|
+
params: { variant_id: variant.id, quantity: -1 }
|
59
59
|
)
|
60
60
|
|
61
61
|
expect(response).to redirect_to(spree.root_path)
|
@@ -76,13 +76,13 @@ describe Spree::OrdersController, type: :controller do
|
|
76
76
|
it "should render the edit view (on failure)" do
|
77
77
|
# email validation is only after address state
|
78
78
|
order.update_column(:state, "delivery")
|
79
|
-
put :update, { order: { email: "" } }, { order_id: order.id }
|
79
|
+
put :update, params: { order: { email: "" } }, session: { order_id: order.id }
|
80
80
|
expect(response).to render_template :edit
|
81
81
|
end
|
82
82
|
|
83
83
|
it "should redirect to cart path (on success)" do
|
84
84
|
allow(order).to receive(:update_attributes).and_return true
|
85
|
-
put :update,
|
85
|
+
put :update, session: { order_id: 1 }
|
86
86
|
expect(response).to redirect_to(spree.cart_path)
|
87
87
|
end
|
88
88
|
end
|
@@ -109,7 +109,7 @@ describe Spree::OrdersController, type: :controller do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
it "cannot update a blank order" do
|
112
|
-
put :update, order: { email: "foo" }
|
112
|
+
put :update, params: { order: { email: "foo" } }
|
113
113
|
expect(flash[:error]).to eq(Spree.t(:order_not_found))
|
114
114
|
expect(response).to redirect_to(spree.root_path)
|
115
115
|
end
|
@@ -128,7 +128,7 @@ describe Spree::OrdersController, type: :controller do
|
|
128
128
|
|
129
129
|
it "removes line items on update" do
|
130
130
|
expect(order.line_items.count).to eq 1
|
131
|
-
put :update, order: { line_items_attributes: { "0" => { id: line_item.id, quantity: 0 } } }
|
131
|
+
put :update, params: { order: { line_items_attributes: { "0" => { id: line_item.id, quantity: 0 } } } }
|
132
132
|
expect(order.reload.line_items.count).to eq 0
|
133
133
|
end
|
134
134
|
end
|
@@ -23,7 +23,7 @@ module Spree
|
|
23
23
|
it "correctly calls the transition callback" do
|
24
24
|
expect(order.did_transition).to be_nil
|
25
25
|
order.line_items << FactoryGirl.create(:line_item)
|
26
|
-
put :update, { checkout: "checkout" }, { order_id: 1 }
|
26
|
+
put :update, params: { checkout: "checkout" }, session: { order_id: 1 }
|
27
27
|
expect(order.did_transition).to be true
|
28
28
|
end
|
29
29
|
end
|
@@ -6,12 +6,12 @@ describe Spree::ProductsController, type: :controller do
|
|
6
6
|
# Regression test for https://github.com/spree/spree/issues/1390
|
7
7
|
it "allows admins to view non-active products" do
|
8
8
|
allow(controller).to receive_messages spree_current_user: mock_model(Spree.user_class, has_spree_role?: true, last_incomplete_spree_order: nil, spree_api_key: 'fake')
|
9
|
-
get :show, id: product.to_param
|
9
|
+
get :show, params: { id: product.to_param }
|
10
10
|
expect(response.status).to eq(200)
|
11
11
|
end
|
12
12
|
|
13
13
|
it "cannot view non-active products" do
|
14
|
-
get :show, id: product.to_param
|
14
|
+
get :show, params: { id: product.to_param }
|
15
15
|
expect(response.status).to eq(404)
|
16
16
|
end
|
17
17
|
|
@@ -30,6 +30,6 @@ describe Spree::ProductsController, type: :controller do
|
|
30
30
|
request.env['HTTP_REFERER'] = "not|a$url"
|
31
31
|
|
32
32
|
# Previously a URI::InvalidURIError exception was being thrown
|
33
|
-
get :show, id: product.to_param
|
33
|
+
get :show, params: { id: product.to_param }
|
34
34
|
end
|
35
35
|
end
|
@@ -6,7 +6,7 @@ describe Spree::TaxonsController, type: :controller do
|
|
6
6
|
user = mock_model(Spree.user_class, last_incomplete_spree_order: nil, spree_api_key: 'fake')
|
7
7
|
allow(controller).to receive_messages spree_current_user: user
|
8
8
|
expect_any_instance_of(Spree::Config.searcher_class).to receive(:current_user=).with(user)
|
9
|
-
get :show, id: taxon.permalink
|
9
|
+
get :show, params: { id: taxon.permalink }
|
10
10
|
expect(response.status).to eq(200)
|
11
11
|
end
|
12
12
|
end
|
@@ -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) }
|
81
80
|
before(:each) do
|
82
81
|
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,8 +180,7 @@ describe "Checkout", type: :feature, inaccessible: true do
|
|
180
180
|
end
|
181
181
|
|
182
182
|
context "user has payment sources", js: true do
|
183
|
-
|
184
|
-
let!(:bogus) { create(:credit_card_payment_method) }
|
183
|
+
let(:bogus) { create(:credit_card_payment_method) }
|
185
184
|
let(:user) { create(:user) }
|
186
185
|
|
187
186
|
let!(:credit_card) do
|
@@ -190,6 +189,7 @@ describe "Checkout", type: :feature, inaccessible: true do
|
|
190
189
|
|
191
190
|
before do
|
192
191
|
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)
|
@@ -491,47 +491,6 @@ describe "Checkout", type: :feature, inaccessible: true do
|
|
491
491
|
end
|
492
492
|
end
|
493
493
|
|
494
|
-
context "using credit card" do
|
495
|
-
let!(:payment_method) { create(:credit_card_payment_method) }
|
496
|
-
|
497
|
-
# Regression test for https://github.com/solidusio/solidus/issues/1421
|
498
|
-
it "works with card number 1", js: true do
|
499
|
-
add_mug_to_cart
|
500
|
-
|
501
|
-
click_on "Checkout"
|
502
|
-
fill_in "order_email", with: "test@example.com"
|
503
|
-
fill_in_address
|
504
|
-
click_on "Save and Continue"
|
505
|
-
click_on "Save and Continue"
|
506
|
-
|
507
|
-
fill_in_credit_card(number: "1")
|
508
|
-
click_on "Save and Continue"
|
509
|
-
|
510
|
-
expect(page).to have_current_path("/checkout/confirm")
|
511
|
-
end
|
512
|
-
|
513
|
-
it "works with card number 4111111111111111", js: true do
|
514
|
-
add_mug_to_cart
|
515
|
-
|
516
|
-
click_on "Checkout"
|
517
|
-
fill_in "order_email", with: "test@example.com"
|
518
|
-
fill_in_address
|
519
|
-
click_on "Save and Continue"
|
520
|
-
click_on "Save and Continue"
|
521
|
-
|
522
|
-
fill_in_credit_card(number: "4111111111111111")
|
523
|
-
click_on "Save and Continue"
|
524
|
-
|
525
|
-
expect(page).to have_current_path("/checkout/confirm")
|
526
|
-
end
|
527
|
-
end
|
528
|
-
|
529
|
-
def fill_in_credit_card(number:)
|
530
|
-
fill_in "Card Number", with: number
|
531
|
-
fill_in "Expiration", with: "1224"
|
532
|
-
fill_in "Card Code", with: "123"
|
533
|
-
end
|
534
|
-
|
535
494
|
def fill_in_address
|
536
495
|
address = "order_bill_address_attributes"
|
537
496
|
fill_in "#{address}_firstname", with: "Ryan"
|
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:
|
4
|
+
version: 2.0.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solidus Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-19 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:
|
19
|
+
version: 2.0.0.beta1
|
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:
|
26
|
+
version: 2.0.0.beta1
|
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:
|
33
|
+
version: 2.0.0.beta1
|
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:
|
40
|
+
version: 2.0.0.beta1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: canonical-rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -340,13 +340,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
340
340
|
version: 2.1.0
|
341
341
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
342
342
|
requirements:
|
343
|
-
- - "
|
343
|
+
- - ">"
|
344
344
|
- !ruby/object:Gem::Version
|
345
|
-
version:
|
345
|
+
version: 1.3.1
|
346
346
|
requirements:
|
347
347
|
- none
|
348
348
|
rubyforge_project: solidus_frontend
|
349
|
-
rubygems_version: 2.
|
349
|
+
rubygems_version: 2.5.1
|
350
350
|
signing_key:
|
351
351
|
specification_version: 4
|
352
352
|
summary: Cart and storefront for the Solidus e-commerce project.
|