到目前为止,到目前为止我没有遇到任何测试错误,但我无法弄清楚这些错误。
Failures:
1) PagesController GET 'home' should have the right title
Failure/Error: response.should have_selector("title",
undefined method `has_selector?' for #<ActionController::TestResponse:0x00000100ee9ed0>
# ./spec/controllers/pages_controller_spec.rb:18:in `block (3 levels) in <top (required)>'
2) PagesController GET 'contact' should have the right title
Failure/Error: response.should have_selector("title",
undefined method `has_selector?' for #<ActionController::TestResponse:0x00000100b51f98>
# ./spec/controllers/pages_controller_spec.rb:31:in `block (3 levels) in <top (required)>'
3) PagesController GET 'about' should have the right title
Failure/Error: response.should have_selector("title",
undefined method `has_selector?' for #<ActionController::TestResponse:0x00000103296978>
# ./spec/controllers/pages_controller_spec.rb:44:in `block (3 levels) in <top (required)>'
4) PagesController GET 'help' should have the right title
Failure/Error: response.should have_selector("title",
undefined method `has_selector?' for #<ActionController::TestResponse:0x00000101ddc280>
# ./spec/controllers/pages_controller_spec.rb:57:in `block (3 levels) in <top (required)>'
5) UsersController GET 'show' should have the right title
Failure/Error: response.should have_selector("title", :content => @user.name)
undefined method `has_selector?' for #<ActionController::TestResponse:0x00000101e53f88>
# ./spec/controllers/users_controller_spec.rb:24:in `block (3 levels) in <top (required)>'
6) UsersController GET 'show' should include the user's name
Failure/Error: response.should have_selector("h1", :content => @user.name)
undefined method `has_selector?' for #<ActionController::TestResponse:0x00000101e01620>
# ./spec/controllers/users_controller_spec.rb:29:in `block (3 levels) in <top (required)>'
7) UsersController GET 'show' should have a profile image
Failure/Error: response.should have_selector("h1>img", :class => "gravatar")
undefined method `has_selector?' for #<ActionController::TestResponse:0x00000101d6e938>
# ./spec/controllers/users_controller_spec.rb:34:in `block (3 levels) in <top (required)>'
8) UsersController GET 'new' should have the right title
Failure/Error: response.should have_selector("title", :content => "Sign up")
undefined method `has_selector?' for #<ActionController::TestResponse:0x00000100fabe18>
# ./spec/controllers/users_controller_spec.rb:47:in `block (3 levels) in <top (required)>'
9) LayoutLinks should have a Home page at '/'
Failure/Error: response.should have_selector('title', :content => "Home")
undefined method `has_selector?' for #<ActionDispatch::TestResponse:0x00000101e6f030>
# ./spec/requests/layout_links_spec.rb:6:in `block (2 levels) in <top (required)>'
10) LayoutLinks should have a Contact page at '/contact'
Failure/Error: response.should have_selector('title', :content => "Contact")
undefined method `has_selector?' for #<ActionDispatch::TestResponse:0x00000101e2b678>
# ./spec/requests/layout_links_spec.rb:11:in `block (2 levels) in <top (required)>'
11) LayoutLinks should have an About page at '/about'
Failure/Error: response.should have_selector('title', :content => "About")
undefined method `has_selector?' for #<ActionDispatch::TestResponse:0x00000101de9a20>
# ./spec/requests/layout_links_spec.rb:16:in `block (2 levels) in <top (required)>'
12) LayoutLinks should have a Help page at 'help'
Failure/Error: response.should have_selector('title', :content => "Help")
undefined method `has_selector?' for #<ActionDispatch::TestResponse:0x00000101cfbbe0>
# ./spec/requests/layout_links_spec.rb:21:in `block (2 levels) in <top (required)>'
13) LayoutLinks should have a signup page at '/signup'
Failure/Error: response.should have_selector('title', :content => "Sign up")
undefined method `has_selector?' for #<ActionDispatch::TestResponse:0x000001019f1b20>
# ./spec/requests/layout_links_spec.rb:26:in `block (2 levels) in <top (required)>'
14) LayoutLinks should have the right links on the layout
Failure/Error: visit root_path
undefined method `visit' for #<RSpec::Core::ExampleGroup::Nested_4:0x00000101ed9d40>
# ./spec/requests/layout_links_spec.rb:30:in `block (2 levels) in <top (required)>'
Finished in 0.76618 seconds
40 examples, 14 failures
答案 0 :(得分:2)
答案 1 :(得分:0)
我得到了相同的错误,令人沮丧。更新了捆绑,重新运行自动测试无济于事。这个链接帮助了我,结果控制器文件中的语法(在Michael Hartl的书中)是不正确的..试试相反,它对我有用:
response.should contain("Ruby on Rails Tutorial Sample App | Home")[Found out it was a syntax issus on this site][1]