Sha256: 097c87b0c3e2c90c6bffa5e1411103453981ee6a6dec4c4b896ffd2853ab2cf4

Contents?: true

Size: 895 Bytes

Versions: 62

Compression:

Stored size: 895 Bytes

Contents

require_relative "../../../spec_helper"
require 'kontena/cli/cloud/logout_command'

describe Kontena::Cli::Cloud::LogoutCommand do

  include ClientHelpers

  let(:account) do
    spy
  end

  let(:subject) do
    described_class.new(File.basename($0))
  end

  describe '#logout' do
    before(:each) do
      allow(Kontena::Cli::Config.instance).to receive(:accounts).and_return([account])
    end

    it 'reads accounts from config' do
      expect(Kontena::Cli::Config.instance).to receive(:accounts).and_return([account])
      subject.run([])
    end

    it 'invalidates refresh_token' do
      expect(subject).to receive(:use_refresh_token).with(account)
      subject.run([])
    end

    it 'writes config file' do
      allow(subject).to receive(:use_refresh_token).with(account)
      expect(Kontena::Cli::Config.instance).to receive(:write)
      subject.run([])
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
kontena-cli-1.1.6 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.1.5 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.1.5.rc3 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.1.5.rc2 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.1.5.rc1 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.1.4 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.1.3 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.1.2 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.1.2.rc2 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.1.2.rc1 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.1.1 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.1.1.rc1 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.1.0 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.1.0.rc2 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.1.0.rc1 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.1.0.pre1 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.0.6 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.0.6.rc1 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.0.5 spec/kontena/cli/cloud/logout_command_spec.rb
kontena-cli-1.0.5.rc1 spec/kontena/cli/cloud/logout_command_spec.rb