私はこの仕様を持っています:
describe EmailerHelper do
describe "send email" do
include EmailerHelper
include Pony::TestHelpers
before { sendUBEmail('nobody@nowhere.net','Test Subject','Test Body') }
it "Pony has received the email" do
current_email.address.should == "noobody@nowhere.net"
end
end
end
これは現在 sendUBEmail です:
module EmailerHelper
def sendUBEmail(receiver,subject,body)
if Rails.env != 'production'
#TODO - make test email an environment variable
Pony.mail(:to => 'p***@p***.net', :subject => subject, :body => body)
else
Pony.mail(:to => receiver, :subject => subject, :html_body => body)
end
end
end
この仕様を実行すると、このエラーが発生します
1) EmailerHelper send email Pony has received the email
Failure/Error: before { sendUBEmail('nobody@nowhere.net','Test Subject','Test Body') }
NoMethodError:
undefined method `build_tmail' for Pony:Module
# ./app/helpers/emailer_helper.rb:5:in `sendUBEmail'
# ./spec/helpers/emailer_helper_spec.rb:17:in `block (3 levels) in <top (required)>'
この「build_tmail」はどこにありますか? Pony モジュールにはありません。メソッドが見つからないのはなぜですか。