Sha256: e38236c060efe609cbf4645480b49eac38d39c4148638175bc7c325b5bc8b827

Contents?: true

Size: 724 Bytes

Versions: 11

Compression:

Stored size: 724 Bytes

Contents

require 'kontena/cli/grids/remove_command'

describe Kontena::Cli::Grids::RemoveCommand do
  include ClientHelpers

  before do
    # Kontena::Cli::Grids::Common#grids
    allow(client).to receive(:get).with('grids').and_return('grids' => grids)
  end

  context 'without any grids' do
    let(:grids) { [] }

    it 'errors out' do
      expect{subject.run ['--force', 'test-grid']}.to exit_with_error.and output(/Could not resolve grid by name/).to_stderr
    end
  end

  context 'with a grid' do
    let(:grids) { [{'id' => 'test-grid', 'name' => 'test-grid'}] }

    it 'deletes the grid' do
      expect(client).to receive(:delete).with('grids/test-grid')

      subject.run ['--force', 'test-grid']
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
kontena-cli-1.5.4 spec/kontena/cli/grids/remove_command_spec.rb
kontena-cli-1.5.4.rc1 spec/kontena/cli/grids/remove_command_spec.rb
kontena-cli-1.5.3 spec/kontena/cli/grids/remove_command_spec.rb
kontena-cli-1.5.2 spec/kontena/cli/grids/remove_command_spec.rb
kontena-cli-1.5.1 spec/kontena/cli/grids/remove_command_spec.rb
kontena-cli-1.5.0 spec/kontena/cli/grids/remove_command_spec.rb
kontena-cli-1.5.0.rc1 spec/kontena/cli/grids/remove_command_spec.rb
kontena-cli-1.5.0.pre5 spec/kontena/cli/grids/remove_command_spec.rb
kontena-cli-1.5.0.pre4 spec/kontena/cli/grids/remove_command_spec.rb
kontena-cli-1.5.0.pre3 spec/kontena/cli/grids/remove_command_spec.rb
kontena-cli-1.5.0.pre2 spec/kontena/cli/grids/remove_command_spec.rb