邮件器规格
一个简单的通过示例
给定一个名为“spec/mailers/notificationsmailerspec.rb”的文件,其中包含
require "rails_helper"
RSpec.describe NotificationsMailer, type: :mailer do
describe "notify" do
let(:mail) { NotificationsMailer.signup }
it "renders the headers" do
expect(mail.subject).to eq("Signup")
expect(mail.to).to eq(["to@example.org"])
expect(mail.from).to eq(["from@example.com"])
end
it "renders the body" do
expect(mail.body.encoded).to match("Hi")
end
end
end
当我运行 rspec spec
那么该示例应该通过。