Files
nairobi/spec/mailers/mailer_spec.rb
Javi Martín ffc50246c2 Apply explict RSpec/DescribedClass rubocop rule
We settled on using this style in commit 4cbe81a1, but didn't add the
rule enforcing this style and we didn't apply it to existing code.
2019-09-23 16:51:00 +02:00

27 lines
699 B
Ruby

require "rails_helper"
describe Mailer do
describe "#comment" do
it "sends emails in the user's locale" do
user = create(:user, locale: "es")
proposal = create(:proposal, author: user)
comment = create(:comment, commentable: proposal)
email = I18n.with_locale :en do
Mailer.comment(comment)
end
expect(email.subject).to include("comentado")
end
it "reads the from address at runtime" do
Setting["mailer_from_name"] = "New organization"
Setting["mailer_from_address"] = "new@consul.dev"
email = Mailer.comment(create(:comment))
expect(email).to deliver_from "New organization <new@consul.dev>"
end
end
end