Cucumber feature showing error “No Route Matches”

I have a feature file like this

Feature: search for movies by director

As a movie buff
So that I can find movies with my favorite director
I want to include and serach on director information in movies I enter

Background: movies in database

Given the following movies exist:
| title        | rating | director     | release_date |
| Star Wars    | PG     | George Lucas |   1977-05-25 |
| Blade Runner | PG     | Ridley Scott |   1982-06-25 |
| Alien        | R      |              |   1979-05-25 |
| THX-1138     | R      | George Lucas |   1971-03-11 |

Scenario: add director to existing movie
When I go to the edit page for "Alien"
And  I fill in "Director" with "Ridley Scott"
And  I press "Update Movie Info"
Then the director of "Alien" should be "Ridley Scott"

Now I have a step definition like this which passes the Given the following movies exist: case.

Given /the following movies exist/ do |movies_table|
  movies_table.hashes.each do |movie|


But when cucumber runs the step When I go to the edit page for "Alien" it throws this error

No route matches {:action=>"edit", :controller=>"movies"} (ActionController::RoutingError) ./features/support/paths.rb:20:in `path_to'

My paths.rb has this Case in path_to

when /^the edit page for (.*)/
  m = Movie.find_by_title($1)

I checked that m is coming nil, but in the background i added four of the movies to the db. I have also checked 'rake routes' but all routes are present.

Please help me understand, I am very new to rails and cucumber. Thanks


double quote is missing around (.*) the

when /^the edit page for (.*)/

should be

when /^the edit page for "(.*)"/

Explanation: Assuming that your websteps.rb is containing

When /^(?:|I )go to (.+)$/ do |page_name|
  visit path_to(page_name)

It means first it will get the url by calling path_to('the edit page for "Alien"'). Hence the case you are handing in path_to function should extract out the name Alien only. As the double quotes are missing, the $1 is containing "Alien" instead of only Alien. And the find_by_title is actually looking for a movie like below

m = Movie.find_by_title('"Alien"') # Doesn't exist for sure ;)

Need Your Help

Storing date in two bytes

c date bitwise-operators

I am reading a Let us C book, in that to store date in two bytes formula is there

Multiple Ajax Collapsers in one page causes on to close .net ajax collapsiblepanelextender

Ok so currently I have a ajax collapser for "advance search" options. Then I went to add a top bar for navigation which user can show/hide using ajax collapser aswell. By default that collapser i...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.