Sha256: 55c4fdcfac36e31be8c6680cc2461c03307c33f0b251bf2adbdf27b704e4492c

Contents?: true

Size: 951 Bytes

Versions: 17

Compression:

Stored size: 951 Bytes

Contents

require 'ostruct'
require 'spec_helper'

class App < OpenStruct
end

class Account < OpenStruct
end

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

  let(:account) do
    Account.new(bastion_host: 'bastion.com', dumptruck_port: 45022)
  end
  let(:app) { App.new(handle: 'hello', account: account) }

  describe '#ps' do
    it 'should set ENV["APTIBLE_CLI_COMMAND"]' do
      expect(subject).to receive(:set_env).with('APTIBLE_CLI_COMMAND', 'ps')
      subject.send('ps')
    end

    it 'should construct a proper SSH call' do
      expect(Kernel).to receive(:exec) do |*args|
        cmd = args.first
        expect(cmd).to match(/ssh.*-p 45022 root@bastion.com/)
      end
      subject.send('ps')
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
aptible-cli-0.6.9 spec/aptible/cli/subcommands/ps_spec.rb
aptible-cli-0.6.8 spec/aptible/cli/subcommands/ps_spec.rb
aptible-cli-0.6.7 spec/aptible/cli/subcommands/ps_spec.rb
aptible-cli-0.6.6 spec/aptible/cli/subcommands/ps_spec.rb
aptible-cli-0.6.4 spec/aptible/cli/subcommands/ps_spec.rb
aptible-cli-0.6.3 spec/aptible/cli/subcommands/ps_spec.rb
aptible-cli-0.6.2 spec/aptible/cli/subcommands/ps_spec.rb
aptible-cli-0.6.1 spec/aptible/cli/subcommands/ps_spec.rb
aptible-cli-0.6.0 spec/aptible/cli/subcommands/ps_spec.rb
aptible-cli-0.5.15 spec/aptible/cli/subcommands/ps_spec.rb
aptible-cli-0.5.14 spec/aptible/cli/subcommands/ps_spec.rb
aptible-cli-0.5.13 spec/aptible/cli/subcommands/ps_spec.rb
aptible-cli-0.5.12 spec/aptible/cli/subcommands/ps_spec.rb
aptible-cli-0.5.11 spec/aptible/cli/subcommands/ps_spec.rb
aptible-cli-0.5.10 spec/aptible/cli/subcommands/ps_spec.rb
aptible-cli-0.5.9 spec/aptible/cli/subcommands/ps_spec.rb
aptible-cli-0.5.8 spec/aptible/cli/subcommands/ps_spec.rb