]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
test case for when the file does not exist
authorAngel L. Mateo <amateo@um.es>
Mon, 13 Apr 2015 07:27:03 +0000 (09:27 +0200)
committerAngel L. Mateo <amateo@um.es>
Mon, 13 Apr 2015 07:27:03 +0000 (09:27 +0200)
spec/functions/loadyaml_spec.rb

index cdc3d6f5150bde6aaf894ada21bc1566413f3d2b..4b8d40623639fc67d6036730b86370dbfa1a7928 100755 (executable)
@@ -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|