Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
end
config.around(:each) do |example|
DatabaseCleaner.cleaning do
example.run
end
end
end
require "rails_helper"
RSpec.describe ReportMailer, type: :mailer do
describe "send_daily_report_to" do
before :all do
@subscriber = build(:subscriber)
@mail = ReportMailer.send_daily_report_to @subscriber
@leads = create_list(:lead, 3)
end
context "there are 3 leads in the system" do
it "renders the headers" do
expect(mail.subject).to eq(I18n.t('daily_report_subject'))
expect(mail.to).to eq([@subscriber.email])
expect(mail.from).to eq(["notifications@example.com"])
end
it "renders the body with 3 leads" do
byebug
expect(mail.body.encoded).to match("Hi")
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.