【发布时间】:2012-07-12 03:15:37
【问题描述】:
我在一个动作中有以下代码:
render :file => 'public/404.html' and return
这在浏览器中运行良好。我编写了以下 rspec 示例来对此进行测试:
it "renders 404" do
get :new
response.should render_template('public/404.html')
end
运行此示例会导致以下错误:
Failure/Error: response.should render_template('public/404.html')
Expected block to return true value.
我也尝试过response.should render_template(:file => 'public/404.html'),但这也会导致错误。
我应该如何测试这个?
【问题讨论】:
标签: ruby-on-rails testing rspec