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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba03f47f17381bdf7f3caad7115bf42b8b027776
4
- data.tar.gz: 4a7cf28a01a6b334f268493e69b234d9c87c3da0
3
+ metadata.gz: 9267470530814d50f5b8a16a500e8cb925befd1b
4
+ data.tar.gz: 83c79928b8494a499d2b5751c2097c5068fbee2e
5
5
  SHA512:
6
- metadata.gz: c42a8ac94bd7bda855ea7a89d1e7249619a1162d47c19bfa65592504110a2931a68f40106dfff95f8bd54a24bba06893c84c0440e3ff7125e71d9a26bac3e239
7
- data.tar.gz: bcf874217d87f548adfaaf258ac778020832a9198b54156dab10066b721d07dbe91d5376324828f27538b3568e4c1fd0073a623f14cf99fa2656c209122a2db9
6
+ metadata.gz: ebd846a8b936f132716c78c353dd563fab27f70947cd806508c0b916c0c0e2b416f7ac31ecdc6050dc1f865812da650a0fedd428dfd433ca4f941201716edb47
7
+ data.tar.gz: 928184257e46c7aa8fb57ff3af8f831146b0c079a07c084a6542c85a4c4f4a49161219c9652f8e44dca7b784ecc1dad769671b83b392e5e1ea6717bfa2a88fb5
@@ -10,7 +10,7 @@ module Spree
10
10
 
11
11
  respond_to do |format|
12
12
  format.html { redirect_to admin_product_variants_url(params[:product_id]) }
13
- format.js { render text: 'Ok' }
13
+ format.js { render plain: 'Ok' }
14
14
  end
15
15
  end
16
16
 
@@ -4,7 +4,7 @@ module Spree
4
4
  def destroy
5
5
  option_value = Spree::OptionValue.find(params[:id])
6
6
  option_value.destroy
7
- render text: nil
7
+ render plain: nil
8
8
  end
9
9
  end
10
10
  end
@@ -127,26 +127,26 @@ module Spree
127
127
  def cancel
128
128
  @order.canceled_by(try_spree_current_user)
129
129
  flash[:success] = Spree.t(:order_canceled)
130
- redirect_to :back
130
+ redirect_to(spree.edit_admin_order_path(@order))
131
131
  end
132
132
 
133
133
  def resume
134
134
  @order.resume!
135
135
  flash[:success] = Spree.t(:order_resumed)
136
- redirect_to :back
136
+ redirect_to(spree.edit_admin_order_path(@order))
137
137
  end
138
138
 
139
139
  def approve
140
140
  @order.contents.approve(user: try_spree_current_user)
141
141
  flash[:success] = Spree.t(:order_approved)
142
- redirect_to :back
142
+ redirect_to(spree.edit_admin_order_path(@order))
143
143
  end
144
144
 
145
145
  def resend
146
146
  OrderMailer.confirm_email(@order.id, true).deliver_later
147
147
  flash[:success] = Spree.t(:order_email_resent)
148
148
 
149
- redirect_to :back
149
+ redirect_to(spree.edit_admin_order_path(@order))
150
150
  end
151
151
 
152
152
  def unfinalize_adjustments
@@ -154,7 +154,7 @@ module Spree
154
154
  adjustments.each(&:unfinalize!)
155
155
  flash[:success] = Spree.t(:all_adjustments_unfinalized)
156
156
 
157
- respond_with(@order) { |format| format.html { redirect_to :back } }
157
+ respond_with(@order) { |format| format.html { redirect_to(spree.admin_order_adjustments_path(@order)) } }
158
158
  end
159
159
 
160
160
  def finalize_adjustments
@@ -162,7 +162,7 @@ module Spree
162
162
  adjustments.each(&:finalize!)
163
163
  flash[:success] = Spree.t(:all_adjustments_finalized)
164
164
 
165
- respond_with(@order) { |format| format.html { redirect_to :back } }
165
+ respond_with(@order) { |format| format.html { redirect_to(spree.admin_order_adjustments_path(@order)) } }
166
166
  end
167
167
 
168
168
  private
@@ -79,7 +79,7 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
79
79
  end
80
80
 
81
81
  respond_to do |format|
82
- format.js { render text: 'Ok' }
82
+ format.js { render plain: 'Ok' }
83
83
  end
84
84
  end
85
85
 
