使用rspec-rails
,我应该如何测试邮件模板的正确呈现?我从这个测试开始spec/views/user_mailer.spec
:
describe Mailer do
it 'sends an message email' do
render 'send_message'
end
end
它告诉我:
Failure/Error: render 'mailer/send_message.html.erb'
ActionView::MissingTemplate:
Missing partial mailer/send_message.html with {:formats=>[:html, :text, :js, :css, :ics, :csv, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :handlers=>[:erb, :builder, :haml, :coffee], :locale=>[:de]}.
Searched in:
* ".../app/views"`
但是有我要渲染的模板app/views/mailer/send_message.html.erb
我应该如何规范这个?(我想检查 CSS 规则是否导致页脚的颜色正确,如果没有更好的方法,我想用 jQuery-Javascript 提取)