【发布时间】:2012-05-23 12:29:33
【问题描述】:
目前在我的开发环境中,使用mail 后,我在ActionMailer::Base.deliveries 表中看不到任何内容。有没有我遗漏的设置?
config/environments/development.rb:config.action_mailer.delivery_method = :test.
app/mailers/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)
谢谢!
【问题讨论】:
-
您对您的邮件有看法吗?你是怎么测试的?
标签: ruby-on-rails