Sha256: d4c13351846f01ef40ec03803f686dabe75254bbd2541aef5ad7df411cd2c09b
Contents?: true
Size: 1.59 KB
Versions: 1
Compression:
Stored size: 1.59 KB
Contents
require 'spec_helper' describe Dbcp::DatabaseYamlEnvironmentProvider do subject { Dbcp::DatabaseYamlEnvironmentProvider.new path } let(:path) { File.expand_path('../../../../fixtures/config/database.yml', __FILE__) } describe "#find" do context "when environment exists" do it "returns an environment" do environment = subject.find 'development' expect(environment).to be_a Dbcp::Environment expect(environment.database).to be_a Dbcp::Database expect(environment.environment_name).to eq 'development' expect(environment.database.adapter).to eq 'postgresql' expect(environment.database.database).to eq 'dev_database' expect(environment.database.username).to eq 'dev_username' expect(environment.database.password).to eq 'dev_password' end context "without ssh_uri" do it "executes on localhost" do environment = subject.find 'development' expect(environment.execution_host).to be_a Dbcp::LocalExecutionHost end end context "with ssh_uri" do it "executes on remote host" do environment = subject.find 'staging' expect(environment.execution_host).to be_a Dbcp::SshExecutionHost end end end context "when environment doesn't exist" do specify { expect(subject.find 'does-not-exist').to be_nil } end context "when file doesn't exist" do let(:path) { File.expand_path('../../../../fixtures/config/database-does-not-exist.yml', __FILE__) } specify { expect(subject.find 'development').to be_nil } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dbcp-0.0.1 | spec/lib/dbcp/environment_providers/database_yaml_environment_provider_spec.rb |