Sha256: 1a6d73810c0034b3630897a94a698539ca6d9223d4323c018ac16a6c615ff3a5

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

module SeleniumConnect
  class Configuration
    #Selenium Server
    attr_accessor :host, :port, :version,
                  :background, :log, :jar

    #Browsers
    attr_accessor :browser, :browser_path,
                  :profile_path, :profile_name

    #SauceLabs
    attr_accessor :sauce_username, :sauce_api_key,
                  :os, :browser_version, :description

    def config_file=(file)
      set_config_values_from_file(get_config_values_from_file(file))
    end

    private

    def initialize
      defaults
    end

    def defaults
      @host     = 'localhost' unless host
      @port     = 4444        unless port
      @browser  = 'firefox'   unless browser
    end

    def get_config_values_from_file(file)
      require 'yaml'
      YAML.load_file(file)
    end

    def set_config_values_from_file(config_file_values)
      config_file_values.each do |config_parameter, config_value|
        instance_variable_set("@#{config_parameter}", config_value)
      end
      defaults
    end

  end #Configuration
end #SeleniumConnect

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
selenium-connect-2.0.0 lib/selenium-connect/configuration.rb
selenium-connect-1.9.3 lib/selenium-connect/configuration.rb
selenium-connect-1.9.1 lib/selenium-connect/configuration.rb