目前在我的开发环境中,使用后我没有在ActionMailer::Base.deliveries
表中看到任何内容mail
。有没有我缺少的设置?
配置/环境/development.rb
config.action_mailer.delivery_method = :test
:。
应用程序/邮件程序/notifier.rb
def send_email(user)
mail(:to => user.email, :subject => "Welcome to our website!")
end
这些是我正在运行的测试:
When /^I signup$/ do
visit signup_path
@user = FactoryGirl.build(:user)
fill_in "user_email", :with => @user.email
fill_in "user_password", :with => @user.password
click_button "Join now"
end
Then /^I should receive a confirmation email$/ do
email = ActionMailer::Base.deliveries.last
email.subject.should == "Welcome to our website!"
end
现在我收到以下错误I should receive a confirmation email
:
undefined method subject for nil:NilClass (NoMethodError)
谢谢!