views:

137

answers:

1

I'm currently rewriting a website in Rails. I've written a model that maps the old static URLs to the new ones and in the application controller I'm trapping RoutingErrors to call a method that looks for a new URL that maps to the old one. This works perfectly well in the applicaion itself; if I visit http://localhost:3000/home.htm it will redirect to http://localhost:3000/home, but I can't get the Cucumber / Webrat tests I've written to pass as I always get an error like this.

When I try to go to the old noticeboard          
  #features/step_definitions/redirection_steps.rb:7
  No route matches "/noticeboard.htm" with {:method=>:get} (ActionController::RoutingError)
  (eval):2:in `visit'
  ./features/step_definitions/redirection_steps.rb:8:in `/^I try to go to the old (.+)$/'
  features/old_urls.feature:26:in `When I try to go to the old noticeboard'

Obviously it's most important that the code actually works, and it does redirect correctly in the browser but I'd like the tests to pass too. Is there a way I can work around this?

A: 

Did you ever resolve this? I have been having a lot of issues with the visit method in webrat. This turned out to be having RAILS_ENV=development in my environment.

Steve Weet