Sha256: 0e9051023a5014e65f760fd0ce7d2269a31df4f6235bcb71028bd44f38efb3bf

Contents?: true

Size: 903 Bytes

Versions: 43

Compression:

Stored size: 903 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))

describe ChefDnaParser do
  describe ".load_dna" do

    it "parses test dna with ERB" do
      ChefDnaParser.test_dna = <<-JS
        {
          "some_key": "some_value <%= ENV['HOME'] %>"
        }
      JS

      ChefDnaParser.load_dna
      ChefDnaParser.parsed.should_not be_nil
      ChefDnaParser.parsed["some_key"].should_not be_nil
      ChefDnaParser.parsed["some_key"].should == "some_value #{ENV['HOME']}"
    end
    
    it "parses dna from file using environment variable" do
      ENV["DNA"] = File.expand_path(File.join(File.dirname(__FILE__), "..", "fixtures", "parser.json"))
      ChefDnaParser.load_dna
      ChefDnaParser.parsed.should_not be_nil
      ChefDnaParser.parsed["from_file_key"].should_not be_nil
      ChefDnaParser.parsed["from_file_key"].should == "from_file_value"
    end
    
  end

end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
chef_cap-0.3.23 spec/chef_dna_parser_spec.rb
chef_cap-0.3.22 spec/chef_dna_parser_spec.rb
chef_cap-0.3.21 spec/chef_dna_parser_spec.rb
chef_cap-0.3.20 spec/chef_dna_parser_spec.rb
chef_cap-0.3.19 spec/chef_dna_parser_spec.rb
chef_cap-0.3.18 spec/chef_dna_parser_spec.rb
chef_cap-0.3.17 spec/chef_dna_parser_spec.rb
chef_cap-0.3.16 spec/chef_dna_parser_spec.rb
chef_cap-0.3.15 spec/chef_dna_parser_spec.rb
chef_cap-0.3.14 spec/chef_dna_parser_spec.rb
chef_cap-0.3.13 spec/chef_dna_parser_spec.rb
chef_cap-0.3.12 spec/chef_dna_parser_spec.rb
chef_cap-0.3.11 spec/chef_dna_parser_spec.rb
chef_cap-0.3.10 spec/chef_dna_parser_spec.rb
chef_cap-0.3.9 spec/chef_dna_parser_spec.rb
chef_cap-0.3.8 spec/chef_dna_parser_spec.rb
chef_cap-0.3.7 spec/chef_dna_parser_spec.rb
chef_cap-0.3.6 spec/chef_dna_parser_spec.rb
chef_cap-0.3.5 spec/chef_dna_parser_spec.rb
chef_cap-0.3.4 spec/chef_dna_parser_spec.rb