Skip to content

Commit

Permalink
Remove double authorization
Browse files Browse the repository at this point in the history
Authorization already happen on the first line after the method definition
  • Loading branch information
SamuelMartini committed Mar 12, 2020
1 parent 1d351af commit 54e88e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 0 additions & 1 deletion api/app/controllers/spree/api/checkouts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def next
respond_with(@order, default_template: 'spree/api/orders/expected_total_mismatch', status: 400)
return
end
authorize! :update, @order, order_token
@order.next!
respond_with(@order, default_template: 'spree/api/orders/show', status: 200)
end
Expand Down
2 changes: 2 additions & 0 deletions api/spec/requests/spree/api/checkouts_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ module Spree
it "cannot transition to address without a line item" do
order.line_items.delete_all
order.update_column(:email, "[email protected]")
expect(Spree::Deprecation).to receive(:warn).with(template_deprecation_error)
put spree.next_api_checkout_path(order), params: { order_token: order.guest_token }
expect(response.status).to eq(422)
expect(json_response["errors"]["base"]).to include(I18n.t('spree.there_are_no_items_for_this_order'))
Expand Down Expand Up @@ -428,6 +429,7 @@ module Spree

it "returns a sensible error when no payment method is specified" do
# put :complete, id: order.to_param, order_token: order.token, order: {}
expect(Spree::Deprecation).to receive(:warn).with(template_deprecation_error)
subject
expect(json_response["errors"]["base"]).to include(I18n.t('spree.no_payment_found'))
end
Expand Down

0 comments on commit 54e88e7

Please sign in to comment.