Sha256: be5066afd474e62e66e0c39f52ff188c31397534c33224a5070f7d92ea72e7c3

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

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

RSpec.describe Wellcar::Templates::EnvProductionDatabase do
  describe "#render" do
    subject { template.render }

    let(:password) { class_double "SecureRandom" }

    before do
      stub_const "SecureRandom", password
      expect(password).to receive(:base64).with(20).and_return "prod-password"
    end

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

      it { is_expected.to include("POSTGRES_DB=test_app_production") }
      it { is_expected.to include("POSTGRES_USER=postgres") }
      it { is_expected.to include("POSTGRES_PASSWORD=prod-password") }
    end

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

      it { is_expected.to include("POSTGRES_DB=old_app_production") }
      it { is_expected.to include("POSTGRES_USER=postgres") }
      it { is_expected.to include("POSTGRES_PASSWORD=prod-password") }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wellcar-0.0.3 spec/wellcar/templates/env_production_database_spec.rb
wellcar-0.0.2 spec/wellcar/templates/env_production_database_spec.rb