私は私のActionMailers - InvitationMailerのテストを書いていますが、それは"受信者 "メソッドを見つけることができません。ActionMailer:定義されていないメソッド `recipients 'for
私のテストでは、次のようになります
describe "Invitation" do
it "should send invitation email to user" do
user = Factory :user
email = InvitationMailer.invitation_email(user).deliver
# Send the email, then test that it got queued
assert !ActionMailer::Base.deliveries.empty?
# Test the body of the sent email contains what we expect it to
assert_equal [user.email], email.to
assert_equal "You have been Invited!", email.subject
end
マイInvitationMailerは次のようになります。
class InvitationMailer < ActionMailer::Base
default from: "[email protected]"
def invitation_email(user)
recipients user.email
from "[email protected]"
subject "You have been Invited!"
body :user => user
end
end
Iただし、次のエラーMSG取得:
Failure/Error: email = InvitationEmail.invitation_email(user).deliver
NoMethodError:
undefined method `recipients' for #<InvitationMailer:0x007fca0b41f7f8>
任意のアイデアをどのようなかもしれない?ここで
どのバージョンのRailsですか? 2.Xを推測する? – x1a4
いいえ、そのレール3.2.2 – Karan