我有一个失败的测试,我很难理解.我class Users::QueriesController < ApplicationController在app/controllers/users/queries_controller.rb上有一个控制器,它有一个show动作和一个相应的命名空间路由:
namespace :users do
resources :queries
end
Run Code Online (Sandbox Code Playgroud)
我还在test/controllers/users/queries_controller_test.rb上进行了测试:
require 'test_helper'
class Users::QueriesControllerTest < ActionController::TestCase
test "accessing :show action" do
get :show
assert_response :success
end
end
Run Code Online (Sandbox Code Playgroud)
运行此测试会导致ActionController::UrlGenerationError: No route matches {:controller=>"users/queries", :action=>"show"}.
跑步rake routes包括这一行:users_query GET /users/queries/:id(.:format) users/queries#show.
这里出了什么问题?我正在使用Rails 4.0.0.