Sha256: 82b29032444d376594b6ead3933cfe430c9f3034b90a4f0de158d9d6c3bdb0c6

Contents?: true

Size: 1017 Bytes

Versions: 84

Compression:

Stored size: 1017 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(Travis::Tools::Github.any_instance).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

84 entries across 84 versions & 2 rubygems

Version Path
travis-1.8.11.travis.1022.11 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1021.11 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1020.11 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1012.9 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1011.9 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1010.9 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1009.9 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1008.9 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1007.9 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1004.9 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1003.9 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1002.9 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1001.9 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1000.9 spec/client/auto_login_spec.rb
travis-1.8.11.travis.998.9 spec/client/auto_login_spec.rb
travis-1.8.10.travis.997.9 spec/client/auto_login_spec.rb
travis-1.8.10 spec/client/auto_login_spec.rb
travis-1.8.10.travis.994.9 spec/client/auto_login_spec.rb
travis-1.8.10.travis.953.11 spec/client/auto_login_spec.rb
travis-akerl-1.8.9.1 spec/client/auto_login_spec.rb