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.12.travis.1135.9 spec/client/auto_login_spec.rb
travis-1.8.12.travis.1125.9 spec/client/auto_login_spec.rb
travis-1.8.12.pre.rc1 spec/client/auto_login_spec.rb
travis-1.8.12.travis.1116.9 spec/client/auto_login_spec.rb
travis-1.8.12.travis.1111.9 spec/client/auto_login_spec.rb
travis-1.8.12.travis.1101.9 spec/client/auto_login_spec.rb
travis-1.8.11 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1098.9 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1081.9 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1059.11 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1058.11 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1056.11 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1051.11 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1048.11 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1044.11 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1041.11 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1040.11 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1026.11 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1025.11 spec/client/auto_login_spec.rb
travis-1.8.11.travis.1024.11 spec/client/auto_login_spec.rb