selenium-rails 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.txt CHANGED
@@ -7,7 +7,7 @@ Selenium Rails supports the use of Selenium RC with Ruby on Rails projects.
7
7
 
8
8
  = Instructions
9
9
 
10
- * gem install selenium-rake
10
+ * gem install selenium-rails
11
11
  * Copy the file /lib/tasks/selenium_tasks.rake into your app's lib/tasks directory
12
12
  * Write some selenium tests under test/selenium. For an example app, see http://github.com/pivotal/minimalenium
13
13
  * 'rake test:selenium' to run all selenium tests
@@ -1,22 +1,28 @@
1
1
  module Selenium
2
2
  class SeleniumDriverManager
3
- @@selenium_driver = nil
3
+ # supports multiple drivers, keyed by options
4
+ @@selenium_drivers = {}
4
5
 
5
6
  def self.driver(driver_options = {})
6
- unless @@selenium_driver
7
- browser_start_command = ENV['BROWSER_START_COMMAND'] ? ENV['BROWSER_START_COMMAND'] : '*firefox'
8
- opts = {:server_host => 'localhost', :server_port => '4444', :browser_start_command => browser_start_command,
9
- :browser_url => 'http://localhost:3001', :timeout => 10000}.merge(driver_options)
10
- @@selenium_driver = Selenium::SeleniumDriver.new(opts[:server_host], opts[:server_port], opts[:browser_start_command],
7
+ browser_start_command = ENV['BROWSER_START_COMMAND'] ? ENV['BROWSER_START_COMMAND'] : '*firefox'
8
+ opts = {:server_host => 'localhost', :server_port => '4444', :browser_start_command => browser_start_command,
9
+ :browser_url => 'http://localhost:3001', :timeout => 10000}.merge(driver_options)
10
+ key = opts.map {|key, value| key.to_s + '=>' + value.to_s}.sort.join(',')
11
+ unless @@selenium_drivers[key]
12
+ @@selenium_drivers[key] = Selenium::SeleniumDriver.new(opts[:server_host], opts[:server_port], opts[:browser_start_command],
11
13
  opts[:browser_url], opts[:timeout])
12
- @@selenium_driver.start
14
+ @@selenium_drivers[key].start
13
15
  end
14
- @@selenium_driver
16
+ @@selenium_drivers[key]
15
17
  end
16
18
 
17
- def self.stop_driver
18
- @@selenium_driver.stop if @@selenium_driver
19
- @@selenium_driver = nil
19
+ def self.stop_drivers
20
+ # Doesn't actually do anything if called from a different process than the one where the
21
+ # drivers were started, but they will die anyway when the server is killed.
22
+ @@selenium_drivers.each do |key, selenium_driver|
23
+ selenium_driver.stop
24
+ @@selenium_drivers.delete(key)
25
+ end
20
26
  end
21
27
  end
22
28
  end
@@ -13,7 +13,7 @@ module SeleniumRails
13
13
 
14
14
  yield
15
15
 
16
- Selenium::SeleniumDriverManager.stop_driver
16
+ Selenium::SeleniumDriverManager.stop_drivers
17
17
  rescue Exception => e
18
18
  puts e
19
19
  raise e
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{selenium-rails}
3
- s.version = "0.0.1"
3
+ s.version = "0.0.2"
4
4
 
5
5
  s.specification_version = 2 if s.respond_to? :specification_version=
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Woolley, Others
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  requirements: []
75
75
 
76
76
  rubyforge_project: selenium-rails
77
- rubygems_version: 1.3.0
77
+ rubygems_version: 1.2.0.1861
78
78
  signing_key:
79
79
  specification_version: 2
80
80
  summary: Support for using Selenium RC with Rails.