Sha256: e6d1cb8de834cc3c0507edad10ed22684d16fcc2f2909f8df3e72f76a81c2da0
Contents?: true
Size: 1.83 KB
Versions: 2
Compression:
Stored size: 1.83 KB
Contents
require 'ostruct' require 'spec_helper' class App < OpenStruct end class Service < OpenStruct end class Operation < OpenStruct end class Vhost < OpenStruct end describe Aptible::CLI::Agent do before { subject.stub(:ask) } before { subject.stub(:save_token) } before { subject.stub(:fetch_token) { double 'token' } } let(:service) { Service.new(process_type: 'web') } let(:op) { Operation.new(status: 'succeeded') } let(:app) { App.new(handle: 'hello', services: [service]) } let(:apps) { [app] } let(:vhost1) { Vhost.new(virtual_domain: 'domain1', external_host: 'host1') } let(:vhost2) { Vhost.new(virtual_domain: 'domain2', external_host: 'host2') } describe '#domains' do it 'should print out the hostnames' do allow(service).to receive(:create_operation) { op } allow(subject).to receive(:options) { { app: 'hello' } } allow(Aptible::Api::App).to receive(:all) { apps } expect(app).to receive(:vhosts) { [vhost1, vhost2] } expect(subject).to receive(:say).with('domain1') expect(subject).to receive(:say).with('domain2') subject.send('domains') end it 'should fail if app is non-existent' do allow(service).to receive(:create_operation) { op } allow(Aptible::Api::App).to receive(:all) { apps } expect do subject.send('domains') end.to raise_error(Thor::Error) end it 'should print hostnames if -v is passed' do allow(service).to receive(:create_operation) { op } allow(subject).to receive(:options) { { verbose: true, app: 'hello' } } allow(Aptible::Api::App).to receive(:all) { apps } expect(app).to receive(:vhosts) { [vhost1, vhost2] } expect(subject).to receive(:say).with('domain1 -> host1') expect(subject).to receive(:say).with('domain2 -> host2') subject.send('domains') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
aptible-cli-0.5.15 | spec/aptible/cli/subcommands/domains_spec.rb |
aptible-cli-0.5.14 | spec/aptible/cli/subcommands/domains_spec.rb |