tracks/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/paths.rb
Luke Melia 901a58f8a3 Upgraded to Rails 2.1. This can have wide ranging consequences, so please help track down any issues introduced by the upgrade. Requires environment.rb modifications.
Changes you will need to make:

 * In your environment.rb, you will need to update references to a few files per environment.rb.tmpl
 * In your environment.rb, you will need to specify the local time zone of the computer that is running your Tracks install.

Other notes on my changes:

 * Modified our code to take advantage of Rails 2.1's slick time zone support.
 * Upgraded will_paginate for compatibility
 * Hacked the Selenium on Rails plugin, which has not been updated in some time and does not support Rails 2.1
 * Verified that all tests pass on my machine, including Selenium tests -- I'd like confirmation from others, too.
2008-06-17 01:13:25 -04:00

56 lines
1.6 KiB
Ruby

module SeleniumOnRails
module Paths
def selenium_path
@@selenium_path ||= find_selenium_path
@@selenium_path
end
def selenium_tests_path
File.expand_path(File.join(RAILS_ROOT, 'test/selenium'))
end
def view_path view
File.expand_path(File.dirname(__FILE__) + '/../views/' + view)
end
def layout_path
'/layout.rhtml'
end
def fixtures_path
File.expand_path File.join(RAILS_ROOT, 'test/fixtures')
end
def log_path log_file
File.expand_path(File.dirname(__FILE__) + '/../../log/' + File.basename(log_file))
end
def skip_file? file
file.split('/').each do |f|
return true if f.upcase == 'CVS' or f.starts_with?('.') or f.ends_with?('~') or f.starts_with?('_')
end
false
end
private
def find_selenium_path
sel_dirs = SeleniumOnRailsConfig.get :selenium_path do
ds = [File.expand_path(File.join(RAILS_ROOT, 'vendor/selenium')),
File.expand_path(File.join(RAILS_ROOT, 'vendor/selenium-core'))]
gems = Gem.source_index.find_name 'selenium', nil
ds << gems.last.full_gem_path unless gems.empty?
ds
end
sel_dirs.to_a.each do |seleniumdir|
['', 'core', 'selenium', 'javascript'].each do |subdir|
path = File.join seleniumdir, subdir
return path if File.exist?(File.join(path, 'TestRunner.html'))
end
end
raise 'Could not find Selenium Core installation'
end
end
end