Sha256: 3b94e6e0e3febf99db8ef5d90268254cb54cc1f887130324c9868af30c0255bc

Contents?: true

Size: 1.63 KB

Versions: 30

Compression:

Stored size: 1.63 KB

Contents

require 'spec_helper'

describe Aptible::CLI::Agent do
  let(:token) { double 'token' }
  let(:app) { Fabricate(:app) }

  before do
    allow(subject).to receive(:fetch_token) { token }
    allow(Aptible::Api::App).to receive(:all).with(token: token)
      .and_return([app])
    allow(subject).to receive(:options).and_return(app: app.handle)
  end

  it 'lists a CMD service' do
    Fabricate(:service, app: app, process_type: 'cmd', command: nil)
    subject.send('services')

    expect(captured_output_text.split("\n")).to include('Service: cmd')
    expect(captured_output_text.split("\n")).to include('Command: CMD')
  end

  it 'lists a service with command' do
    Fabricate(:service, app: app, process_type: 'cmd', command: 'foobar')
    subject.send('services')

    expect(captured_output_text.split("\n")).to include('Service: cmd')
    expect(captured_output_text.split("\n")).to include('Command: foobar')
  end

  it 'lists container size' do
    Fabricate(:service, app: app, container_memory_limit_mb: 1024)
    subject.send('services')

    expect(captured_output_text.split("\n")).to include('Container Size: 1024')
  end

  it 'lists container count' do
    Fabricate(:service, app: app, container_count: 3)
    subject.send('services')

    expect(captured_output_text.split("\n")).to include('Container Count: 3')
  end

  it 'lists multiple services' do
    Fabricate(:service, app: app, process_type: 'foo')
    Fabricate(:service, app: app, process_type: 'bar')
    subject.send('services')

    expect(captured_output_text.split("\n")).to include('Service: foo')
    expect(captured_output_text.split("\n")).to include('Service: bar')
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
aptible-cli-0.21.0 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.20.0 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.19.9 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.19.7 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.19.6 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.19.4 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.19.3 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.19.2 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.19.1 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.19.0 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.18.3 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.18.2 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.18.1 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.18.0 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.17.2 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.17.1 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.17.0 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.16.9 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.16.8 spec/aptible/cli/subcommands/services_spec.rb
aptible-cli-0.16.7 spec/aptible/cli/subcommands/services_spec.rb