How can I write this so it passes without hardcoding 1
. Chicken and the egg.
@sender = Factory(:user)
@receiver = Factory(:user)
mailer = double
mailer.should_receive(:deliver)
Mailer.should_receive(:email).with(1, @sender.id, @receiver.id).and_return(mailer)
# This will create an object with id #1 to make this test pass
@object = Object.create(:sender => @sender, :receiver => @receiver)