summaryrefslogtreecommitdiff
path: root/spec/acceptance/loadyaml_spec.rb
diff options
context:
space:
mode:
authorAshley Penney <ashley.penney@puppetlabs.com>2014-05-07 18:03:57 -0400
committerAshley Penney <ashley.penney@puppetlabs.com>2014-05-07 18:03:57 -0400
commit17a912ea0afb3fb018170477856c25a95009f2cc (patch)
tree91f4a1910df1dfd5729a2a9ad8dbf4ec3fa0402e /spec/acceptance/loadyaml_spec.rb
parent176ff3abdc1e63de02d6d8d9cb2d70c09f7b7766 (diff)
parentc66a2e4f49d6c9ebcbff718f3ec119049fb4c514 (diff)
Merge pull request #247 from hunner/more_tests
Adding more spec coverage
Diffstat (limited to 'spec/acceptance/loadyaml_spec.rb')
-rw-r--r--spec/acceptance/loadyaml_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/acceptance/loadyaml_spec.rb b/spec/acceptance/loadyaml_spec.rb
new file mode 100644
index 0000000..944a727
--- /dev/null
+++ b/spec/acceptance/loadyaml_spec.rb
@@ -0,0 +1,31 @@
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper_acceptance'
+
+describe 'loadyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+ describe 'success' do
+ it 'loadyamls array of values' do
+ shell('echo "---
+ aaa: 1
+ bbb: 2
+ ccc: 3
+ ddd: 4" > /testyaml.yaml')
+ pp = <<-EOS
+ $o = loadyaml('/testyaml.yaml')
+ notice(inline_template('loadyaml[aaa] is <%= @o["aaa"].inspect %>'))
+ notice(inline_template('loadyaml[bbb] is <%= @o["bbb"].inspect %>'))
+ notice(inline_template('loadyaml[ccc] is <%= @o["ccc"].inspect %>'))
+ notice(inline_template('loadyaml[ddd] is <%= @o["ddd"].inspect %>'))
+ EOS
+
+ apply_manifest(pp, :catch_failures => true) do |r|
+ expect(r.stdout).to match(/loadyaml\[aaa\] is 1/)
+ expect(r.stdout).to match(/loadyaml\[bbb\] is 2/)
+ expect(r.stdout).to match(/loadyaml\[ccc\] is 3/)
+ expect(r.stdout).to match(/loadyaml\[ddd\] is 4/)
+ end
+ end
+ end
+ describe 'failure' do
+ it 'fails with no arguments'
+ end
+end