Sha256: 91caa5293b813abe7db3b37df8c0b620a42b41ecc025ec359720c738bb3a4570
Contents?: true
Size: 1.74 KB
Versions: 2
Compression:
Stored size: 1.74 KB
Contents
# encoding: utf-8 module WatirSpec module SpecHelper module BrowserHelper def browser; @browser; end end module PersistentBrowserHelper def browser; $browser; end end module MessagesHelper def messages browser.div(:id, 'messages').divs.map { |d| d.text } end end module_function def execute load_requires start_server configure add_guard_hook end def configure Thread.abort_on_exception = true Spec::Runner.configure do |config| config.include(MessagesHelper) if WatirSpec.persistent_browser == false config.include(BrowserHelper) config.before(:all) { @browser = WatirSpec.new_browser } config.after(:all) { @browser.close if @browser } else config.include(PersistentBrowserHelper) $browser = WatirSpec.new_browser at_exit { $browser.close } end end end def load_requires # load spec_helper from containing folder, if it exists hook = File.expand_path("../../spec_helper.rb", File.dirname(__FILE__)) raise(Errno::ENOENT, hook) unless File.exist?(hook) load hook require "fileutils" require "spec" begin require "ruby-debug" Debugger.start Debugger.settings[:autoeval] = true Debugger.settings[:autolist] = 1 rescue LoadError end end def start_server if WatirSpec::Server.should_run? WatirSpec::Server.run_async else $stderr.puts "not running WatirSpec::Server" end end def add_guard_hook return if WatirSpec.unguarded? at_exit { WatirSpec::Guards.report } end end # SpecHelper end # WatirSpec
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
watir-webdriver-0.1.1 | spec/watirspec/lib/spec_helper.rb |
watir-webdriver-0.1.0 | spec/watirspec/lib/spec_helper.rb |