Sha256: b92111769d55aceda3f59e39cef2b89321b7ca9ae556287eb2bebfd25704ad61

Contents?: true

Size: 1.08 KB

Versions: 53

Compression:

Stored size: 1.08 KB

Contents

require_relative "../../../spec_helper"
require "kontena/cli/services/unlink_command"

describe Kontena::Cli::Services::UnlinkCommand do

  include ClientHelpers

  describe '#execute' do
    before(:each) do
      allow(client).to receive(:get).and_return({
        'links' => [
          {'alias' => 'service-b', 'grid_service_id' => "grid/service-b"}
        ]
      })
    end

    it 'requires api url' do
      expect(subject).to receive(:require_api_url).once
      subject.run(['service-a', 'service-b'])
    end

    it 'requires token' do
      expect(subject).to receive(:require_token).and_return(token)
      subject.run(['service-a', 'service-b'])
    end

    it 'aborts if service is not linked' do
      allow(client).to receive(:get).and_return({
        'links' => []
      })
      expect {
        subject.run(['service-a', 'service-b'])
      }.to raise_error(SystemExit)
    end

    it 'sends link to master' do
      expect(client).to receive(:put).with(
        'services/test-grid/service-a', {links: []}
      )
      subject.run(['service-a', 'service-b'])
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
kontena-cli-0.16.3 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.16.3.rc1 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.16.2 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.16.2.rc1 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.16.1 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.16.1.rc3 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.16.1.rc2 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.16.1.rc1 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.16.0 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.16.0.rc3 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.16.0.rc2 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.16.0.rc1 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.16.0.pre9 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.16.0.pre8 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.16.0.pre7 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.16.0.pre6 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.15.5 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.15.5.rc2 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.15.5.rc1 spec/kontena/cli/services/unlink_command_spec.rb
kontena-cli-0.16.0.pre5 spec/kontena/cli/services/unlink_command_spec.rb