diff options
author | Angel L. Mateo <amateo@um.es> | 2015-04-13 09:27:03 +0200 |
---|---|---|
committer | Angel L. Mateo <amateo@um.es> | 2015-04-13 09:27:03 +0200 |
commit | ac24e7acc767bce9cc1977f90c798df94292813e (patch) | |
tree | a2d1d7f8f25ba62fc6acc96971ec31ee658200b7 /spec | |
parent | b9560df899fdea34ac69692ef2447ffdd2d3365a (diff) |
test case for when the file does not exist
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| |