Sha256: 92831ae678941371b504afad002a8e70a7da23668cd5c6fef6b07085182ba8d2

Contents?: true

Size: 1.26 KB

Versions: 4

Compression:

Stored size: 1.26 KB

Contents

require File.expand_path("../helper", __FILE__)

class TestConnect < Test::Unit::TestCase
  def test_running_when_ready
    connect = Sauce::Connect.new(:host => "saucelabs.com", :port => 80)
    assert_equal "uninitialized", connect.status
    connect.wait_until_ready
    assert_equal "running", connect.status 
    connect.disconnect
  end

  def test_error_flag
    connect = Sauce::Connect.new(:host => "saucelabs.com", :port => 80, :username => 'fail')
    start = Time.now
    while Time.now-start < 20 && !connect.error
      sleep 1
    end

    assert connect.error
    connect.disconnect
  end

  def test_fails_fast_with_no_username
    Sauce.config {|c| c.username = nil; c.access_key = nil}
    username = ENV['SAUCE_USERNAME']
    access_key = ENV['SAUCE_ACCESS_KEY']

    begin
      ENV['SAUCE_USERNAME'] = nil
      assert_raises ArgumentError do
        connect = Sauce::Connect.new(:host => "saucelabs.com", :port => 80)
      end

      ENV['SAUCE_USERNAME'] = username
      ENV['SAUCE_ACCESS_KEY'] = nil
      assert_raises ArgumentError do
        connect = Sauce::Connect.new(:host => "saucelabs.com", :port => 80)
      end
    ensure
      ENV['SAUCE_USERNAME'] = username
      ENV['SAUCE_ACCESS_KEY'] = access_key
      Sauce.config {|c|}
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sauce-1.0.2 test/test_connect.rb
sauce-1.0.1 test/test_connect.rb
sauce-1.0.0 test/test_connect.rb
sauce-0.20.0 test/test_connect.rb