user_pages_spec.rb 的源程序如下:
1 require 'spec_helper'
2
3 describe "User pages" do
4
5 subject { page }
6
7 describe "profile page" do
8 let(:user) { FactoryGirl.create(:user) }
9 before { visit user_path(user) }
10
11 it { should have_content(user.name) }
12 it { should have_title(user.name) }
13 end
14
15 describe "signup page" do
16 before { visit signup_path }
17
18 it { should have_content('Sign up') }
19 it { should have_title(full_title('Sign up')) }
20 end
21 end
错误如下:
Failures:
1) User pages profile page
Failure/Error: before { visit user_path(user) }
ActionController::RoutingError:
uninitialized constant UsersController
# ./spec/requests/user_pages_spec.rb:9:in `block (3 levels) in <top (required)>'
2) User pages profile page
Failure/Error: before { visit user_path(user) }
ActionController::RoutingError:
uninitialized constant UsersController
# ./spec/requests/user_pages_spec.rb:9:in `block (3 levels) in <top (required)>'
Finished in 0.70663 seconds
35 examples, 2 failures, 2 pending
Failed examples:
rspec ./spec/requests/user_pages_spec.rb:11 # User pages profile page
rspec ./spec/requests/user_pages_spec.rb:12 # User pages profile page
不知道哪里出了问题?请大家帮帮忙