module WatirSpec

Attributes

browser_args[RW]
unguarded[RW]

Public Class Methods

host() click to toggle source
# File lib/watirspec.rb, line 24
def host
  @host ||= "http://#{Server.bind}:#{Server.port}"
end
htmls() click to toggle source
# File lib/watirspec.rb, line 11
def htmls
  @htmls ||= [File.expand_path('../spec/watirspec/html', __dir__)]
end
implementation() { |imp| ... } click to toggle source
# File lib/watirspec.rb, line 39
def implementation
  @implementation ||= begin
    imp = WatirSpec::Implementation.new
    yield imp if block_given?

    imp
  end
end
implementation=(imp) click to toggle source
# File lib/watirspec.rb, line 48
def implementation=(imp)
  unless imp.is_a?(WatirSpec::Implementation)
    raise TypeError, "expected WatirSpec::Implementation, got #{imp.class}"
  end

  @implementation = imp
end
load_support() click to toggle source
# File lib/watirspec.rb, line 32
def load_support
  root = File.expand_path('../spec/watirspec', __dir__)
  Dir.glob("#{root}/support/**/*.rb").sort.each do |file|
    require file
  end
end
new_browser() click to toggle source
# File lib/watirspec.rb, line 56
def new_browser
  klass = WatirSpec.implementation.browser_class
  args = Array(WatirSpec.implementation.browser_args).map { |e| e.is_a?(Hash) ? e.dup : e }

  instance = klass.new(*args)
  print_browser_info_once(instance)

  instance
end
run!() click to toggle source
# File lib/watirspec.rb, line 15
def run!
  load_support
  WatirSpec::Runner.execute_if_necessary
end
unguarded?() click to toggle source
# File lib/watirspec.rb, line 28
def unguarded?
  @unguarded ||= false
end
url_for(str) click to toggle source
# File lib/watirspec.rb, line 20
def url_for(str)
  File.join(host, str)
end

Private Class Methods

print_browser_info_once(instance) click to toggle source