目前在我的開發環境中,在使用mail
之後,我看不到ActionMailer::Base.deliveries
表中的任何內容。有沒有我失蹤的設置?爲什麼電子郵件沒有進入ActionMailer :: Base.deliveries表?
config/environments/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)
謝謝!
你有你的郵件視圖?你怎麼測試? – Ivan