Home Contact Sitemap

Preston Lee

Founder, CEO, OpenRain.com

About

During the day I run OpenRain in Phoenix: a Ruby on Rails development shop. During the night... well... I still have to run OpenRain, but when I find time to breathe, I exhale here. If you'd like to get in touch professionally, don't hesitate to contact me via the OpenRain website.

Peace,

Preston

Rails 2.0: selenium-on-rails routes.rb fix

When I updated a few projects to Rails 2.0 last year, selenium-on-rails stopped working … some issue with routing and the lame way selenium-on-rails adds its routes. I didn’t spend the time to figure out exactly what the routing problem was, but did manage to hack a quick fix into routes.rb. This feels like the Wrong Way for an ultimate fix but it at least solves the immediate problem. Shove these rules into your routes.rb and the /selenium path should start resolving again…


ActionController::Routing::Routes.draw do |map|

# other rules
# ...
# HACK for selenium-on-rails in rails 2.0
if RAILS_ENV == 'test'

map.connect 'selenium/setup', :controller => 'selenium', :action => 'setup'
map.connect 'selenium/tests/*testname', :controller => 'selenium', :action => 'test_file'
map.connect 'selenium/postResults', :controller => 'selenium', :action => 'record'
map.connect 'selenium/postResults/:logFile', :controller => 'selenium', :action => 'record', :requirements => { :logFile => /.*/ }
map.connect 'selenium/*filename', :controller => 'selenium', :action => 'support_file'

end

end

Share/Save/Bookmark

Tags: , , , , , ,

. 12 Feb 08 | Uncategorized


Leave a Reply