我在 rspec 上运行这个测试......
it 'get email is successful' do
get :email
response.should be_success
response.should render_template('email')
结尾
控制器代码看起来像这样的地方..
def email
respond_to do |format|
format.js
end
end
在我的终端上,我带着....
3) PostsController checking to see if response for post email is successful
Failure/Error: response.should be_success
expected success? to return true, got false
# ./spec/controllers/posts_controller_spec.rb:116:in `block (3 levels) in <top
(required)>'
我在这里缺少什么来进行测试?它必须是显而易见的。我的视图文件名为email.js.erb
. 此操作适用于 AJAX 调用。