Class: Teaspoon::Driver::Phantomjs

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

Instance Method Summary collapse

Methods included from Utility

#which

Constructor Details

#initialize(options = nil) ⇒ Phantomjs

Returns a new instance of Phantomjs.



16
17
18
19
20
21
22
23
24
# File 'lib/teaspoon/driver/phantomjs.rb', line 16

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::DriverOptionsError.new(types: "string, array or hash")
  end
end

Instance Method Details

#run_specs(runner, url) ⇒ Object



26
27
28
29
30
# File 'lib/teaspoon/driver/phantomjs.rb', line 26

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