为什么我会得到那个/我怎样才能绕过它?
代码是:
class UserController < ApplicationController
def index
@users=User.all
end
end
规格是:
require 'spec_helper'
describe UserController do
describe "GET index" do
it "assigns @users" do
user = User.create(:email => 'bob@test.com', :password=>'12', :password_confirmation=> '12')
get :index
assigns(:users).should eq([user])
end
it "renders the index template" do
get :index
response.should render_template("index")
end
end
end
Failures:
1) UserController GET index assigns @users
Failure/Error: get :index
ActionController::RoutingError:
No route matches {:controller=>"user"}
# ./spec/controllers/user_controller_spec.rb:8:in `block (3 levels) in <top (required)>'
2) UserController GET index renders the index template
Failure/Error: get :index
ActionController::RoutingError:
No route matches {:controller=>"user"}
# ./spec/controllers/user_controller_spec.rb:13:in `block (3 levels) in <top (required)>'
Finished in 0.13146 seconds
2 examples, 2 failures
路线是:
TimeTracker::Application.routes.draw do
devise_for :users
resources :users
root :to => 'users#index'
end