Sha256: 2f654adaf3c0d9879ee852be4bfdd05a6c615b2968848d36d6b290e6cb90cc0e

Contents?: true

Size: 1.27 KB

Versions: 20

Compression:

Stored size: 1.27 KB

Contents

describe Terraspace::Terraform::Args::Custom do
  let(:custom) do
    custom = described_class.new(mod, name)
    custom.instance_variable_set(:@file, file) # override @file for spec
    custom
  end
  let(:mod) { double(:mod).as_null_object }

  context "single" do
    let(:file) { fixture("terraform/args/single.rb") }
    let(:name) { "apply" }
    it "build creates the @commands structure" do
      commands = custom.build
      expect(commands.keys).to include("apply")
    end

    it "args" do
      custom.build
      expect(custom.args).to eq(["-lock-timeout=20m"])
    end

    it "var_files" do
      custom.build
      allow(custom).to receive(:var_file_exist?).and_return(true)
      expect(custom.var_files).to eq(["-var-file=a.tfvars", "-var-file=b.tfvars"])
    end
  end

  context "multiple" do
    let(:file) { fixture("terraform/args/multiple.rb") }
    let(:name) { "apply" }
    it "build creates the @commands structure" do
      commands = custom.build
      expect(commands.keys).to include("apply")
    end

    it "args" do
      custom.build
      expect(custom.args).to eq(["-lock-timeout=20m"])
    end

    it "var_files" do
      custom.build
      allow(custom).to receive(:var_file_exist?).and_return(true)
      expect(custom.var_files).to eq([])
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
terraspace-0.4.4 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.4.3 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.4.2 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.4.1 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.4.0 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.3.6 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.3.5 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.3.4 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.3.3 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.3.2 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.3.1 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.3.0 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.2.4 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.2.3 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.2.2 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.2.1 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.2.0 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.1.2 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.1.1 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.1.0 spec/terraspace/terraform/args/custom_spec.rb