add the ability to install a cucumber helper

This commit is contained in:
John Bintz 2013-01-25 10:56:56 -05:00
parent 15ac9af489
commit 5549ef5de4
3 changed files with 28 additions and 1 deletions

View File

@ -19,6 +19,12 @@ require 'persistent_selenium/driver'
Capybara.default_driver = :persistent_selenium
```
If you're using Cucumber, you can also install that hook:
``` bash
persistent_selenium install
```
Should work just the same as if you used the standard Capybara Selenium driver, except for
these two differences:

View File

@ -3,12 +3,17 @@ require 'persistent_selenium'
module PersistentSelenium
class CLI < Thor
include Thor::Actions
def self.source_root
File.expand_path('../../../skel', __FILE__)
end
desc "start", "Start the server"
method_options :port => PersistentSelenium.port, :browser => PersistentSelenium.browser
def start
require 'persistent_selenium/browser'
require 'drb'
GC.disable
PersistentSelenium.configure do |c|
c.port = options[:port]
@ -25,6 +30,11 @@ module PersistentSelenium
DRb.thread.join
end
desc "install", "Install Cucumber hook for using persistent selenium"
def install
directory '.', '.'
end
default_task :start
end
end

View File

@ -0,0 +1,11 @@
# get the driver ready for use
require 'persistent_selenium/driver'
# set it for all tests
# Capybara.default_driver = Capybara.javascript_driver = :persistent_selenium
#
# or, set it via the ENV, with it being the default
# Before do
# Capybara.default_driver = Capybara.javascript_driver = (ENV['DRIVER'] || 'persistent_selenium').to_sym
# end