TEST SPY
A more capable Test Stub allowing verification of indirect output
from the SUT
let(:spy_queue) { double(push: true) }
let(:email) { “
[email protected]” }
!
before do
Application.config.email_queue = spy_queue
end
!
subject { User.create(email: email) }
!
it { should be_persisted }
its(:username) { should eq email }
it “should enqueue welcome message” do
expect(spy_queue).to have_received(:push).with(email, “Ohai”)
end