How to evaluate with arguments only after expect block was evaluated?
let(:job) { create(:job) }
it do
expect { job }
.to have_enqueued_mail(NotificationMailer, :note)
.with(
user: job.user
)
end
In other case job is going to be created outside of the expect block, and notification sends on: create so expectation is not going to be happen in the expect block.