solidus_backend 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_backend might be problematic. Click here for more details.

Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/spree/admin/option_types_controller.rb +1 -1
  3. data/app/controllers/spree/admin/option_values_controller.rb +1 -1
  4. data/app/controllers/spree/admin/orders_controller.rb +6 -6
  5. data/app/controllers/spree/admin/resource_controller.rb +1 -1
  6. data/app/controllers/spree/admin/return_authorizations_controller.rb +1 -1
  7. data/app/controllers/spree/admin/return_items_controller.rb +2 -1
  8. data/app/controllers/spree/admin/stock_transfers_controller.rb +2 -1
  9. data/app/views/spree/admin/reimbursements/edit.html.erb +1 -1
  10. data/spec/controllers/spree/admin/base_controller_spec.rb +1 -1
  11. data/spec/controllers/spree/admin/cancellations_controller_spec.rb +3 -3
  12. data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +4 -4
  13. data/spec/controllers/spree/admin/missing_products_controller_spec.rb +1 -1
  14. data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +5 -5
  15. data/spec/controllers/spree/admin/orders_controller_spec.rb +24 -24
  16. data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +4 -4
  17. data/spec/controllers/spree/admin/payments_controller_spec.rb +7 -7
  18. data/spec/controllers/spree/admin/prices_controller_spec.rb +2 -2
  19. data/spec/controllers/spree/admin/product_properties_controller_spec.rb +1 -1
  20. data/spec/controllers/spree/admin/products_controller_spec.rb +5 -5
  21. data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +2 -2
  22. data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +1 -1
  23. data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +2 -2
  24. data/spec/controllers/spree/admin/promotions_controller_spec.rb +5 -5
  25. data/spec/controllers/spree/admin/refunds_controller_spec.rb +5 -3
  26. data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +5 -5
  27. data/spec/controllers/spree/admin/reports_controller_spec.rb +1 -1
  28. data/spec/controllers/spree/admin/resource_controller_spec.rb +6 -6
  29. data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +11 -11
  30. data/spec/controllers/spree/admin/return_items_controller_spec.rb +1 -1
  31. data/spec/controllers/spree/admin/search_controller_spec.rb +2 -2
  32. data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +1 -1
  33. data/spec/controllers/spree/admin/stock_items_controller_spec.rb +2 -2
  34. data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +9 -9
  35. data/spec/controllers/spree/admin/store_credits_controller_spec.rb +8 -8
  36. data/spec/controllers/spree/admin/users_controller_spec.rb +23 -23
  37. data/spec/controllers/spree/admin/variants_controller_spec.rb +2 -2
  38. metadata +9 -9
@@ -32,7 +32,7 @@ module Spree
32
32
  end
33
33
 
34
34
  before do
35
- post :create, attributes
35
+ post :create, params: attributes
36
36
  end
37
37
 
38
38
  it "should process payment correctly" do
@@ -81,7 +81,7 @@ module Spree
81
81
  end
82
82
 
83
83
  it "loads backend payment methods" do
84
- get :new, order_id: order.number
84
+ get :new, params: { order_id: order.number }
85
85
  expect(response.status).to eq(200)
86
86
  expect(assigns[:payment_methods]).to include(@payment_method)
87
87
  end
@@ -97,7 +97,7 @@ module Spree
97
97
 
98
98
  context "order does not have payments" do
99
99
  it "redirect to new payments page" do
100
- get :index, { amount: 100, order_id: order.number }
100
+ get :index, params: { amount: 100, order_id: order.number }
101
101
  expect(response).to redirect_to(spree.new_admin_order_payment_path(order))
102
102
  end
103
103
  end
@@ -108,7 +108,7 @@ module Spree
108
108
  end
109
109
 
110
110
  it "shows the payments page" do
111
- get :index, { amount: 100, order_id: order.number }
111
+ get :index, params: { amount: 100, order_id: order.number }
112
112
  expect(response.code).to eq "200"
113
113
  end
114
114
  end
