Sha256: f7fc27db12c3e82259d04d563bdb2910d959305b883d5927ecd315b12c5abf0b

Contents?: true

Size: 1.39 KB

Versions: 36

Compression:

Stored size: 1.39 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_files" do
      custom.evaluate_file(file)
      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
      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_files" do
      custom.evaluate_file(file)
      allow(custom).to receive(:var_file_exist?).and_return(true)
      expect(custom.var_files).to eq([])
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
terraspace-0.6.23 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.22 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.21 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.20 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.19 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.18 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.17 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.16 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.15 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.13 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.12 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.11 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.10 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.9 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.8 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.7 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.6 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.5 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.4 spec/terraspace/terraform/args/custom_spec.rb
terraspace-0.6.3 spec/terraspace/terraform/args/custom_spec.rb