Sha256: 76f579b1274216e86a39ae39d4e72f976645c92a8ccd75eb25faa21efbd7f37f

Contents?: true

Size: 908 Bytes

Versions: 6

Compression:

Stored size: 908 Bytes

Contents

require 'spec_helper'

describe Aptible::CLI::Agent do
  before { subject.stub(:ask) }
  before { subject.stub(:save_token) }
  before { subject.stub(:fetch_token) { double 'token' } }

  let!(:app) { Fabricate(:app, handle: 'foobar') }
  let!(:service) { Fabricate(:service, app: app) }

  describe '#logs' do
    before { allow(Aptible::Api::Account).to receive(:all) { [app.account] } }
    before { allow(Aptible::Api::App).to receive(:all) { [app] } }
    before { subject.options = { app: app.handle } }

    it 'should fail if the app is unprovisioned' do
      app.status = 'pending'
      expect { subject.send('logs') }
        .to raise_error(Thor::Error, /Have you deployed foobar yet/)
    end

    it 'should fail if the app has no services' do
      app.services = []
      expect { subject.send('logs') }
        .to raise_error(Thor::Error, /Have you deployed foobar yet/)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
aptible-cli-0.7.5 spec/aptible/cli/subcommands/logs_spec.rb
aptible-cli-0.7.4 spec/aptible/cli/subcommands/logs_spec.rb
aptible-cli-0.7.3 spec/aptible/cli/subcommands/logs_spec.rb
aptible-cli-0.7.2 spec/aptible/cli/subcommands/logs_spec.rb
aptible-cli-0.7.1 spec/aptible/cli/subcommands/logs_spec.rb
aptible-cli-0.7.0 spec/aptible/cli/subcommands/logs_spec.rb