Skip to content

Instantly share code, notes, and snippets.

@mgiagante
Last active January 21, 2018 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgiagante/91d00c980f297b3a83b121a956740e52 to your computer and use it in GitHub Desktop.
Save mgiagante/91d00c980f297b3a83b121a956740e52 to your computer and use it in GitHub Desktop.
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