Sha256: 72e86af7089d994f4c0b5bfe5cdd5617c02c6f8317fae920d440ff492831809f

Contents?: true

Size: 1020 Bytes

Versions: 35

Compression:

Stored size: 1020 Bytes

Contents

require 'travis/client/auto_login'
require 'spec_helper'

describe Travis::Client::AutoLogin do
  let(:auto_login_with_token) { Travis::Client::AutoLogin.new(Travis::Client.new, { config_file: travis_config }) }
  let(:auto_login_without_token) { Travis::Client::AutoLogin.new(Travis::Client.new) }
  let(:travis_config) { File.expand_path("../support/fake_travis_config.yml", File.dirname(__FILE__)) }

  context "authenticate" do
    context "when user has a token in cli config" do
      it "does not call Tools::Github#with_token" do
        expect_any_instance_of(Travis::Tools::Github).to_not receive(:with_token)
        auto_login_with_token.authenticate
      end
    end

    context "when user does not have a token in cli config" do
      before { auto_login_without_token.github.stub(:with_token).and_return(true) }
      it "calls Tools::Github#with_token" do
        expect(auto_login_without_token.github).to receive(:with_token)
        auto_login_without_token.authenticate
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
travis-1.11.1 spec/client/auto_login_spec.rb
travis-1.11.0 spec/client/auto_login_spec.rb
travis-1.10.1.travis.1341.9 spec/client/auto_login_spec.rb
travis-1.10.1.travis.1321.9 spec/client/auto_login_spec.rb
travis-1.10.1.travis.1312.9 spec/client/auto_login_spec.rb
travis-1.10.1.travis.1311.9 spec/client/auto_login_spec.rb
travis-1.10.1.travis.1305.9 spec/client/auto_login_spec.rb
travis-1.10.0 spec/client/auto_login_spec.rb
travis-1.9.2.travis.1304.9 spec/client/auto_login_spec.rb
travis-1.9.2.travis.1303.9 spec/client/auto_login_spec.rb
travis-1.10.0.pre.rc4 spec/client/auto_login_spec.rb
travis-1.10.0.pre.rc3 spec/client/auto_login_spec.rb
travis-1.10.0.pre.rc2 spec/client/auto_login_spec.rb
travis-1.9.2.travis.1288.9 spec/client/auto_login_spec.rb
travis-1.9.2.travis.1285.9 spec/client/auto_login_spec.rb
travis-1.9.2.travis.1279.9 spec/client/auto_login_spec.rb
travis-1.10.0.pre.rc1 spec/client/auto_login_spec.rb
travis-1.9.2.travis.1254.9 spec/client/auto_login_spec.rb
travis-1.9.2.travis.1236.9 spec/client/auto_login_spec.rb
travis-1.9.2.travis.1224.9 spec/client/auto_login_spec.rb