@@ -10,7 +10,7 @@ module Spree
10
10
  def fire
11
11
  @return_authorization.send("#{params[:e]}!")
12
12
  flash[:success] = Spree.t(:return_authorization_updated)
13
- redirect_to :back
13
+ redirect_back(fallback_location: admin_order_return_authorization(@order))
14
14
  end
15
15
 
16
16
  private
@@ -8,7 +8,8 @@ module Spree
8
8
  end
9
9
 
10
10
  def render_after_update_error
11
- redirect_to :back, flash: { error: @object.errors.full_messages.join(', ') }
11
+ redirect_back(fallback_location: location_after_save,
12
+ flash: { error: @object.errors.full_messages.join(', ') })
12
13
  end
13
14
  end
14
15
  end
@@ -90,7 +90,8 @@ module Spree
90
90
  if action == :create
91
91
  edit_admin_stock_transfer_path(@stock_transfer)
92
92
  else
93
- :back
93
+ # redirect back, or to fallback if referer not provided
94
+ request.headers["Referer"] || admin_stock_transfers_path
94
95
  end
95
96
  end
96
97
 
@@ -1,6 +1,6 @@
1
1
  <%= render :partial => 'spree/admin/shared/order_tabs', :locals => { :current => 'Customer Returns' } %>
2
2
 
3
- <% admin_breadcrumb("#{Spree.t(:editing_reimbursement)} #{@reimbursement.number}") %>
3
+ <% admin_breadcrumb("#{Spree.t(:editing_reimbursement} #{@reimbursement.number}") %>
4
4
 
5
5
 
6
6
  <% content_for :page_actions do %>
@@ -7,7 +7,7 @@ describe Spree::Admin::BaseController, type: :controller do
7
7
  controller(Spree::Admin::BaseController) do
8
8
  def index
9
9
  authorize! :update, Spree::Order
10
- render text: 'test'
10
+ render plain: 'test'
11
11
  end
12
12
  end
13
13
 
@@ -4,7 +4,7 @@ describe Spree::Admin::CancellationsController do
4
4
  stub_authorization!
5
5
 
6
6
  describe "#index" do
7
- subject { get :index, order_id: order.number }
7
+ subject { get :index, params: { order_id: order.number } }
8
8
 
9
9
  let(:order) { create(:order_ready_to_ship, line_items_count: 1) }
10
10
 
@@ -18,13 +18,13 @@ describe Spree::Admin::CancellationsController do
18
18
  end
19
19
 
20
20
  describe "#cancel" do
21
- subject { post :short_ship, order_id: order.number, inventory_unit_ids: inventory_units.map(&:id) }
21
+ subject { post :short_ship, params: { order_id: order.number, inventory_unit_ids: inventory_units.map(&:id) } }
22
22
 
23
23
  let(:order) { create(:order_ready_to_ship, number: "R100", state: "complete", line_items_count: 1) }
24
24
  let(:referer) { "order_admin_page" }
25
25
 
26
26
  context "no inventory unit ids are provided" do
27
- subject { post :short_ship, order_id: order.number }
27
+ subject { post :short_ship, params: { order_id: order.number } }
28
28
 
29
29
  it "redirects back" do
30
30
  subject
@@ -10,7 +10,7 @@ module Spree
10
10
  let(:customer_return) { create(:customer_return) }
11
11
 
12
12
  subject do
13
- get :index, { order_id: customer_return.order.to_param }
13
+ get :index, params: { order_id: customer_return.order.to_param }
14
14
  end
15
15
 
16
16
  before { subject }
@@ -31,7 +31,7 @@ module Spree
31
31
  let!(:second_active_reimbursement_type) { create(:reimbursement_type) }
32
32
 
33
33
  subject do
34
- get :new, { order_id: order.to_param }
34
+ get :new, params: { order_id: order.to_param }
35
35
  end
36
36
 
37
37
  it "loads the order" do
@@ -126,7 +126,7 @@ module Spree
126
126
  let!(:manual_intervention_return_item) { customer_return.return_items.order('id').third.tap(&:require_manual_intervention!) }
127
127
 
128
128
  subject do
129
- get :edit, { order_id: order.to_param, id: customer_return.to_param }
129
+ get :edit, params: { order_id: order.to_param, id: customer_return.to_param }
130
130
  end
131
131
 
132
132
  it "loads the order" do
