Sha256: 8c2a74afe7c097c981ea25002b76c62f1e86af2d3b2d09fad4dbbfce0ee48965

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe Dbcp::Capistrano3EnvironmentProvider do
  subject { Dbcp::Capistrano3EnvironmentProvider.new }

  describe "#find" do
    context "when task exists" do
      let(:remote_database) { double 'Database' }
      it "returns an environment" do
        allow_any_instance_of(Dbcp::SshExecutionHost).to receive(:remote_database) { remote_database }
        environment = subject.find 'staging'
        expect(environment).to be_a Dbcp::Environment
        expect(environment.environment_name).to  eq 'staging'
        expect(environment.execution_host).to be_a Dbcp::SshExecutionHost
        expect(environment.execution_host.host).to eq 'db.example.com'
        expect(environment.execution_host.username).to eq 'staging_user'
        expect(environment.execution_host.path).to eq '/www/staging.example.com/current'
        expect(environment.database).to eq remote_database
      end
    end

    context "when task doesn't exist" do
      specify do
        expect(subject.find('doesnt-exist')).to be_nil
      end
    end

    context "Capfile does't exist" do
      let(:path) { 'doesnt-exist' }
      specify do
        expect(subject.find('production')).to be_nil
      end
    end
  end


end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dbcp-0.2.1 spec/lib/dbcp/environment_providers/capistrano_3_environment_provider_spec.rb
dbcp-0.2.0 spec/lib/dbcp/environment_providers/capistrano_3_environment_provider_spec.rb