失败/错误:访问movie_url(电影)ActionView :: Template ::错误:参数数量错误(3为0..1)

时间:2015-06-27 03:51:53

标签: ruby-on-rails ruby rspec tdd rspec-rails

这个问题听起来非常类似于已经被问过和回答的问题,我觉得我似乎无法弄明白。

我有以下错误消息,使我的规范测试失败。

Failures:

  1) Navigating movies allows navigation from the detail page to the listing page
     Failure/Error: visit movie_url(movie)
     ActionView::Template::Error:
       wrong number of arguments (3 for 0..1)
     # ./app/views/movies/show.html.erb:24:in `_app_views_movies_show_html_erb__1138068182152565203_70152862507580'
     # ./spec/navigate_movies_spec.rb:12:in `block (2 levels) in <top (required)>'

Finished in 0.20747 seconds
1 example, 1 failure

Failed examples:

rspec ./spec/navigate_movies_spec.rb:5 # Navigating movies allows navigation from the detail page to the listing page

Randomized with seed 14064

我的实际规格测试如下:

require 'spec_helper'
include Rails.application.routes.url_helpers

  describe "Navigating movies" do
    it "allows navigation from the detail page to the listing page" do
    ...
    visit movie_url(movie)

    click_link "All Movies"

    expect(current_path).to eq(movies_path)
  end
end

我的展会页面:          &lt;%= link_to“所有电影”,movies_path%&gt; 编辑:

rake routes
Prefix Verb URI Pattern           Controller#Action
movies GET  /movies(.:format)     movies#index
 movie GET  /movies/:id(.:format) movies#show

编辑#3

bundle exec rspec -b
FF.

