Sha256: bbfd328c1b1d6fa973c8ab1fa41cb5d80a1996ab764c8bc9b25934a5879dc6df

Contents?: true

Size: 1.31 KB

Versions: 82

Compression:

Stored size: 1.31 KB

Contents

require "spec_helper"

module CF
  module Start
    describe Logout do
      let(:client) { build(:client) }

      before do
        described_class.any_instance.stub(:client) { client }
      end

      describe "metadata" do
        let(:command) { Mothership.commands[:logout] }

        describe "command" do
          subject { command }
          its(:description) { should eq "Log out from the target" }
          it { expect(Mothership::Help.group(:start)).to include(subject) }
        end
      end

      describe "running the command" do
        subject { cf ["logout"] }

        context "when there is a target" do
          let(:info) { {client.target => "x", "abc" => "x"} }

          before do
            CF::CLI.any_instance.stub(:targets_info) { info }
            CF::CLI.any_instance.stub(:client_target) { client.target }
          end

          it "removes the target info from the tokens file" do
            expect {
              subject
            }.to change { info }.to("abc" => "x")
          end
        end

        context "when there is no target" do
          let(:client) { nil }
          it_behaves_like "an error that gets passed through",
            :with_exception => CF::UserError,
            :with_message => "Please select a target with 'cf target'."
        end
      end
    end
  end
end

Version data entries

82 entries across 82 versions & 1 rubygems

Version Path
cf-5.4.7 spec/cf/cli/start/logout_spec.rb
cf-5.4.7.rc1 spec/cf/cli/start/logout_spec.rb
cf-5.4.5 spec/cf/cli/start/logout_spec.rb
cf-5.4.4 spec/cf/cli/start/logout_spec.rb
cf-5.4.3 spec/cf/cli/start/logout_spec.rb
cf-5.4.2 spec/cf/cli/start/logout_spec.rb
cf-5.4.1 spec/cf/cli/start/logout_spec.rb
cf-5.4.1.rc1 spec/cf/cli/start/logout_spec.rb
cf-5.4.0 spec/cf/cli/start/logout_spec.rb
cf-5.3.1 spec/cf/cli/start/logout_spec.rb
cf-5.3.0 spec/cf/cli/start/logout_spec.rb
cf-5.2.2 spec/cf/cli/start/logout_spec.rb
cf-5.2.1.rc15 spec/cf/cli/start/logout_spec.rb
cf-5.2.1.rc14 spec/cf/cli/start/logout_spec.rb
cf-5.2.1.rc13 spec/cf/cli/start/logout_spec.rb
cf-5.2.1.rc12 spec/cf/cli/start/logout_spec.rb
cf-5.2.1.rc11 spec/cf/cli/start/logout_spec.rb
cf-5.2.1.rc10 spec/cf/cli/start/logout_spec.rb
cf-5.2.1.rc9 spec/cf/cli/start/logout_spec.rb
cf-5.2.1.rc8 spec/cf/cli/start/logout_spec.rb