1

我有这个规格:

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 模块中,为什么找不到该方法。

4

1 回答 1

1

我有一个旧版本的 Pony-Test 搞砸了工作,修改了 Gemfile 以指向最新的,固定的。

于 2013-04-20T23:25:19.950 回答