@@ -121,7 +121,7 @@ module Spree
121
121
  end
122
122
 
123
123
  it "should redirect to the customer details page" do
124
- get :index, { amount: 100, order_id: order.number }
124
+ get :index, params: { amount: 100, order_id: order.number }
125
125
  expect(response).to redirect_to(spree.edit_admin_order_customer_path(order))
126
126
  end
127
127
  end
@@ -147,7 +147,7 @@ module Spree
147
147
 
148
148
  it 'allows the action' do
149
149
  expect {
150
- post(:fire, id: payment.to_param, e: 'capture', order_id: order.to_param)
150
+ post(:fire, params: { id: payment.to_param, e: 'capture', order_id: order.to_param })
151
151
  }.to change { payment.reload.state }.from('checkout').to('completed')
152
152
  end
153
153
 
@@ -166,7 +166,7 @@ module Spree
166
166
 
167
167
  it 'does not allow the action' do
168
168
  expect {
169
- post(:fire, id: payment.to_param, e: 'capture', order_id: order.to_param)
169
+ post(:fire, params: { id: payment.to_param, e: 'capture', order_id: order.to_param })
170
170
  }.to_not change { payment.reload.state }
171
171
  expect(flash[:error]).to eq('Authorization Failure')
172
172
  end
@@ -9,7 +9,7 @@ describe Spree::Admin::PricesController do
9
9
  context "when only given a product" do
10
10
  let(:product) { create(:product) }
11
11
 
12
- subject { get :index, product_id: product.slug }
12
+ subject { get :index, params: { product_id: product.slug } }
13
13
 
14
14
  it { is_expected.to be_success }
15
15
 
@@ -25,7 +25,7 @@ describe Spree::Admin::PricesController do
25
25
  let(:variant) { create(:variant) }
26
26
  let(:product) { variant.product }
27
27
 
28
- subject { get :index, product_id: product.slug, variant_id: variant.id }
28
+ subject { get :index, params: { product_id: product.slug, variant_id: variant.id } }
29
29
 
30
30
  it { is_expected.to be_success }
31
31
 
@@ -6,7 +6,7 @@ module Spree
6
6
  stub_authorization!
7
7
 
8
8
  describe "#index" do
9
- subject { get :index, parameters }
9
+ subject { get :index, params: parameters }
10
10
 
11
11
  context "no option values are provided" do
12
12
  let(:product) { create(:product) }
@@ -9,7 +9,7 @@ describe Spree::Admin::ProductsController, type: :controller do
9
9
  # Regression test for https://github.com/spree/spree/issues/1259
10
10
  it "can find a product by SKU" do
11
11
  product = create(:product, sku: "ABC123")
12
- get :index, q: { sku_start: "ABC123" }
12
+ get :index, params: { q: { sku_start: "ABC123" } }
13
13
  expect(assigns[:collection]).not_to be_empty
14
14
  expect(assigns[:collection]).to include(product)
15
15
  end
@@ -19,7 +19,7 @@ describe Spree::Admin::ProductsController, type: :controller do
19
19
  context "adding properties to a product" do
20
20
  let!(:product) { create(:product) }
21
21
  specify do
22
- put :update, id: product.to_param, product: { product_properties_attributes: { "1" => { property_name: "Foo", value: "bar" } } }
22
+ put :update, params: { id: product.to_param, product: { product_properties_attributes: { "1" => { property_name: "Foo", value: "bar" } } } }
23
23
  expect(flash[:success]).to eq("Product #{product.name.inspect} has been successfully updated!")
24
24
  end
25
25
  end
@@ -53,7 +53,7 @@ describe Spree::Admin::ProductsController, type: :controller do
53
53
  }
54
54
  end
55
55
 
56
- subject { put :update, payload }
56
+ subject { put :update, params: payload }
57
57
 
58
58
  it "creates a variant property rule" do
59
59
  expect { subject }.to change { product.variant_property_rules.count }.by(1)
