4
我正在写一些RSpec的测试,我发现它访问我的梅勒类时减慢。有没有一种方法可以完全模拟ActionMailer :: Base类,以便在电子邮件传递之前和之后测试控制器的其他组件?RSpec的嘲讽出来的ActionMailer
这里是我的邮件类定义
class OrganisationMailer < ActionMailer::Base
# code to send emails
end
这里是我写
测试的一个require 'spec_helper'
describe OrganisationsController do
describe "#email_single" do
context "With email address" do
let(:org) {Organisation.make!}
it "redirects to listing" do
get :email_single, :id => org.id
response.should redirect_to(organisations_path)
end
end
end
end