Commit f012b32b authored by Lin Jen-Shin's avatar Lin Jen-Shin

Prefer `expect_next_instance_of` over `expect_any_instance_of`

parent 901159bb
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment