From 80590a9bfe2a8c0d288125d17cfb9f01c8563a7a Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 28 Apr 2014 17:28:22 -0700 Subject: Add more specs --- spec/acceptance/shuffle_spec.rb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 spec/acceptance/shuffle_spec.rb (limited to 'spec/acceptance/shuffle_spec.rb') diff --git a/spec/acceptance/shuffle_spec.rb b/spec/acceptance/shuffle_spec.rb new file mode 100644 index 0000000..e22171f --- /dev/null +++ b/spec/acceptance/shuffle_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper_acceptance' + +describe 'shuffle function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'shuffles arrays' do + pp = <<-EOS + $a = ["the","public","art","galleries"] + # Anagram: Large picture halls, I bet + $o = shuffle($a) + notice(inline_template('shuffle is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to_not match(/shuffle is \["the", "public", "art", "galleries"\]/) + end + end + it 'shuffles strings' do + pp = <<-EOS + $a = "blowzy night-frumps vex'd jack q" + $o = shuffle($a) + notice(inline_template('shuffle is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to_not match(/shuffle is "blowzy night-frumps vex'd jack q"/) + end + end + end + describe 'failure' do + it 'handles no arguments' + it 'handles non strings or arrays' + end +end -- cgit v1.2.3