Sha256: 6358ca78fe4eac3b2b5ca73925bfee5e4c077a403a86308ea7dfbbada33e3cb5

Contents?: true

Size: 1.86 KB

Versions: 3

Compression:

Stored size: 1.86 KB

Contents

require "spec_helper"

describe SauceWhisk do
  describe "##base_url" do
    subject {SauceWhisk.base_url}
    it {should eq "https://saucelabs.com/rest/v1"}

  end

  describe "##username" do
    subject {SauceWhisk.username}
    it {should eq ENV["SAUCE_USERNAME"]}
  end

  describe "##password" do
    subject {SauceWhisk.password}
    it {should eq ENV["SAUCE_ACCESS_KEY"]}
  end

  describe "##pass_job" do
    it "should call #pass on the jobs object" do
      job_id = "0418999"
      expect( SauceWhisk::Jobs ).to receive(:pass_job).with(job_id) {true}
      SauceWhisk.pass_job job_id
    end
  end

  describe "##logger" do
    it "accepts a logger object" do
      dummy_logger = Object.new do
        def puts(input)
        end
      end
      SauceWhisk.logger = dummy_logger
      expect( SauceWhisk.logger ).to be dummy_logger
    end

    it "defaults to STDOUT" do
      SauceWhisk.logger = nil
      expect( SauceWhisk.logger ).to be_a_kind_of Logger
    end
  end

  describe "##asset_fetch_retries" do
    it "tries to read from Sauce.config" do
      SauceWhisk.instance_variable_set(:@asset_fetch_retries, nil)
      mock_config = Class.new(Hash) do
        def initialize
          self.store(:asset_fetch_retries, 3)
        end
      end

      stub_const "::Sauce::Config", mock_config
      expect( SauceWhisk.asset_fetch_retries ).to equal 3
    end
  end

  describe "##rest_retries" do
    it "defaults to 1" do
      SauceWhisk.instance_variable_set(:@rest_retries, nil)
      expect( SauceWhisk.rest_retries ).to equal 1
    end

    it "tries to read from Sauce.config" do
      SauceWhisk.instance_variable_set(:@rest_retries, nil)
      mock_config = Class.new(Hash) do
        def initialize
          self.store(:rest_retries, 3)
        end
      end

      stub_const "::Sauce::Config", mock_config
      expect( SauceWhisk.rest_retries ).to equal 3
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sauce_whisk-0.0.16 spec/lib/sauce_whisk/sauce_whisk_spec.rb
sauce_whisk-0.0.15 spec/lib/sauce_whisk/sauce_whisk_spec.rb
sauce_whisk-0.0.14 spec/lib/sauce_whisk/sauce_whisk_spec.rb