Use expect_next_instance_of to replace expect_any_instance_of

This commit is contained in:
Lin Jen-Shin 2018-06-21 22:54:11 +08:00
parent e446e8712c
commit 5de2035c47
1 changed files with 6 additions and 2 deletions

View File

@ -19,7 +19,9 @@ describe Users::DestroyService do
end
it 'will delete the project' do
expect_any_instance_of(Projects::DestroyService).to receive(:execute).once
expect_next_instance_of(Projects::DestroyService) do |destroy_service|
expect(destroy_service).to receive(:execute).once
end
service.execute(user)
end
@ -32,7 +34,9 @@ describe Users::DestroyService do
end
it 'destroys a project in pending_delete' do
expect_any_instance_of(Projects::DestroyService).to receive(:execute).once
expect_next_instance_of(Projects::DestroyService) do |destroy_service|
expect(destroy_service).to receive(:execute).once
end
service.execute(user)