Refactor spec using expect_any_instance

This commit is contained in:
Pau Perez
2017-08-14 16:35:40 +02:00
committed by Rob Harrington
parent 1899e2fa98
commit 613016a6cf

View File

@@ -177,8 +177,11 @@ describe Admin::BulkLineItemsController do
end
it 'applies enterprise fees locking the order with an exclusive row lock' do
expect_any_instance_of(Spree::Order).to receive(:reload).with(lock: true)
expect_any_instance_of(Spree::Order).to receive(:update_distribution_charge!)
allow(Spree::LineItem)
.to receive(:find).with(line_item1.id.to_s).and_return(line_item1)
expect(line_item1.order).to receive(:reload).with(lock: true)
expect(line_item1.order).to receive(:update_distribution_charge!)
spree_put :update, params
end