Sha256: a11f42158104a5184cce5fd5c9134835bd811df5e7845fe48192f80179552826

Contents?: true

Size: 882 Bytes

Versions: 3

Compression:

Stored size: 882 Bytes

Contents

require 'spec_helper'

describe Dbcp::UriEnvironmentProvider do
  describe "#find" do
    context "when a URI" do
      let(:uri) { 'postgres://my_username:my_password@db.example.com:5432/my_database' }
      it "returns an environment" do
        environment = subject.find(uri)
        expect(environment).to be_a Dbcp::Environment
        expect(environment.environment_name).to eq uri
        expect(environment.database).to be_a Dbcp::PostgresDatabase
        expect(environment.database.username).to eq 'my_username'
        expect(environment.database.password).to eq 'my_password'
        expect(environment.database.host).to eq 'db.example.com'
        expect(environment.database.database).to eq 'my_database'
      end
    end

    context "when not a valid URI" do
      let(:uri) { 'development'}
      specify { expect(subject.find(uri)).to be_nil }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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