tracks/vendor/plugins/selenium-on-rails/lib/selenium_on_rails_config.rb

31 lines
708 B
Ruby
Raw Normal View History

require 'yaml'
2009-12-14 11:51:36 -05:00
require 'erb'
class SeleniumOnRailsConfig
2009-12-14 11:51:36 -05:00
@@defaults = {:environments => ['test']}
def self.get var, default = nil
value = configs[var.to_s]
value ||= @@defaults[var]
value ||= default
value ||= yield if block_given?
value
end
2009-12-14 11:51:36 -05:00
private
def self.configs
@@configs ||= nil
unless @@configs
files = [File.join(RAILS_ROOT, 'config', 'selenium.yml'), File.expand_path(File.dirname(__FILE__) + '/../config.yml')]
files.each do |file|
if File.exist?(file)
@@configs = YAML.load(ERB.new(IO.read(file)).result)
break
end
end
@@configs ||= {}
end
@@configs
end
end