Last active
January 21, 2018 01:52
-
-
Save mgiagante/91d00c980f297b3a83b121a956740e52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(["[email protected]"]) | |
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