Sha256: 5f2a7366e2b7df8141660451943ba049713033373ccb91f380f618ad6196873b

Contents?: true

Size: 804 Bytes

Versions: 24

Compression:

Stored size: 804 Bytes

Contents

require 'spec_helper'

describe Aptible::CLI::Agent do
  let(:token) { 'some-token' }
  let(:operation) { Fabricate(:operation) }

  before do
    allow(subject).to receive(:fetch_token).and_return(token)
  end

  describe '#operation:cancel' do
    it 'fails if the operation cannot be found' do
      expect(Aptible::Api::Operation).to receive(:find).with(1, token: token)
        .and_return(nil)

      expect { subject.send('operation:cancel', 1) }
        .to raise_error('Operation #1 not found')
    end

    it 'sets the cancelled flag on the operation' do
      expect(Aptible::Api::Operation).to receive(:find).with(1, token: token)
        .and_return(operation)

      expect(operation).to receive(:update!).with(cancelled: true)

      subject.send('operation:cancel', 1)
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
aptible-cli-0.19.3 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.19.2 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.19.1 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.19.0 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.18.3 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.18.2 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.18.1 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.18.0 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.17.2 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.17.1 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.17.0 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.16.9 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.16.8 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.16.7 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.16.6 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.16.5 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.16.4 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.16.3 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.16.2 spec/aptible/cli/subcommands/operation_spec.rb
aptible-cli-0.16.1 spec/aptible/cli/subcommands/operation_spec.rb