Skip to content

Commit

Permalink
Temporary hack until thoughtbot#2001 is merged
Browse files Browse the repository at this point in the history
  • Loading branch information
pablobm committed Jun 17, 2021
1 parent 6ebced6 commit 5a2d09f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions spec/controllers/admin/orders_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 5a2d09f

Please sign in to comment.