Failures:

  1) Viewing an individual movie shows the movie's details
     Failure/Error: visit movie_url(movie)
     ActionView::Template::Error:
       wrong number of arguments (3 for 0..1)
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/url_for.rb:150:in `url_for'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:280:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:223:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:345:in `block (2 levels) in define_url_helper'
     # ./app/views/movies/show.html.erb:23:in `_app_views_movies_show_html_erb__342552887677354596_70168586387480'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/template.rb:145:in `block in render'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:166:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/template.rb:333:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/template.rb:143:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `block in instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:53:in `block in render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:52:in `render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:14:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/renderer.rb:42:in `render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/renderer.rb:23:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/rendering.rb:100:in `_render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/streaming.rb:217:in `_render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/rendering.rb:83:in `render_to_body'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rendering.rb:32:in `render_to_body'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/renderers.rb:37:in `render_to_body'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/rendering.rb:25:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rendering.rb:16:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
     # /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/core_ext/benchmark.rb:12:in `ms'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:44:in `block in render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
     # /Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.1/lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:43:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/base.rb:198:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rendering.rb:10:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:92:in `_run_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_process_action_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/callbacks.rb:19:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rescue.rb:29:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `block in instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.1/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/base.rb:137:in `process'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/rendering.rb:30:in `process'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal.rb:196:in `dispatch'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal.rb:237:in `block in action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:74:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:43:in `serve'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/journey/router.rb:43:in `block in serve'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/journey/router.rb:30:in `each'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/journey/router.rb:30:in `serve'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:819:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/etag.rb:24:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/conditionalget.rb:25:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/flash.rb:260:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:225:in `context'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:220:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/cookies.rb:560:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.1/lib/active_record/query_cache.rb:36:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:649:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:88:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:88:in `_run_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_call_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/web-console-2.1.3/lib/web_console/middleware.rb:37:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/railties-4.2.1/lib/rails/rack/logger.rb:38:in `call_app'
     # /Library/Ruby/Gems/2.0.0/gems/railties-4.2.1/lib/rails/rack/logger.rb:20:in `block in call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:68:in `block in tagged'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:26:in `tagged'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:68:in `tagged'
     # /Library/Ruby/Gems/2.0.0/gems/railties-4.2.1/lib/rails/rack/logger.rb:20:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/request_id.rb:21:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/static.rb:113:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:518:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/railties-4.2.1/lib/rails/application.rb:164:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/urlmap.rb:66:in `block in call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in `each'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-test-0.6.3/lib/rack/mock_session.rb:30:in `request'
     # /Library/Ruby/Gems/2.0.0/gems/rack-test-0.6.3/lib/rack/test.rb:244:in `process_request'
     # /Library/Ruby/Gems/2.0.0/gems/rack-test-0.6.3/lib/rack/test.rb:58:in `get'
     # /Library/Ruby/Gems/2.0.0/gems/capybara-2.1.0/lib/capybara/rack_test/browser.rb:59:in `process'
     # /Library/Ruby/Gems/2.0.0/gems/capybara-2.1.0/lib/capybara/rack_test/browser.rb:35:in `process_and_follow_redirects'
     # /Library/Ruby/Gems/2.0.0/gems/capybara-2.1.0/lib/capybara/rack_test/browser.rb:21:in `visit'
     # /Library/Ruby/Gems/2.0.0/gems/capybara-2.1.0/lib/capybara/rack_test/driver.rb:42:in `visit'
     # /Library/Ruby/Gems/2.0.0/gems/capybara-2.1.0/lib/capybara/session.rb:193:in `visit'
     # /Library/Ruby/Gems/2.0.0/gems/capybara-2.1.0/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'
     # ./spec/show_movie_spec.rb:9:in `block (2 levels) in <top (required)>'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:114:in `instance_eval'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:114:in `block in run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:179:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:179:in `run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in `instance_exec'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in `instance_eval_with_args'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:247:in `instance_eval_with_args'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/hooks.rb:87:in `block (2 levels) in run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/hooks.rb:89:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/hooks.rb:89:in `run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/hooks.rb:418:in `run_hook'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:329:in `run_around_each_hooks'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:256:in `with_around_each_hooks'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:111:in `run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:390:in `block in run_examples'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:386:in `map'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:386:in `run_examples'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:371:in `run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:28:in `map'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:28:in `block in run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/reporter.rb:34:in `report'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:25:in `run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'

  2) Navigating movies allows navigation from the detail page to the listing page
     Failure/Error: visit movie_url(movie.to_param)
     ActionView::Template::Error:
       wrong number of arguments (3 for 0..1)
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/url_for.rb:150:in `url_for'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:280:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:223:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:345:in `block (2 levels) in define_url_helper'
     # ./app/views/movies/show.html.erb:23:in `_app_views_movies_show_html_erb__342552887677354596_70168586387480'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/template.rb:145:in `block in render'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:166:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/template.rb:333:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/template.rb:143:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `block in instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:53:in `block in render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:52:in `render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:14:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/renderer.rb:42:in `render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/renderer.rb:23:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/rendering.rb:100:in `_render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/streaming.rb:217:in `_render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/rendering.rb:83:in `render_to_body'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rendering.rb:32:in `render_to_body'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/renderers.rb:37:in `render_to_body'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/rendering.rb:25:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rendering.rb:16:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
     # /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/core_ext/benchmark.rb:12:in `ms'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:44:in `block in render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
     # /Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.1/lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:43:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/base.rb:198:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rendering.rb:10:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:92:in `_run_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_process_action_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/callbacks.rb:19:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rescue.rb:29:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `block in instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.1/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/base.rb:137:in `process'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/rendering.rb:30:in `process'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal.rb:196:in `dispatch'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'

Finished in 0.84651 seconds
3 examples, 2 failures

Failed examples:

rspec ./spec/show_movie_spec.rb:6 # Viewing an individual movie shows the movie's details
rspec ./spec/navigate_movies_spec.rb:5 # Navigating movies allows navigation from the detail page to the listing page

1 个答案:

答案 0 :(得分:0)

您可以运行rake路线并查看您的movie_url可以使用多少参数?根据REST你的url看起来很好,但如果你能确保没有其他路径覆盖你当前的路径就好了。

您也可以尝试以下操作,看看会发生什么?

movie_url({id: movie.to_param})

movie_url(movie.to_param)