@@ -202,7 +202,7 @@ module Spree
202
202
  }
203
203
  end
204
204
 
205
- subject { post :create, customer_return_params }
205
+ subject { post :create, params: customer_return_params }
206
206
 
207
207
  it { expect { subject }.to change { Spree::CustomerReturn.count }.by(1) }
208
208
  it do
@@ -9,7 +9,7 @@ describe Spree::Admin::ProductsController, type: :controller do
9
9
 
10
10
  # Regression test for GH https://github.com/spree/spree/issues/538
11
11
  it "cannot find a non-existent product" do
12
- get :edit, id: "non-existent-product"
12
+ get :edit, params: { id: "non-existent-product" }
13
13
  expect(response).to redirect_to(spree.admin_products_path)
14
14
  expect(flash[:error]).to eql("Product is not found")
15
15
  end
@@ -15,13 +15,13 @@ describe Spree::Admin::Orders::CustomerDetailsController, type: :controller do
15
15
  expect(order).to receive(:update_attributes) { true }
16
16
  expect(order).to receive(:next) { false }
17
17
  attributes = { order_id: order.number, order: { email: "" } }
18
- put :update, attributes
18
+ put :update, params: attributes
19
19
  end
20
20
 
21
21
  it "does refresh the shipment rates with all shipping methods" do
22
22
  expect(order).to receive(:refresh_shipment_rates)
23
23
  attributes = { order_id: order.number, order: { email: "" } }
24
- put :update, attributes
24
+ put :update, params: attributes
25
25
  end
26
26
 
27
27
  # Regression spec
@@ -37,7 +37,7 @@ describe Spree::Admin::Orders::CustomerDetailsController, type: :controller do
37
37
  end
38
38
 
39
39
  it 'allows the updating of an email address' do
40
- expect { put :update, attributes }.to change { order.reload.email }.to eq 'foo@bar.com'
40
+ expect { put :update, params: attributes }.to change { order.reload.email }.to eq 'foo@bar.com'
41
41
  expect(response).to be_redirect
42
42
  end
43
43
  end
@@ -53,7 +53,7 @@ describe Spree::Admin::Orders::CustomerDetailsController, type: :controller do
53
53
  }
54
54
 
55
55
  expect {
56
- put :update, attributes
56
+ put :update, params: attributes
57
57
  }.to change{ order.reload.user }.to(assigned_user)
58
58
  end
59
59
  end
@@ -70,7 +70,7 @@ describe Spree::Admin::Orders::CustomerDetailsController, type: :controller do
70
70
  }
71
71
 
72
72
  expect {
73
- put :update, attributes
73
+ put :update, params: attributes
74
74
  }.not_to change{ order.reload.user }
75
75
  end
76
76
  end
@@ -37,7 +37,7 @@ describe Spree::Admin::OrdersController, type: :controller do
37
37
  context "#approve" do
38
38
  it "approves an order" do
39
39
  expect(order.contents).to receive(:approve).with(user: controller.try_spree_current_user)
40
- put :approve, id: order.number
40
+ put :approve, params: { id: order.number }
41
41
  expect(flash[:success]).to eq Spree.t(:order_approved)
42
42
  end
43
43
  end
@@ -45,7 +45,7 @@ describe Spree::Admin::OrdersController, type: :controller do
45
45
  context "#cancel" do
46
46
  it "cancels an order" do
47
47
  expect(order).to receive(:canceled_by).with(controller.try_spree_current_user)
48
- put :cancel, id: order.number
48
+ put :cancel, params: { id: order.number }
49
49
  expect(flash[:success]).to eq Spree.t(:order_canceled)
50
50
  end
51
51
  end
@@ -53,14 +53,14 @@ describe Spree::Admin::OrdersController, type: :controller do
53
53
  context "#resume" do
54
54
  it "resumes an order" do
55
55
  expect(order).to receive(:resume!)
56
- put :resume, id: order.number
56
+ put :resume, params: { id: order.number }
57
57
  expect(flash[:success]).to eq Spree.t(:order_resumed)
58
58
  end
59
59
  end
60
60
 
61
61
  context "pagination" do
62
62
  it "can page through the orders" do
63
- get :index, page: 2, per_page: 10
63
+ get :index, params: { page: 2, per_page: 10 }
64
64
  expect(assigns[:orders].offset_value).to eq(10)
