I want to test my Mailer model.
Letters should be sent to multiple recipients.
How to test that messages sent to multiple recipients?
I created spec file:
describe SubscribeMailer do
before(:each) do
(1..3).to_a.each do
FactoryGirl.create(:subscriber)
end
end
let(:post) { @user.posts.create(@attr)}
let(:mail) { SubscribeMailer.new_post(post) }
#Failure/Error for this test
it 'subscribers' do
mail.to.should == Subscriber.all.map(&:email)
end
end
But I don’t know how to write the test.
In test environment, ActionMailer.deliveries is an array of mail objects that would otherwise have been sent.