diff options
author | Morgan Haskel <morgan@puppetlabs.com> | 2015-04-16 10:48:10 -0700 |
---|---|---|
committer | Morgan Haskel <morgan@puppetlabs.com> | 2015-04-16 10:48:10 -0700 |
commit | 8a1d1e2f3425ff8fa1d7e74463ec226df2b968c8 (patch) | |
tree | 07a0c9a583059d80dcf9c81e287f74c454804377 /spec | |
parent | 59b3fb4472c6ceafc6762739e767294054787bd4 (diff) | |
parent | ac24e7acc767bce9cc1977f90c798df94292813e (diff) |
Merge pull request #314 from amateo/feature/loadyaml_check_file
Check if file exists before loading with loadyaml. If not, return nil
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/functions/loadyaml_spec.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/functions/loadyaml_spec.rb b/spec/functions/loadyaml_spec.rb index cdc3d6f..4b8d406 100755 --- a/spec/functions/loadyaml_spec.rb +++ b/spec/functions/loadyaml_spec.rb @@ -14,6 +14,12 @@ describe "the loadyaml function" do expect { scope.function_loadyaml([]) }.to raise_error(Puppet::ParseError) end + it "should return nil when file does not exist" do + yaml_file = tmpfilename ('yamlfile') + result = scope.function_loadyaml([yaml_file]) + expect(result).to(eq(nil)) + end + it "should convert YAML file to a data structure" do yaml_file = tmpfilename ('yamlfile') File.open(yaml_file, 'w') do |fh| |