Sha256: a70b178cb9378e7de07028b8e5111ae6202b37b7816d81913d317c81bffb990e

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

module WatirSplash
  # class for common functionality
  class Util
    class << self

      # configure RSpec to use documentation and WatirSplash::HtmlFormatter formatters
      def configure_rspec_formatters
        config = RSpec.configuration
        config.color_enabled = true
        results_path = ENV["WATIRSPLASH_RESULTS_PATH"] || "results/index.html"
        @@html_formatter = WatirSplash::HtmlFormatter.new(results_path)
        config.formatters.unshift(@@html_formatter)
        config.add_formatter(:documentation)
      end

      def formatter
        @@html_formatter
      end

      @@framework = nil

      def framework= framework
        framework = framework.to_sym
        @@framework = framework == :default ? default_framework : framework.to_sym
      end

      def framework
        @@framework
      end

      def load_framework
        self.framework = ENV["WATIRSPLASH_FRAMEWORK"] || framework || default_framework
        require "watirsplash/frameworks/#{framework}"
      end

      private

      def default_framework
        case RUBY_PLATFORM
        when /mswin|msys|mingw32/
          :watir
        when /darwin|linux/
          :firewatir
        else
          raise "Unsupported platform: #{RUBY_PLATFORM}"
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
watirsplash-2.0.0.rc1 lib/watirsplash/util.rb