我不确定为什么 minitest 不能识别我的路线:
# airlines_controller_test.rb
class AirlinesControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get api_v1_airlines
assert_response :success
end
end
` api_v1_airlines GET /api/v1/airlines(.:format) api/v1/airlines#index {:params=>:slug}
`
我进行了测试,它给了我
`Error:
AirlinesControllerTest#test_should_get_index:
NameError: undefined local variable or method `api_v1_airlines' for #<AirlinesControllerTest:0x0000006532df84b8>
test/controllers/airlines_controller_test.rb:5:in `block in <class:AirlinesControllerTest>'`
我做错了什么?它不识别路线,但它是在铁路路线中定义的。我的测试文件中没有包括什么?