Sha256: 63d14a3616e3336629e77e0c433561123bc3dafb6716b7b2df2c66214303d9d6

Contents?: true

Size: 1.42 KB

Versions: 48

Compression:

Stored size: 1.42 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
      custom.evaluate_file(file)
      commands = custom.build
      expect(commands.keys).to include("apply")
    end

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

    it "var_file_args" do
      custom.evaluate_file(file)
      allow(custom).to receive(:var_file_exist?).and_return(true)
      expect(custom.send(:var_file_args)).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
      custom.evaluate_file(file)
      commands = custom.build
      expect(commands.keys).to include("apply")
    end

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

    it "var_file_args" do
      custom.evaluate_file(file)
      allow(custom).to receive(:var_file_exist?).and_return(true)
      expect(custom.send(:var_file_args)).to eq([])
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
terraspace-1.0.4 spec/terraspace/terraform/args/custom_spec.rb
terraspace-1.0.3 spec/terraspace/terraform/args/custom_spec.rb
terraspace-1.0.2 spec/terraspace/terraform/args/custom_spec.rb
terraspace-1.0.1 spec/terraspace/terraform/args/custom_spec.rb
terraspace-1.0.0 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.7.2 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.7.1 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.7.0 spec/terraspace/terraform/args/custom_spec.rb