【发布时间】:2013-10-01 09:23:44
【问题描述】:
我正在使用 rspec 验证邮件程序。 问题是当我想测试扩散(多个交付者邮件程序)时,rspec 给我一个错误。
我的制造商:
Fabricator(:message) do
email(count: 1) {"proof@example.com" }
subject:"Hackety-hack email"
body:"This is an email from hackety-hack.com"
end
Fabricator(:diffusion) do
email(count: 3) {"proof#{i}@example.com" }
subject:"Hackety-hack email"
body:"This is an email from hackety-hack.com"
end
在我的 message_mailer_spec.rb 我有
it "Works the diffusion" do
diffusion.to.should eq(["proof@example.com", "proof2@example.com"])
end
当我尝试通过测试时,会出现很多错误。主要(我认为):
10) MessageMailer Works the diffusion
Failure/Error: let(:diffusion) { MessageMailer.new_message(Fabricate(:diffusion), Array("proof@example.com", "proof2@example.com", "proof3@example.com"))}
Fabrication::UnknownFabricatorError:
No Fabricator defined for 'diffusion'
为什么?我已经创建了扩散。 谁能帮帮我?
提前致谢
【问题讨论】:
标签: ruby ruby-on-rails-3 rspec fabrication-gem