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 ...@@ -5,15 +5,17 @@ describe DeleteUserWorker do
let!(:current_user) { create(:user) } let!(:current_user) { create(:user) }
it "calls the DeleteUserWorker with the params it was given" do it "calls the DeleteUserWorker with the params it was given" do
expect_any_instance_of(Users::DestroyService).to receive(:execute) expect_next_instance_of(Users::DestroyService) do |service|
.with(user, {}) expect(service).to receive(:execute).with(user, {})
end
described_class.new.perform(current_user.id, user.id) described_class.new.perform(current_user.id, user.id)
end end
it "uses symbolized keys" do it "uses symbolized keys" do
expect_any_instance_of(Users::DestroyService).to receive(:execute) expect_next_instance_of(Users::DestroyService) do |service|
.with(user, test: "test") expect(service).to receive(:execute).with(user, test: "test")
end
described_class.new.perform(current_user.id, user.id, "test" => "test") described_class.new.perform(current_user.id, user.id, "test" => "test")
end 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