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.14.travis.1195.9 spec/client/auto_login_spec.rb
travis-1.8.14.travis.1192.9 spec/client/auto_login_spec.rb
travis-1.8.14.travis.1186.9 spec/client/auto_login_spec.rb
travis-1.8.14.travis.1184.9 spec/client/auto_login_spec.rb
travis-1.8.14.travis.1183.9 spec/client/auto_login_spec.rb
travis-1.8.14.travis.1178.9 spec/client/auto_login_spec.rb
travis-1.8.14.travis.1175.9 spec/client/auto_login_spec.rb
travis-1.8.14.travis.1172.9 spec/client/auto_login_spec.rb
travis-1.8.14.travis.1164.9 spec/client/auto_login_spec.rb
travis-1.8.14.travis.1163.9 spec/client/auto_login_spec.rb
travis-1.8.14.travis.1162.9 spec/client/auto_login_spec.rb
travis-1.8.14.travis.1160.9 spec/client/auto_login_spec.rb
travis-1.8.13 spec/client/auto_login_spec.rb
travis-1.8.14.travis.1156.9 spec/client/auto_login_spec.rb
travis-1.8.14.travis.1155.9 spec/client/auto_login_spec.rb
travis-1.8.13.travis.1152.9 spec/client/auto_login_spec.rb
travis-1.8.13.travis.1148.9 spec/client/auto_login_spec.rb
travis-1.8.12 spec/client/auto_login_spec.rb
travis-1.8.13.travis.1141.9 spec/client/auto_login_spec.rb
travis-1.8.12.travis.1136.9 spec/client/auto_login_spec.rb