lib/saucelabs_adapter/utilities.rb in saucelabs-adapter-0.8.22 vs lib/saucelabs_adapter/utilities.rb in saucelabs-adapter-0.8.24
- old
+ new
@@ -32,7 +32,36 @@
ensure
socket.close if socket
end
end
end
+
+ # parameters required when invoked by test_unit
+ def start_mongrel(suite_name = {})
+ pid_file = File.join(RAILS_ROOT, "tmp", "pids", "mongrel_selenium.pid")
+ port = suite_name[:port] rescue @selenium_config.application_port
+ say "Starting mongrel at #{pid_file}, port #{port}"
+ system "mongrel_rails start -d --chdir='#{RAILS_ROOT}' --port=#{port} --environment=test --pid #{pid_file} %"
+ end
+
+ def kill_mongrel_if_needed(suite_name = {})
+ mongrel_pid_file = File.join(RAILS_ROOT, "tmp", "pids", "mongrel_selenium.pid")
+ if File.exists?(mongrel_pid_file)
+ pid = File.read(mongrel_pid_file).to_i
+ say "Killing mongrel at #{pid}"
+ Process.kill("KILL", pid)
+ end
+ if File.exists?(mongrel_pid_file)
+ FileUtils.rm(mongrel_pid_file)
+ end
+ end
+
+ def setup_tunnel(suite_name = {})
+ @tunnel = SaucelabsAdapter::Tunnel.factory(@selenium_config)
+ @tunnel.start_tunnel
+ end
+
+ def teardown_tunnel(suite_name = {})
+ @tunnel.shutdown
+ end
end
-end
\ No newline at end of file
+end