1
我有這個天賦:小馬拋出NoMethodError
describe EmailerHelper do
describe "send email" do
include EmailerHelper
include Pony::TestHelpers
before { sendUBEmail('[email protected]','Test Subject','Test Body') }
it "Pony has received the email" do
current_email.address.should == "[email protected]"
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('[email protected]','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'?它不在小馬模塊中,爲什麼沒有找到該方法。