Sha256: 1d29f3f98734bd066caafd6eaaba53d20e66a6c012204eb86dbf337e1a94ff2d

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

require File.join(File.dirname(__FILE__), "..", "..", "spec_helper.rb")
require "yaml"
require "wellcar/templates/database_yaml"

RSpec.describe Wellcar::Templates::DatabaseYaml do
  describe "#render" do
    subject { YAML::load(template.render) }

    context "with a first set of inputs" do
      let(:template) { Wellcar::Templates::DatabaseYaml.new("test_app") }

      it { expect(subject["development"]["host"]).to eq("<%= ENV.fetch(\"DATABASE_HOST\") %>") }
      it { expect(subject["development"]["username"]).to eq("<%= ENV.fetch(\"POSTGRES_USER\") %>") }
      it { expect(subject["development"]["password"]).to eq("<%= ENV.fetch(\"POSTGRES_PASSWORD\") %>") }
      it { expect(subject["development"]["database"]).to eq("<%= ENV.fetch(\"POSTGRES_DB\") %>") }
      it { expect(subject["test"]["database"]).to eq("test_app") }
    end

    context "with another set of inputs" do
      let(:template) { Wellcar::Templates::DatabaseYaml.new("old_app") }

      it { expect(subject["test"]["database"]).to eq("old_app") }
    end
  end
end


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wellcar-0.0.3 spec/wellcar/templates/database_yaml_spec.rb
wellcar-0.0.2 spec/wellcar/templates/database_yaml_spec.rb
wellcar-0.0.1 spec/wellcar/templates/database_yaml_spec.rb