【发布时间】:2020-08-04 14:36:50
【问题描述】:
我正在尝试运行基本的控制器测试。
我的 controller_spec.rb 看起来像:
class Test < ActionController::Base
def test_meth
puts 'hello for test meth'
head 200
end
end
describe Test do
it 'responds with 200' do
get :test_meth
expect(response.status).to eq(200)
end
end
当我运行这个规范时,我最终会遇到一个错误
ActionController::UrlGenerationError: No route matches {:action=>"test_meth", :controller=>"test"}
我不确定我是否在这里遗漏了一些非常基本的东西,因为这看起来非常简单。非常感谢任何帮助。
【问题讨论】:
标签: ruby-on-rails rspec rspec-rails controller-tests