@@ -113,7 +113,7 @@ describe Spree::Admin::ProductsController, type: :controller do
113
113
  }
114
114
  end
115
115
 
116
- subject { put :update, payload }
116
+ subject { put :update, params: payload }
117
117
 
118
118
  it "does not create any new rules" do
119
119
  expect { subject }.to_not change { Spree::VariantPropertyRule.count }
@@ -152,7 +152,7 @@ describe Spree::Admin::ProductsController, type: :controller do
152
152
  end
153
153
 
154
154
  it "deletes all the variants (including master) for the product" do
155
- delete :destroy, id: product
155
+ delete :destroy, params: { id: product }
156
156
  expect(product.reload.deleted_at).not_to be_nil
157
157
  product.variants_including_master.each do |variant|
158
158
  expect(variant.reload.deleted_at).not_to be_nil
@@ -6,14 +6,14 @@ describe Spree::Admin::PromotionActionsController, type: :controller do
6
6
  let!(:promotion) { create(:promotion) }
7
7
 
8
8
  it "can create a promotion action of a valid type" do
9
- post :create, promotion_id: promotion.id, action_type: "Spree::Promotion::Actions::CreateAdjustment"
9
+ post :create, params: { promotion_id: promotion.id, action_type: "Spree::Promotion::Actions::CreateAdjustment" }
10
10
  expect(response).to be_redirect
11
11
  expect(response).to redirect_to spree.edit_admin_promotion_path(promotion)
12
12
  expect(promotion.actions.count).to eq(1)
13
13
  end
14
14
 
15
15
  it "can not create a promotion action of an invalid type" do
16
- post :create, promotion_id: promotion.id, action_type: "Spree::InvalidType"
16
+ post :create, params: { promotion_id: promotion.id, action_type: "Spree::InvalidType" }
17
17
  expect(response).to be_redirect
18
18
  expect(response).to redirect_to spree.edit_admin_promotion_path(promotion)
19
19
  expect(promotion.rules.count).to eq(0)
@@ -10,7 +10,7 @@ describe Spree::Admin::PromotionCodesController do
10
10
  let!(:code3) { create(:promotion_code, promotion: promotion) }
11
11
 
12
12
  it "can create a promotion rule of a valid type" do
13
- get :index, promotion_id: promotion.id, format: 'csv'
13
+ get :index, params: { promotion_id: promotion.id, format: 'csv' }
14
14
  expect(response).to be_success
15
15
  parsed = CSV.parse(response.body, headers: true)
16
16
  expect(parsed.entries.map(&:to_h)).to eq([{ "Code" => code1.value }, { "Code" => code2.value }, { "Code" => code3.value }])
@@ -6,14 +6,14 @@ describe Spree::Admin::PromotionRulesController, type: :controller do
6
6
  let!(:promotion) { create(:promotion) }
7
7
 
8
8
  it "can create a promotion rule of a valid type" do
9
- post :create, promotion_id: promotion.id, promotion_rule: { type: "Spree::Promotion::Rules::Product" }
9
+ post :create, params: { promotion_id: promotion.id, promotion_rule: { type: "Spree::Promotion::Rules::Product" } }
10
10
  expect(response).to be_redirect
11
11
  expect(response).to redirect_to spree.edit_admin_promotion_path(promotion)
12
12
  expect(promotion.rules.count).to eq(1)
13
13
  end
14
14
 
15
15
  it "can not create a promotion rule of an invalid type" do
16
- post :create, promotion_id: promotion.id, promotion_rule: { type: "Spree::InvalidType" }
16
+ post :create, params: { promotion_id: promotion.id, promotion_rule: { type: "Spree::InvalidType" } }
17
17
  expect(response).to be_redirect
18
18
  expect(response).to redirect_to spree.edit_admin_promotion_path(promotion)
19
19
  expect(promotion.rules.count).to eq(0)
@@ -20,29 +20,29 @@ describe Spree::Admin::PromotionsController, type: :controller do
20
20
 
21
21
  context "search" do
