Prefer `expect_next_instance_of` over `expect_any_instance_of`
This commit is contained in:
parent
901159bbae
commit
f012b32bd1
|
@ -5,15 +5,17 @@ describe DeleteUserWorker do
|
|||
let!(:current_user) { create(:user) }
|
||||
|
||||
it "calls the DeleteUserWorker with the params it was given" do
|
||||
expect_any_instance_of(Users::DestroyService).to receive(:execute)
|
||||
.with(user, {})
|
||||
expect_next_instance_of(Users::DestroyService) do |service|
|
||||
expect(service).to receive(:execute).with(user, {})
|
||||
end
|
||||
|
||||
described_class.new.perform(current_user.id, user.id)
|
||||
end
|
||||
|
||||
it "uses symbolized keys" do
|
||||
expect_any_instance_of(Users::DestroyService).to receive(:execute)
|
||||
.with(user, test: "test")
|
||||
expect_next_instance_of(Users::DestroyService) do |service|
|
||||
expect(service).to receive(:execute).with(user, test: "test")
|
||||
end
|
||||
|
||||
described_class.new.perform(current_user.id, user.id, "test" => "test")
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue