1) MessageController should check the status
Failure/Error: get :status
RuntimeError:
In order to use #url_for, you must include routing helpers explicitly. For instance, include Rails.application.routes.url_helpers.
# /Users/vishal/.rvm/gems/ruby-2.2.0/gems/actionpack-4.2.1/lib/abstract_controller/url_for.rb:13:in _routes
这个错误我正在运行我的规范。 route.rb文件是有效的,当我运行rails server并命中状态url时,它会显示所需的页面,但在运行rspec时,测试用例失败。
有什么建议吗?
答案 0 :(得分:1)
由于错误说..要在规范中使用应用程序助手,您需要显式包含它们,因为默认情况下ApplicationHelper不包含它们:
module ApplicationHelper
include Rails.application.routes.url_helpers
...
end
使用Rspec ..添加到rspec_helper.rb
RSpec.configure do |config|
config.include Rails.application.routes.url_helpers
...
end