重写原始问题,因为我不太可能得到以前发布的一般问题的答案。
我在路由中添加了新的API名称空间,并添加了新的API控制器测试。
namespace :api
get "vehicles", 'to: "vehicles#index"
我已经对前端控制器进行了现有测试:
class VehiclessControllerTest < ActionDispatch::IntegrationTest
,然后为api控制器添加了一个新的测试文件:
class ApiVehiclesControllerTest < ActionDispatch::IntegrationTest
这是麻烦开始的时候,夹具似乎没有装上。 一些做到了,其他没有。
将api测试类重命名为:
class ApiVehiclesControllerTestNew < ActionDispatch::IntegrationTest
解决了问题。
问题:ApiVehiclesControllerTest在处理流程中的哪个位置与VehiclesControllerTest创建名称冲突,因为Rails对于名称空间中的其他所有内容似乎都很聪明。是在某个时候剥离了类名开头的Api吗?