22
22
  it "pages results" do
23
- get :index, per_page: '1'
23
+ get :index, params: { per_page: '1' }
24
24
  expect(assigns[:promotions]).to eq [promotion2]
25
25
  end
26
26
 
27
27
  it "filters by name" do
28
- get :index, q: { name_cont: promotion1.name }
28
+ get :index, params: { q: { name_cont: promotion1.name } }
29
29
  expect(assigns[:promotions]).to eq [promotion1]
30
30
  end
31
31
 
32
32
  it "filters by code" do
33
- get :index, q: { codes_value_cont: promotion1.codes.first.value }
33
+ get :index, params: { q: { codes_value_cont: promotion1.codes.first.value } }
34
34
  expect(assigns[:promotions]).to eq [promotion1]
35
35
  end
36
36
 
37
37
  it "filters by path" do
38
- get :index, q: { path_cont: promotion1.path }
38
+ get :index, params: { q: { path_cont: promotion1.path } }
39
39
  expect(assigns[:promotions]).to eq [promotion1]
40
40
  end
41
41
  end
42
42
  end
43
43
 
44
44
  describe "#create" do
45
- subject { post :create, params }
45
+ subject { post :create, params: params }
46
46
  let(:params) { { promotion: { name: 'some promo' } } }
47
47
 
48
48
  context "it succeeds" do
@@ -9,9 +9,11 @@ describe Spree::Admin::RefundsController do
9
9
 
10
10
  subject do
11
11
  post :create,
12
- refund: { amount: "50.0", refund_reason_id: "1" },
13
- order_id: payment.order_id,
14
- payment_id: payment.id
12
+ params: {
13
+ refund: { amount: "50.0", refund_reason_id: "1" },
14
+ order_id: payment.order_id,
15
+ payment_id: payment.id
16
+ }
15
17
  end
16
18
 
17
19
  before(:each) do
@@ -14,7 +14,7 @@ describe Spree::Admin::ReimbursementsController, type: :controller do
14
14
  let!(:inactive_stock_location) { create(:stock_location, active: false) }
15
15
 
16
16
  subject do
17
- get :edit, order_id: order.to_param, id: reimbursement.to_param
17
+ get :edit, params: { order_id: order.to_param, id: reimbursement.to_param }
18
18
  end
19
19
 
20
20
  it "loads all the active stock locations" do
@@ -32,7 +32,7 @@ describe Spree::Admin::ReimbursementsController, type: :controller do
32
32
  before { return_item.receive! }
33
33
 
34
34
  subject do
35
- post :create, order_id: order.to_param, build_from_customer_return_id: customer_return.id
35
+ post :create, params: { order_id: order.to_param, build_from_customer_return_id: customer_return.id }
36
36
  end
37
37
 
38
38
  it 'creates the reimbursement' do
@@ -59,7 +59,7 @@ describe Spree::Admin::ReimbursementsController, type: :controller do
59
59
  it 'redirects to the referer' do
60
60
  request.env["HTTP_REFERER"] = referer
61
61
  expect {
62
- post :create, order_id: order.to_param
62
+ post :create, params: { order_id: order.to_param }
63
63
  }.to_not change { Spree::Reimbursement.count }
64
64
  expect(response).to redirect_to(referer)
65
65
  expect(flash[:error]).to eq("something bad happened")
@@ -69,7 +69,7 @@ describe Spree::Admin::ReimbursementsController, type: :controller do
69
69
  context 'when a referer header is not present' do
70
70
  it 'redirects to the admin root' do
71
71
  expect {
72
- post :create, order_id: order.to_param
72
+ post :create, params: { order_id: order.to_param }
73
73
  }.to_not change { Spree::Reimbursement.count }
74
74
  expect(response).to redirect_to(spree.admin_path)
75
75
  expect(flash[:error]).to eq("something bad happened")
@@ -86,7 +86,7 @@ describe Spree::Admin::ReimbursementsController, type: :controller do
86
86
  let(:payment) { order.payments.first }
