From 5a2d09fae85c2aa41d8350fbfc015cd55c655f52 Mon Sep 17 00:00:00 2001 From: Pablo Brasero Date: Thu, 17 Jun 2021 17:18:41 +0100 Subject: [PATCH] Temporary hack until #2001 is merged --- spec/controllers/admin/orders_controller_spec.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/spec/controllers/admin/orders_controller_spec.rb b/spec/controllers/admin/orders_controller_spec.rb index 6bbe2f9588..c68403ca94 100644 --- a/spec/controllers/admin/orders_controller_spec.rb +++ b/spec/controllers/admin/orders_controller_spec.rb @@ -36,13 +36,13 @@ def pundit_user describe "GET edit" do it "allows me to edit my records" do order = create :order, customer: user - expect { get :edit, params: { id: order.id } }.not_to raise_error + expect { get :edit, id: order.id }.not_to raise_error end it "does not allow me to see other users' records" do other_user = create(:customer) order = create(:order, customer: other_user) - expect { get :show, params: { id: order.id } }. + expect { get :show, id: order.id }. to raise_error(ActiveRecord::RecordNotFound) end end @@ -51,10 +51,8 @@ def pundit_user def send_request(order:) put( :update, - params: { - id: order.id, - order: { address_line_one: "22 Acacia Avenue" }, - }, + id: order.id, + order: { address_line_one: "22 Acacia Avenue" }, ) end @@ -77,7 +75,7 @@ def send_request(order:) describe "DELETE destroy" do it "never allows me to delete a record" do o = create :order, customer: user, address_state: "AZ" - expect { delete :destroy, params: { id: o.id } }. + expect { delete :destroy, id: o.id }. to raise_error(Pundit::NotAuthorizedError) end end