This question sounds very similar to those that have already been asked and answered thought I can't seem to figure it out.
I have the following error message that makes my spec test fail.
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
My actual spec test looks like this:
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
My show page:
<article>
<p>
<%= link_to "All Movies", movies_path %>
</p>
</article>
Edited:
rake routes
Prefix Verb URI Pattern Controller#Action
movies GET /movies(.:format) movies#index
movie GET /movies/:id(.:format) movies#show
Aucun commentaire:
Enregistrer un commentaire