Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spree 2.1] Fix shipments admin/enterprises and api/enterprises controller specs #4919

Merged
merged 2 commits into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spec/controllers/admin/enterprises_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,8 @@ module Admin
before do
# As a user with permission
allow(controller).to receive_messages spree_current_user: user
allow(OrderCycle).to receive_messages find_by_id: "existing OrderCycle"
allow(Enterprise).to receive_messages find_by_id: "existing Enterprise"
allow(OrderCycle).to receive_messages find_by: "existing OrderCycle"
allow(Enterprise).to receive_messages find_by: "existing Enterprise"
allow(OrderCycle).to receive_messages new: "new OrderCycle"

allow(OpenFoodNetwork::OrderCyclePermissions).to receive(:new) { permission_mock }
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/api/enterprises_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module Api
describe "submitting a valid image" do
before do
allow(Enterprise)
.to receive(:find_by_permalink).with(enterprise.id.to_s) { enterprise }
.to receive(:find_by).with({ permalink: enterprise.id.to_s }) { enterprise }
allow(enterprise).to receive(:update_attributes).and_return(true)
end

Expand All @@ -68,7 +68,7 @@ module Api

before do
allow(Enterprise)
.to receive(:find_by_permalink).with(enterprise.id.to_s) { enterprise }
.to receive(:find_by).with({ permalink: enterprise.id.to_s }) { enterprise }
allow(controller).to receive(:spree_current_user) { non_managing_user }
end

Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/api/shipments_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def expect_valid_response
end

def make_order_contents_fail
expect(Spree::Order).to receive(:find_by_number!) { order }
expect(Spree::Order).to receive(:find_by!).with({ number: order.number }) { order }
expect(order).to receive(:contents) { raise error_message }
end

Expand Down