Sha256: 302716d3be3156b42dde4c9dca64730d31a9852480625a05ad6427132d239fb8

Contents?: true

Size: 1.77 KB

Versions: 3

Compression:

Stored size: 1.77 KB

Contents

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

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

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

      it { expect(subject.dig("services", "reverseproxy", "ports")).to include "127.0.0.1:3001:3001" }
      it { expect(subject.dig("services", "production", "image")).to eq "docker.pkg.github.com/github_user/test_app/web" }
      it { expect(subject.dig("services", "webpack-dev-server", "volumes")).to include(".:/app/test_app", "node_modules:/app/test_app/node_modules") }
      it { expect(subject["services"]["web"]["volumes"]).to include(".:/app/test_app", "node_modules:/app/test_app/node_modules") }
    end

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

      it { expect(subject.dig("services", "webpack-dev-server", "volumes")).to include(".:/app/old_app", "node_modules:/app/old_app/node_modules") }
      it { expect(subject.dig("services", "web", "volumes")).to include(".:/app/old_app", "node_modules:/app/old_app/node_modules") }
    end

    context "with an explicit template name" do
      let(:template) { described_class.new("init_app", "github_user", described_class::INIT_TEMPLATE) }

      it { expect(subject.dig("services", "new_rails", "volumes")).to include(".:/app/init_app") }
      it { expect(subject.dig("services", "bundle", "volumes")).to include(".:/app/init_app") }
      it { expect(subject.dig("services", "install_webpacker", "volumes")).to include(".:/app/init_app", "node_modules:/app/init_app/node_modules") }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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