Sha256: 5f9f21c715293112c609478846af5658514b69cf8a7a369dfba6a58c9e46af4f

Contents?: true

Size: 1.05 KB

Versions: 38

Compression:

Stored size: 1.05 KB

Contents

require "kontena/cli/stacks/remove_command"

describe Kontena::Cli::Stacks::RemoveCommand do

  include ClientHelpers

  describe '#execute' do
    it 'sends remove command to master' do
      allow(subject).to receive(:wait_stack_removal)
      expect(client).to receive(:delete).with('stacks/test-grid/test-stack')
      subject.run(['--force', 'test-stack'])
    end

    it 'waits until service is removed' do
      allow(client).to receive(:delete).with('stacks/test-grid/test-stack')
      expect(client).to receive(:get).with('stacks/test-grid/test-stack')
        .and_raise(Kontena::Errors::StandardError.new(404, 'Not Found'))
      subject.run(['--force', 'test-stack'])
    end

    it 'raises exception on server error' do
      expect(client).to receive(:delete).with('stacks/test-grid/test-stack')
      expect(client).to receive(:get).with('stacks/test-grid/test-stack')
        .and_raise(Kontena::Errors::StandardError.new(500, 'internal error'))
      expect{
        subject.run(['--force', 'test-stack'])
      }.to exit_with_error
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
kontena-cli-1.3.5 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.3.5.rc1 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.4.0.pre6 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.4.0.pre5 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.4.0.pre4 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.4.0.pre3 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.4.0.pre2 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.4.0.pre1 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.3.4 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.3.4.rc1 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.3.3 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.3.3.rc1 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.3.2 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.3.2.rc2 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.3.2.rc1 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.3.1 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.3.1.rc2 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.3.1.rc1 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.3.0 spec/kontena/cli/stacks/remove_command_spec.rb
kontena-cli-1.3.0.rc4 spec/kontena/cli/stacks/remove_command_spec.rb