65
65
  expect(assigns[:orders].limit_value).to eq(10)
66
66
  end
@@ -91,7 +91,7 @@ describe Spree::Admin::OrdersController, type: :controller do
91
91
  expect(Spree::Core::Importer::Order).to receive(:import)
92
92
  .with(user, hash_including(store_id: controller.current_store.id))
93
93
  .and_return(order)
94
- get :new, { user_id: user.id }
94
+ get :new, params: { user_id: user.id }
95
95
  end
96
96
 
97
97
  context "when a user_id is passed as a parameter" do
@@ -102,7 +102,7 @@ describe Spree::Admin::OrdersController, type: :controller do
102
102
  expect(Spree::Core::Importer::Order).to receive(:import)
103
103
  .with(user, hash_including(created_by_id: controller.try_spree_current_user.id))
104
104
  .and_return(order)
105
- get :new, { user_id: user.id }
105
+ get :new, params: { user_id: user.id }
106
106
  end
107
107
  end
108
108
 
@@ -117,13 +117,13 @@ describe Spree::Admin::OrdersController, type: :controller do
117
117
  it "does not refresh rates if the order is completed" do
118
118
  allow(order).to receive_messages completed?: true
119
119
  expect(order).not_to receive :refresh_shipment_rates
120
- get :edit, id: order.number
120
+ get :edit, params: { id: order.number }
121
121
  end
122
122
 
123
123
  it "does refresh the rates if the order is incomplete" do
124
124
  allow(order).to receive_messages completed?: false
125
125
  expect(order).to receive :refresh_shipment_rates
126
- get :edit, id: order.number
126
+ get :edit, params: { id: order.number }
127
127
  end
128
128
 
129
129
  context "when order does not have a ship address" do
@@ -135,7 +135,7 @@ describe Spree::Admin::OrdersController, type: :controller do
135
135
  before { Spree::Config[:order_bill_address_used] = true }
136
136
 
137
137
  it "should redirect to the customer details page" do
138
- get :edit, id: order.number
138
+ get :edit, params: { id: order.number }
139
139
  expect(response).to redirect_to(spree.edit_admin_order_customer_path(order))
140
140
  end
141
141
  end
@@ -144,7 +144,7 @@ describe Spree::Admin::OrdersController, type: :controller do
144
144
  before { Spree::Config[:order_bill_address_used] = false }
145
145
 
146
146
  it "should redirect to the customer details page" do
147
- get :edit, id: order.number
147
+ get :edit, params: { id: order.number }
148
148
  expect(response).to redirect_to(spree.edit_admin_order_customer_path(order))
149
149
  end
150
150
  end
@@ -153,7 +153,7 @@ describe Spree::Admin::OrdersController, type: :controller do
153
153
 
154
154
  describe '#advance' do
155
155
  subject do
156
- put :advance, id: order.number
156
+ put :advance, params: { id: order.number }
157
157
  end
158
158
 
159
159
  context 'when incomplete' do
@@ -199,7 +199,7 @@ describe Spree::Admin::OrdersController, type: :controller do
199
199
 
200
200
  context '#confirm' do
201
201
  subject do
202
- get :confirm, id: order.number
202
+ get :confirm, params: { id: order.number }
203
203
  end
204
204
 
205
205
  context 'when in confirm' do
@@ -234,7 +234,7 @@ describe Spree::Admin::OrdersController, type: :controller do
234
234
 
235
235
  context "#complete" do
236
236
  subject do
237
- put :complete, id: order.number
237
+ put :complete, params: { id: order.number }
238
238
  end
239
239
 
240
240
  context 'when successful' do
@@ -288,9 +288,9 @@ describe Spree::Admin::OrdersController, type: :controller do
288
288
  end
289
289
 
290
290
  it "does not display duplicated results" do
291
- get :index, q: {
291
+ get :index, params: { q: {
292
292
  line_items_variant_id_in: Spree::Order.first.variants.map(&:id)
293
- }
293
+ } }
294
294
  expect(assigns[:orders].map(&:number).count).to eq 1
295
295
  end
296
296
  end
@@ -300,18 +300,18 @@ describe Spree::Admin::OrdersController, type: :controller do
300
300
  let!(:finalized_adjustment) { create(:adjustment, finalized: true, adjustable: order, order: order) }
301
301
 
302
302
  it "changes all the finalized adjustments to unfinalized" do
