Class: Teaspoon::Drivers::PhantomjsDriver

Inherits:
Base
  • Object
show all
Includes:
Utility
Defined in:
lib/teaspoon/drivers/phantomjs_driver.rb

Instance Method Summary collapse

Methods included from Utility

#which

Constructor Details

#initialize(options = nil) ⇒ PhantomjsDriver

Returns a new instance of PhantomjsDriver.



12
13
14
15
16
17
18
19
20
# File 'lib/teaspoon/drivers/phantomjs_driver.rb', line 12

def initialize(options = nil)
  options ||= []
  case options
  when Array  then @options = options
  when String then @options = options.split(" ")
  when Hash   then @options = options.map { |k, v| "--#{k}=#{v}" }
  else raise Teaspoon::UnknownDriverOptions, "Unknown driver options -- supply a string, array or hash"
  end
end

Instance Method Details

#run_specs(runner, url) ⇒ Object



22
23
24
25
26
# File 'lib/teaspoon/drivers/phantomjs_driver.rb', line 22

def run_specs(runner, url)
  run(*driver_options(url)) do |line|
    runner.process(line) if line && line.strip != ""
  end
end