Sha256: f1944f620b632e287c5c15f85ff200512aa2de13627e2e23a2a78f3f77ad9d66

Contents?: true

Size: 1.79 KB

Versions: 8

Compression:

Stored size: 1.79 KB

Contents

require 'spec_helper'
require 'dpl/provider/cloud_foundry'

describe DPL::Provider::CloudFoundry do
  subject :provider do
    described_class.new(DummyContext.new, api: 'api.run.awesome.io', username: 'mallomar',
                        password: 'myreallyawesomepassword',
                        organization: 'myorg',
                        space: 'outer',
                        manifest: 'worker-manifest.yml',
                        skip_ssl_validation: true)
  end

  describe "#check_auth" do
    example do
      expect(provider.context).to receive(:shell).with('wget http://go-cli.s3-website-us-east-1.amazonaws.com/releases/latest/cf-cli_amd64.deb -qO temp.deb && sudo dpkg -i temp.deb')
      expect(provider.context).to receive(:shell).with('rm temp.deb')
      expect(provider.context).to receive(:shell).with('cf api api.run.awesome.io')
      expect(provider.context).to receive(:shell).with('cf login --u mallomar --p myreallyawesomepassword --o myorg --s outer --skip-ssl-validation')
      provider.check_auth
    end
  end

  describe "#check_app" do
    example do
      expect{provider.check_app}.to raise_error('Application must have a manifest.yml for unattended deployment')
    end
  end

  describe "#needs_key?" do
    example do
      expect(provider.needs_key?).to eq(false)
    end
  end

  describe "#push_app" do
    example "With manifest" do
      expect(provider.context).to receive(:shell).with('cf push -f worker-manifest.yml')
      expect(provider.context).to receive(:shell).with('cf logout')
      provider.push_app
    end

    example "Without manifest" do
      provider.options.update(:manifest => nil)
      expect(provider.context).to receive(:shell).with('cf push')
      expect(provider.context).to receive(:shell).with('cf logout')
      provider.push_app
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dpl-1.7.19.travis.933.4 spec/provider/cloudfoundry_spec.rb
dpl-1.7.19.travis.929.4 spec/provider/cloudfoundry_spec.rb
dpl-1.7.19.travis.895.4 spec/provider/cloudfoundry_spec.rb
dpl-1.7.18.travis.894.4 spec/provider/cloudfoundry_spec.rb
dpl-1.7.18 spec/provider/cloudfoundry_spec.rb
dpl-1.7.18.travis.890.4 spec/provider/cloudfoundry_spec.rb
dpl-1.7.17 spec/provider/cloudfoundry_spec.rb
dpl-1.7.17.travis.889.4 spec/provider/cloudfoundry_spec.rb