Sha256: d6fe2ef379694b4c22847260c8e050595425f38c1e61af6314728022c5adaf9e

Contents?: true

Size: 996 Bytes

Versions: 10

Compression:

Stored size: 996 Bytes

Contents

# -*- coding: utf-8 -*-

# TODO
#   You need to set the OPERA_LAUNCHER and OPERA_PATH environment variables
#   for this Helper to work.

require 'operawatir'
require 'rspec'
require 'rbconfig'

module OperaWatir::Helper
  extend self

  def settings
    OperaWatir::Browser.settings
  end

  def browser
    @browser ||= OperaWatir::Browser.new
  end

  def configure_rspec!
    RSpec.configure do |config|

      # Set every RSpec option
      settings.each do |key, value|
        config.send("#{key}=", value) if config.respond_to?("#{key}=")
      end

      config.include SpecHelpers

      config.after(:suite) do
        browser.quit if @browser
        abort
      end
    end
  end

  def run!(settings={})
    OperaWatir::Browser.settings = settings
    configure_rspec!
    RSpec::Core::Runner.autorun
  end

private

  module SpecHelpers
    def browser
      OperaWatir::Helper.browser
    end

    def window
      browser.active_window
    end
  end
end

OperaWatir::Helper.run!

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
operawatir-0.7.pre4-jruby lib/operawatir/helper.rb
operawatir-0.7.pre3-jruby lib/operawatir/helper.rb
operawatir-0.7.pre2-jruby lib/operawatir/helper.rb
operawatir-0.7.pre1-jruby lib/operawatir/helper.rb
operawatir-0.6.pre1-jruby lib/operawatir/helper.rb
operawatir-0.5.1-jruby lib/operawatir/helper.rb
operawatir-0.5-jruby lib/operawatir/helper.rb
operawatir-0.5.pre3-jruby lib/operawatir/helper.rb
operawatir-0.5.pre2-jruby lib/operawatir/helper.rb
operawatir-0.5.pre1-jruby lib/operawatir/helper.rb