303
- post :unfinalize_adjustments, id: order.number
303
+ post :unfinalize_adjustments, params: { id: order.number }
304
304
  expect(finalized_adjustment.reload.finalized).to eq(false)
305
305
  end
306
306
 
307
307
  it "sets the flash success message" do
308
- post :unfinalize_adjustments, id: order.number
308
+ post :unfinalize_adjustments, params: { id: order.number }
309
309
  expect(flash[:success]).to eql('All adjustments successfully unfinalized!')
310
310
  end
311
311
 
312
312
  it "redirects back" do
313
- post :unfinalize_adjustments, id: order.number
314
- expect(response).to redirect_to(:back)
313
+ post :unfinalize_adjustments, params: { id: order.number }
314
+ expect(response).to redirect_to(spree.admin_order_adjustments_path(order))
315
315
  end
316
316
  end
317
317
 
@@ -320,18 +320,18 @@ describe Spree::Admin::OrdersController, type: :controller do
320
320
  let!(:not_finalized_adjustment) { create(:adjustment, finalized: false, adjustable: order, order: order) }
321
321
 
322
322
  it "changes all the unfinalized adjustments to finalized" do
323
- post :finalize_adjustments, id: order.number
323
+ post :finalize_adjustments, params: { id: order.number }
324
324
  expect(not_finalized_adjustment.reload.finalized).to eq(true)
325
325
  end
326
326
 
327
327
  it "sets the flash success message" do
328
- post :finalize_adjustments, id: order.number
328
+ post :finalize_adjustments, params: { id: order.number }
329
329
  expect(flash[:success]).to eql('All adjustments successfully finalized!')
330
330
  end
331
331
 
332
332
  it "redirects back" do
333
- post :finalize_adjustments, id: order.number
334
- expect(response).to redirect_to(:back)
333
+ post :finalize_adjustments, params: { id: order.number }
334
+ expect(response).to redirect_to(spree.admin_order_adjustments_path(order))
335
335
  end
336
336
  end
337
337
  end
@@ -389,7 +389,7 @@ describe Spree::Admin::OrdersController, type: :controller do
389
389
 
390
390
  it "raise active record not found" do
391
391
  expect {
392
- get :edit, id: 0
392
+ get :edit, params: { id: 0 }
393
393
  }.to raise_error ActiveRecord::RecordNotFound
394
394
  end
395
395
  end
@@ -18,7 +18,7 @@ module Spree
18
18
  # regression test for https://github.com/spree/spree/issues/2094
19
19
  it "does not clear password on update" do
20
20
  expect(payment_method.preferred_password).to eq("haxme")
21
- put :update, id: payment_method.id, payment_method: { type: payment_method.class.to_s, preferred_password: "" }
21
+ put :update, params: { id: payment_method.id, payment_method: { type: payment_method.class.to_s, preferred_password: "" } }
22
22
  expect(response).to redirect_to(spree.edit_admin_payment_method_path(payment_method))
23
23
 
24
24
  payment_method.reload
@@ -28,13 +28,13 @@ module Spree
28
28
 
29
29
  context "tries to save invalid payment" do
30
30
  it "doesn't break, responds nicely" do
31
- post :create, payment_method: { name: "", type: "Spree::Gateway::Bogus" }
31
+ post :create, params: { payment_method: { name: "", type: "Spree::Gateway::Bogus" } }
32
32
  end
33
33
  end
34
34
 
35
35
  it "can create a payment method of a valid type" do
36
36
  expect {
37
- post :create, payment_method: { name: "Test Method", type: "Spree::Gateway::Bogus" }
37
+ post :create, params: { payment_method: { name: "Test Method", type: "Spree::Gateway::Bogus" } }
38
38
  }.to change(Spree::PaymentMethod, :count).by(1)
39
39
 
40
40
  expect(response).to be_redirect
@@ -43,7 +43,7 @@ module Spree
43
43
 
44
44
  it "can not create a payment method of an invalid type" do
45
45
  expect {
46
- post :create, payment_method: { name: "Invalid Payment Method", type: "Spree::InvalidType" }
46
+ post :create, params: { payment_method: { name: "Invalid Payment Method", type: "Spree::InvalidType" } }
47
47
  }.to change(Spree::PaymentMethod, :count).by(0)
48
48
 
49
49
  expect(response).to be_redirect