なぜ私はそれを得るのですか/どうすればそれを回避できますか?
コードは次のとおりです。
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