Sha256: bfe601c29cb07ed2dde3e919916d9b9d032c859fcaad729fbf7f9ddb1ffa7eef

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

# encoding: utf-8
$LOAD_PATH.unshift File.dirname(__FILE__)
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'rspec'

require 'guards'
require 'server'

require 'operawatir/helper'

OperaWatir.api = 2

RSpec.configure do |config|
  config.mock_with :rr
end

module WatirSpec
  extend self

  attr_accessor :args, :guarded

  def host
    "http://#{Server.bind}:#{Server.port}"
  end
  alias_method :files, :host

  def guards
    @guards ||= []
  end

  def guarded?
    !!@guarded
  end

  module Helpers
    def browser
      OperaWatir::Helper.browser
    end

    def window
      browser.active_window
    end

    def fixture(*paths)
      [WatirSpec.host, *paths].join('/')
    end
  end

end

include WatirSpec::Guard::Helpers

RSpec.configure do |config|
  config.include WatirSpec::Helpers

  config.before(:suite) do
    #Thread.new { WatirSpec::Server.run! }
    #Thread.new { WatirSpec::Server.start }
    if WatirSpec::Server.should_run?
      WatirSpec::Server.run_async
      else
        $stderr.puts 'not running WatirSpec::Server'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
operawatir-0.7.pre4-jruby spec/operawatir/watirspec_helper.rb
operawatir-0.7.pre3-jruby spec/operawatir/watirspec_helper.rb
operawatir-0.7.pre2-jruby spec/operawatir/watirspec_helper.rb
operawatir-0.7.pre1-jruby spec/operawatir/watirspec_helper.rb