Rails [railstutorial]---第七章 model spec test 求助。

li1zheng2qian3 · 2014年07月23日 · 最后由 springwq 回复于 2014年07月23日 · 1848 次阅读

hi,在跟着 railstutorial 学习 rails 的过程中遇到一个问题。 在7.1.3 使用预构件测试用户资料页面代码 7.9 中 "visit user_path(user)"提示 Failure/Error: before{visit users_path(user)} NoMethodError: undefined method `users_path' for #“”RSpec::Core::ExampleGroup::Nested_1::Nested_8:0xb8dae54 之前在做 static_pages 的时候提示 about_path, help_path 没有定义的时候,我通过指定 controller 和 action 搞定了。请问这里是什么原因。有什么办法可以解决?

附使用的 gems

  • actionmailer (4.1.4)
    • actionpack (4.1.4)
    • actionview (4.1.4)
    • activemodel (4.1.4)
    • activerecord (4.1.4)
    • activesupport (4.1.4)
    • arel (5.0.1.20140414130214)
    • bcrypt (3.1.7)
    • bcrypt-ruby (3.1.5)
    • bootstrap-sass (2.3.2.0)
    • builder (3.2.2)
    • bundler (1.6.3)
    • capybara (2.1.0)
    • celluloid (0.15.2)
    • childprocess (0.5.3)
    • coderay (1.1.0)
    • coffee-rails (4.0.1)
    • coffee-script (2.3.0)
    • coffee-script-source (1.7.1)
    • diff-lcs (1.2.5)
    • erubis (2.7.0)
    • execjs (2.2.1)
    • factory_girl (4.4.0)
    • factory_girl_rails (4.4.1)
    • ffi (1.9.3)
    • formatador (0.2.5)
    • guard (2.6.1)
    • guard-rspec (3.1.0)
    • guard-spork (1.5.1)
    • hike (1.2.3)
    • i18n (0.6.11)
    • jbuilder (2.1.2)
    • jquery-rails (3.1.1)
    • json (1.8.1)
    • listen (2.7.9)
    • lumberjack (1.0.9)
    • mail (2.5.4)
    • method_source (0.8.2)
    • mime-types (1.25.1)
    • mini_portile (0.6.0)
    • minitest (5.4.0)
    • multi_json (1.10.1)
    • nokogiri (1.6.3.1)
    • pg (0.15.1)
    • polyglot (0.3.5)
    • pry (0.10.0)
    • rack (1.5.2)
    • rack-test (0.6.2)
    • rails (4.1.4)
    • rails_12factor (0.0.2)
    • rails_serve_static_assets (0.0.2)
    • rails_stdout_logging (0.0.3)
    • railties (4.1.4)
    • rake (10.3.2)
    • rb-fsevent (0.9.4)
    • rb-inotify (0.9.5)
    • rdoc (3.12.2)
    • rspec (2.13.0)
    • rspec-core (2.13.1)
    • rspec-expectations (2.13.0)
    • rspec-mocks (2.13.1)
    • rspec-rails (2.13.1)
    • rubyzip (0.9.9)
    • sass (3.2.19)
    • sass-rails (4.0.3)
    • sdoc (0.3.20)
    • selenium-webdriver (2.35.1)
    • slop (3.5.0)
    • spork (1.0.0rc4)
    • spork-rails (4.0.0)
    • spring (1.1.3)
    • sprockets (2.11.0)
    • sprockets-rails (2.1.3)
    • thor (0.19.1)
    • thread_safe (0.3.4)
    • tilt (1.4.1)
    • timers (1.1.0)
    • treetop (1.4.15)
    • turbolinks (2.2.2)
    • tzinfo (1.2.1)
    • uglifier (2.5.1)
    • websocket (1.0.7)
    • xpath (2.0.0)
before { visit user_path(user) }

typo: not users_path(user), should be user_path(user)

需要 登录 后方可回复, 如果你还没有账号请 注册新账号