87
87
 
88
88
  subject do
89
- post :perform, order_id: order.to_param, id: reimbursement.to_param
89
+ post :perform, params: { order_id: order.to_param, id: reimbursement.to_param }
90
90
  end
91
91
 
92
92
  it 'redirects to customer return page' do
@@ -44,7 +44,7 @@ describe Spree::Admin::ReportsController, type: :controller do
44
44
  order_complete_mid_month.save!
45
45
  end
46
46
 
47
- subject { get :sales_total, params }
47
+ subject { get :sales_total, params: params }
48
48
 
49
49
  shared_examples 'sales total report' do
50
50
  it 'should respond with success' do
@@ -58,7 +58,7 @@ describe Spree::Admin::WidgetsController, type: :controller do
58
58
  let(:widget) { Widget.create!(name: 'a widget') }
59
59
 
60
60
  subject do
61
- get :edit, id: widget.to_param
61
+ get :edit, params: { id: widget.to_param }
62
62
  end
63
63
 
64
64
  it 'succeeds' do
@@ -72,7 +72,7 @@ describe Spree::Admin::WidgetsController, type: :controller do
72
72
  { widget: { name: 'a widget' } }
73
73
  end
74
74
 
75
- subject { post :create, params }
75
+ subject { post :create, params: params }
76
76
 
77
77
  it 'creates the resource' do
78
78
  expect { subject }.to change { Widget.count }.by(1)
@@ -112,7 +112,7 @@ describe Spree::Admin::WidgetsController, type: :controller do
112
112
  }
113
113
  end
114
114
 
115
- subject { put :update, params }
115
+ subject { put :update, params: params }
116
116
 
117
117
  it 'updates the resource' do
118
118
  expect { subject }.to change { widget.reload.name }.from('a widget').to('widget renamed')
@@ -138,7 +138,7 @@ describe Spree::Admin::WidgetsController, type: :controller do
138
138
  let(:params) { { id: widget.id } }
139
139
 
140
140
  subject {
141
- delete :destroy, params
141
+ delete :destroy, params: params
142
142
  }
143
143
 
144
144
  it 'destroys the resource' do
@@ -151,8 +151,8 @@ describe Spree::Admin::WidgetsController, type: :controller do
151
151
  let(:widget_2) { Widget.create!(name: 'widget 2', position: 2) }
152
152
 
153
153
  subject do
154
- post :update_positions, id: widget_1.to_param,
155
- positions: { widget_1.id => '2', widget_2.id => '1' }, format: 'js'
154
+ post :update_positions, params: { id: widget_1.to_param,
155
+ positions: { widget_1.id => '2', widget_2.id => '1' }, format: 'js' }
156
156
  end
157
157
 
158
158
  it 'updates the position of widget 1' do
@@ -19,7 +19,7 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
19
19
  let(:return_authorization) { return_item.return_authorization }
20
20
 
21
21
  it "loads all the active rma reasons" do
22
- get :edit, id: return_authorization.to_param, order_id: return_authorization.order.to_param
22
+ get :edit, params: { id: return_authorization.to_param, order_id: return_authorization.order.to_param }
23
23
  expect(assigns(:reasons)).to include(return_reason)
24
24
  expect(assigns(:reasons)).to include(inactive_rma_reason)
25
25
  expect(assigns(:reasons)).not_to include(other_inactive_rma_reason)
@@ -30,14 +30,14 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
30
30
  let(:return_authorization) { create(:return_authorization, reason: return_reason) }
31
31
 
32
32
  it "loads all the active rma reasons" do
33
- get :edit, id: return_authorization.to_param, order_id: return_authorization.order.to_param
33
+ get :edit, params: { id: return_authorization.to_param, order_id: return_authorization.order.to_param }
34
34
  expect(assigns(:reasons)).to eq [return_reason]
35
35
  end
36
36
  end
37
37
 
38
38
  context "return authorization doesn't have an associated reason" do
39
39
  it "loads all the active rma reasons" do
