Sha256: af07947853b8f6e08905b0f2f31c29aa6d942b62e2aebdfea8e04ea42906941c

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 KB

Contents

# Encoding: utf-8

require 'spec_helper'
require 'selenium_connect/configuration'

describe SeleniumConnect::Configuration do

  VALID_JAR = 'test.jar'
  VALID_HOST = '111.000.111.000'
  VALID_SAUCE_USERNAME = 'test_user_name'

  before :each do
    @configuration = SeleniumConnect::Configuration.new
  end

  it 'can recieve a simple hash of options on initialization' do
    config = SeleniumConnect::Configuration.new host: 'newhost'
    config.host.should == 'newhost'
  end

  it 'can be populated by a hash' do
    @configuration.populate_with_hash jar: VALID_JAR, host: VALID_HOST
    @configuration.jar.should eq VALID_JAR
    @configuration.host.should eq VALID_HOST
  end

  it 'can be populated with a yaml file' do
    @configuration.populate_with_yaml "#{ENV['SUPPORT_PATH']}/example.yaml"
    @configuration.sauce_username.should eq VALID_SAUCE_USERNAME
  end

  it 'supports the config_file= method' do
    @configuration.config_file= "#{ENV['SUPPORT_PATH']}/example.yaml"
    @configuration.sauce_username.should eq VALID_SAUCE_USERNAME
  end

  it 'should throw an exception for unsupported config variable' do
    expect do
      @configuration.populate_with_hash  bad: 'config-value'
    end.to raise_error ArgumentError, 'The config key: "bad" is unknown!'
  end

  it 'sensible defaults persist when nothing is set' do
    @configuration.host.should eq     'localhost'
    @configuration.port.should eq     4444
    @configuration.browser.should eq  'firefox'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
selenium-connect-3.2.0 spec/unit/lib/selenium_connect/configuration_spec.rb
selenium-connect-3.1.2 spec/unit/lib/selenium_connect/configuration_spec.rb
selenium-connect-3.1.1 spec/unit/lib/selenium_connect/configuration_spec.rb
selenium-connect-3.1.0 spec/unit/lib/selenium_connect/configuration_spec.rb
selenium-connect-3.0.0 spec/unit/lib/selenium_connect/configuration_spec.rb