Sha256: 2ce59efebb53bdda1749d495db7516b6aa1cdfb440e423886cc1b9e2efd68d94

Contents?: true

Size: 1.7 KB

Versions: 7

Compression:

Stored size: 1.7 KB

Contents

# encoding: utf-8
module WatirSpec
  class << self
    attr_accessor :browser_args, :persistent_browser, :unguarded, :implementation

    def html
      File.expand_path("#{File.dirname(__FILE__)}/../html")
    end

    def files
      "file://#{html}"
    end

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

    def unguarded?
      @unguarded ||= false
    end

    def platform
      @platform ||= case RUBY_PLATFORM
                    when /java/
                      :java
                    when /mswin|msys|mingw32/
                      :windows
                    when /darwin/
                      :macosx
                    when /linux/
                      :linux
                    else
                      RUBY_PLATFORM
                    end
    end

    def implementation
      @implementation ||= case Browser.name
                          when "Watir::IE"
                            :watir
                          when "Watir::Firefox", "FireWatir::Firefox"
                            :firewatir
                          when "Celerity::Browser"
                            :celerity
                          else
                            :unknown
                          end
    end

    def new_browser
      args = WatirSpec.browser_args
      args ? Browser.new(*args) : Browser.new
    end

    def ruby
      if @ruby.nil?
        if defined?(Gem)
          @ruby = Gem.ruby
        else
          require "rbconfig"
          rb = File.join(RbConfig::CONFIG.values_at('BINDIR', 'RUBY_INSTALL_NAME').compact)
          ext = RbConfig::CONFIG['EXEEXT']

          @ruby = "#{rb}#{ext}"
        end
      end

      @ruby
    end

  end # class << WatirSpec
end # WatirSpec

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
watir-webdriver-0.0.6 spec/watirspec/lib/watirspec.rb
watir-webdriver-0.0.5 spec/watirspec/lib/watirspec.rb
watir-webdriver-0.0.4 spec/watirspec/lib/watirspec.rb
watir-webdriver-0.0.3 spec/watirspec/lib/watirspec.rb
watir-webdriver-0.0.2 spec/watirspec/lib/watirspec.rb
watir-webdriver-0.0.1 spec/watirspec/lib/watirspec.rb
watir-webdriver-0.0.1.dev7 spec/watirspec/lib/watirspec.rb