40
- get :new, order_id: order.to_param
40
+ get :new, params: { order_id: order.to_param }
41
41
  expect(assigns(:reasons)).to eq [return_reason]
42
42
  end
43
43
  end
@@ -68,14 +68,14 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
68
68
  end
69
69
 
70
70
  context '#new' do
71
- subject { get :new, order_id: order.to_param }
71
+ subject { get :new, params: { order_id: order.to_param } }
72
72
 
73
73
  include_context 'without existing return items'
74
74
  end
75
75
 
76
76
  context '#edit' do
77
77
  subject do
78
- get :edit, {
78
+ get :edit, params: {
79
79
  id: return_authorization.to_param,
80
80
  order_id: order.to_param
81
81
  }
@@ -89,7 +89,7 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
89
89
 
90
90
  context '#create failed' do
91
91
  subject do
92
- post :create, {
92
+ post :create, params: {
93
93
  return_authorization: { stock_location_id: nil }, # return authorization requires valid stock location, so this will fail
94
94
  order_id: order.to_param
95
95
  }
@@ -100,7 +100,7 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
100
100
 
101
101
  context '#update failed' do
102
102
  subject do
103
- put :update, {
103
+ put :update, params: {
104
104
  return_authorization: { stock_location_id: nil }, # return authorization requires valid stock location, so this will fail
105
105
  id: return_authorization.to_param,
106
106
  order_id: order.to_param
@@ -121,7 +121,7 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
121
121
  let!(:second_active_reimbursement_type) { create(:reimbursement_type) }
122
122
 
123
123
  before do
124
- get :new, order_id: order.to_param
124
+ get :new, params: { order_id: order.to_param }
125
125
  end
126
126
 
127
127
  it "loads all the active reimbursement types" do
@@ -136,7 +136,7 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
136
136
  let!(:inactive_stock_location) { create(:stock_location, active: false) }
137
137
 
138
138
  before do
139
- get :new, order_id: order.to_param
139
+ get :new, params: { order_id: order.to_param }
140
140
  end
141
141
 
142
142
  it "loads all the active stock locations" do
@@ -148,7 +148,7 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
148
148
  context '#create' do
149
149
  let(:stock_location) { create(:stock_location) }
150
150
 
151
- subject { post :create, params }
151
+ subject { post :create, params: params }
152
152
 
153
153
  let(:params) do
154
154
  {
@@ -188,7 +188,7 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
188
188
  }
189
189
  end
190
190
 
191
- subject { put :update, params }
191
+ subject { put :update, params: params }
192
192
 
193
193
  context "adding an item" do
194
194
  let(:return_items_params) do
@@ -10,7 +10,7 @@ describe Spree::Admin::ReturnItemsController, type: :controller do
10
10
  let(:new_acceptance_status) { 'rejected' }
11
11
 
12
12
  subject do
13
- put :update, id: return_item.to_param, return_item: { acceptance_status: new_acceptance_status }
13
+ put :update, params: { id: return_item.to_param, return_item: { acceptance_status: new_acceptance_status } }
14
14
  end
15
15
 
16
16
  it 'updates the return item' do
@@ -13,7 +13,7 @@ describe Spree::Admin::SearchController, type: :controller do
13
13
  end
14
14
 
15
15
  describe 'GET #users' do
16
- subject { get :users, { format: :json }.merge(params) }
16
+ subject { get :users, params: { format: :json }.merge(params) }
17
17
 
18
18
  shared_examples_for 'user found by search' do
19
19
  it "should include users matching query" do
@@ -66,7 +66,7 @@ describe Spree::Admin::SearchController, type: :controller do
66
66
  let!(:product_one) { create(:product, name: 'jersey') }
67
67
  let!(:product_two) { create(:product, name: 'better jersey') }
68
68
 
69
- subject { get :products, params }
69
+ subject { get :products, params: params }
70
70
 
71
71
  shared_examples_for 'product search' do
72
72
  it 'should respond with http success' do