]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
Convert specs to RSpec 2.99.0 syntax with Transpec
authorAshley Penney <ashley.penney@puppetlabs.com>
Wed, 4 Jun 2014 18:38:37 +0000 (14:38 -0400)
committerAshley Penney <ashley.penney@puppetlabs.com>
Wed, 4 Jun 2014 18:38:37 +0000 (14:38 -0400)
This conversion is done by Transpec 2.2.1 with the following command:
    transpec spec/functions

* 345 conversions
    from: obj.should
      to: expect(obj).to

* 122 conversions
    from: == expected
      to: eq(expected)

* 85 conversions
    from: lambda { }.should
      to: expect { }.to

* 22 conversions
    from: be_true
      to: be_truthy

* 16 conversions
    from: be_false
      to: be_falsey

* 11 conversions
    from: pending
      to: skip

* 9 conversions
    from: it { should ... }
      to: it { is_expected.to ... }

* 5 conversions
    from: =~ [1, 2]
      to: match_array([1, 2])

* 2 conversions
    from: =~ /pattern/
      to: match(/pattern/)

* 2 conversions
    from: obj.should_not
      to: expect(obj).not_to

For more details: https://github.com/yujinakayama/transpec#supported-conversions

83 files changed:
spec/functions/abs_spec.rb
spec/functions/any2array_spec.rb
spec/functions/base64_spec.rb
spec/functions/bool2num_spec.rb
spec/functions/capitalize_spec.rb
spec/functions/chomp_spec.rb
spec/functions/chop_spec.rb
spec/functions/concat_spec.rb
spec/functions/count_spec.rb
spec/functions/deep_merge_spec.rb
spec/functions/defined_with_params_spec.rb
spec/functions/delete_at_spec.rb
spec/functions/delete_spec.rb
spec/functions/delete_undef_values_spec.rb
spec/functions/delete_values_spec.rb
spec/functions/difference_spec.rb
spec/functions/dirname_spec.rb
spec/functions/downcase_spec.rb
spec/functions/empty_spec.rb
spec/functions/flatten_spec.rb
spec/functions/floor_spec.rb
spec/functions/fqdn_rotate_spec.rb
spec/functions/get_module_path_spec.rb
spec/functions/getparam_spec.rb
spec/functions/getvar_spec.rb
spec/functions/grep_spec.rb
spec/functions/has_interface_with_spec.rb
spec/functions/has_ip_address_spec.rb
spec/functions/has_ip_network_spec.rb
spec/functions/has_key_spec.rb
spec/functions/hash_spec.rb
spec/functions/intersection_spec.rb
spec/functions/is_array_spec.rb
spec/functions/is_bool_spec.rb
spec/functions/is_domain_name_spec.rb
spec/functions/is_float_spec.rb
spec/functions/is_function_available.rb
spec/functions/is_hash_spec.rb
spec/functions/is_integer_spec.rb
spec/functions/is_ip_address_spec.rb
spec/functions/is_mac_address_spec.rb
spec/functions/is_numeric_spec.rb
spec/functions/is_string_spec.rb
spec/functions/join_keys_to_values_spec.rb
spec/functions/join_spec.rb
spec/functions/keys_spec.rb
spec/functions/loadyaml_spec.rb
spec/functions/lstrip_spec.rb
spec/functions/max_spec.rb
spec/functions/member_spec.rb
spec/functions/merge_spec.rb
spec/functions/min_spec.rb
spec/functions/num2bool_spec.rb
spec/functions/parsejson_spec.rb
spec/functions/parseyaml_spec.rb
spec/functions/pick_default_spec.rb
spec/functions/pick_spec.rb
spec/functions/prefix_spec.rb
spec/functions/range_spec.rb
spec/functions/reject_spec.rb
spec/functions/reverse_spec.rb
spec/functions/rstrip_spec.rb
spec/functions/shuffle_spec.rb
spec/functions/size_spec.rb
spec/functions/sort_spec.rb
spec/functions/squeeze_spec.rb
spec/functions/str2bool_spec.rb
spec/functions/str2saltedsha512_spec.rb
spec/functions/strftime_spec.rb
spec/functions/strip_spec.rb
spec/functions/suffix_spec.rb
spec/functions/swapcase_spec.rb
spec/functions/time_spec.rb
spec/functions/to_bytes_spec.rb
spec/functions/type_spec.rb
spec/functions/union_spec.rb
spec/functions/unique_spec.rb
spec/functions/upcase_spec.rb
spec/functions/uriescape_spec.rb
spec/functions/validate_slength_spec.rb
spec/functions/values_at_spec.rb
spec/functions/values_spec.rb
spec/functions/zip_spec.rb

index c0b42970c528b71097d41a133b5f736f98d43a48..3c25ce28f8e03572ea6f6c0442bc68a71671f9f1 100755 (executable)
@@ -6,20 +6,20 @@ describe "the abs function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("abs").should == "function_abs"
+    expect(Puppet::Parser::Functions.function("abs")).to eq("function_abs")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_abs([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_abs([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should convert a negative number into a positive" do
     result = scope.function_abs(["-34"])
-    result.should(eq(34))
+    expect(result).to(eq(34))
   end
 
   it "should do nothing with a positive number" do
     result = scope.function_abs(["5678"])
-    result.should(eq(5678))
+    expect(result).to(eq(5678))
   end
 end
index b266e84f4f3b6eb16cbb06379d82cc20516f48f6..87cd04b5ee29bd7d577a7879b3360985b896a812 100755 (executable)
@@ -5,51 +5,51 @@ describe "the any2array function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("any2array").should == "function_any2array"
+    expect(Puppet::Parser::Functions.function("any2array")).to eq("function_any2array")
   end
 
   it "should return an empty array if there is less than 1 argument" do
     result = scope.function_any2array([])
-    result.should(eq([]))
+    expect(result).to(eq([]))
   end
 
   it "should convert boolean true to [ true ] " do
     result = scope.function_any2array([true])
-    result.should(eq([true]))
+    expect(result).to(eq([true]))
   end
 
   it "should convert one object to [object]" do
     result = scope.function_any2array(['one'])
-    result.should(eq(['one']))
+    expect(result).to(eq(['one']))
   end
 
   it "should convert multiple objects to [objects]" do
     result = scope.function_any2array(['one', 'two'])
-    result.should(eq(['one', 'two']))
+    expect(result).to(eq(['one', 'two']))
   end
 
   it "should return empty array it was called with" do
     result = scope.function_any2array([[]])
-    result.should(eq([]))
+    expect(result).to(eq([]))
   end
 
   it "should return one-member array it was called with" do
     result = scope.function_any2array([['string']])
-    result.should(eq(['string']))
+    expect(result).to(eq(['string']))
   end
 
   it "should return multi-member array it was called with" do
     result = scope.function_any2array([['one', 'two']])
-    result.should(eq(['one', 'two']))
+    expect(result).to(eq(['one', 'two']))
   end
 
   it "should return members of a hash it was called with" do
     result = scope.function_any2array([{ 'key' => 'value' }])
-    result.should(eq(['key', 'value']))
+    expect(result).to(eq(['key', 'value']))
   end
 
   it "should return an empty array if it was called with an empty hash" do
     result = scope.function_any2array([{ }])
-    result.should(eq([]))
+    expect(result).to(eq([]))
   end
 end
index 5faa5e66c73013a0a6e7824efdc8f88b4065db6f..e93fafcd0436102054c9ec9b5afdf551ce07a6e6 100755 (executable)
@@ -6,7 +6,7 @@ describe "the base64 function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("base64").should == "function_base64"
+    expect(Puppet::Parser::Functions.function("base64")).to eq("function_base64")
   end
 
   it "should raise a ParseError if there are other than 2 arguments" do
@@ -25,10 +25,10 @@ describe "the base64 function" do
 
   it "should encode a encoded string" do
     result = scope.function_base64(["encode",'thestring'])
-    result.should =~ /\AdGhlc3RyaW5n\n\Z/
+    expect(result).to match(/\AdGhlc3RyaW5n\n\Z/)
   end
   it "should decode a base64 encoded string" do
     result = scope.function_base64(["decode",'dGhlc3RyaW5n'])
-    result.should == 'thestring'
+    expect(result).to eq('thestring')
   end
 end
index 518ac85ec5ff145f91a0642f5c5b66fec101a186..fbf461b1409115f420a544b5bf362e714731f096 100755 (executable)
@@ -5,20 +5,20 @@ describe "the bool2num function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("bool2num").should == "function_bool2num"
+    expect(Puppet::Parser::Functions.function("bool2num")).to eq("function_bool2num")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_bool2num([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_bool2num([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should convert true to 1" do
     result = scope.function_bool2num([true])
-    result.should(eq(1))
+    expect(result).to(eq(1))
   end
 
   it "should convert false to 0" do
     result = scope.function_bool2num([false])
-    result.should(eq(0))
+    expect(result).to(eq(0))
   end
 end
index 69c9758f25bd73250ccef84d75eced84882d4a7f..0cc2d760b7a30a28e591d75c4b37f90266015045 100755 (executable)
@@ -5,15 +5,15 @@ describe "the capitalize function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("capitalize").should == "function_capitalize"
+    expect(Puppet::Parser::Functions.function("capitalize")).to eq("function_capitalize")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_capitalize([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_capitalize([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should capitalize the beginning of a string" do
     result = scope.function_capitalize(["abc"])
-    result.should(eq("Abc"))
+    expect(result).to(eq("Abc"))
   end
 end
index e425365fcb00891e38c1098809e8f38ea8e67fff..d2ae287494034639b6197c6ef05957ef6dd71fad 100755 (executable)
@@ -5,15 +5,15 @@ describe "the chomp function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("chomp").should == "function_chomp"
+    expect(Puppet::Parser::Functions.function("chomp")).to eq("function_chomp")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_chomp([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_chomp([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should chomp the end of a string" do
     result = scope.function_chomp(["abc\n"])
-    result.should(eq("abc"))
+    expect(result).to(eq("abc"))
   end
 end
index 9e466de4b69f7271b82d744705740a94b047ee96..d9dbb88a51708133f15625f15015a70c1ef25918 100755 (executable)
@@ -5,15 +5,15 @@ describe "the chop function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("chop").should == "function_chop"
+    expect(Puppet::Parser::Functions.function("chop")).to eq("function_chop")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_chop([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_chop([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should chop the end of a string" do
     result = scope.function_chop(["asdf\n"])
-    result.should(eq("asdf"))
+    expect(result).to(eq("asdf"))
   end
 end
index 6e67620966b025147bbbc6ce8eeaf12ca36cdd59..b853b4c1ae2edb0d5d04cf216ec8220d9d3ad804 100755 (executable)
@@ -5,26 +5,26 @@ describe "the concat function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should raise a ParseError if the client does not provide two arguments" do
-    lambda { scope.function_concat([]) }.should(raise_error(Puppet::ParseError))
+    expect { scope.function_concat([]) }.to(raise_error(Puppet::ParseError))
   end
 
   it "should raise a ParseError if the first parameter is not an array" do
-    lambda { scope.function_concat([1, []])}.should(raise_error(Puppet::ParseError))
+    expect { scope.function_concat([1, []])}.to(raise_error(Puppet::ParseError))
   end
 
   it "should be able to concat an array" do
     result = scope.function_concat([['1','2','3'],['4','5','6']])
-    result.should(eq(['1','2','3','4','5','6']))
+    expect(result).to(eq(['1','2','3','4','5','6']))
   end
 
   it "should be able to concat a primitive to an array" do
     result = scope.function_concat([['1','2','3'],'4'])
-    result.should(eq(['1','2','3','4']))
+    expect(result).to(eq(['1','2','3','4']))
   end
 
   it "should not accidentally flatten nested arrays" do
     result = scope.function_concat([['1','2','3'],[['4','5'],'6']])
-    result.should(eq(['1','2','3',['4','5'],'6']))
+    expect(result).to(eq(['1','2','3',['4','5'],'6']))
   end
 
 end
index 2453815c26d8216ff4e36305b994de782b6cd0c7..f8f1d484277672cfd64fab87c0f6be3fa2ff4fa7 100755 (executable)
@@ -6,23 +6,23 @@ describe "the count function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("count").should == "function_count"
+    expect(Puppet::Parser::Functions.function("count")).to eq("function_count")
   end
 
   it "should raise a ArgumentError if there is more than 2 arguments" do
-    lambda { scope.function_count(['foo', 'bar', 'baz']) }.should( raise_error(ArgumentError))
+    expect { scope.function_count(['foo', 'bar', 'baz']) }.to( raise_error(ArgumentError))
   end
 
   it "should be able to count arrays" do
-    scope.function_count([["1","2","3"]]).should(eq(3))
+    expect(scope.function_count([["1","2","3"]])).to(eq(3))
   end
 
   it "should be able to count matching elements in arrays" do
-    scope.function_count([["1", "2", "2"], "2"]).should(eq(2))
+    expect(scope.function_count([["1", "2", "2"], "2"])).to(eq(2))
   end
 
   it "should not count nil or empty strings" do
-    scope.function_count([["foo","bar",nil,""]]).should(eq(2))
+    expect(scope.function_count([["foo","bar",nil,""]])).to(eq(2))
   end
 
   it 'does not count an undefined hash key or an out of bound array index (which are both :undef)' do
index f1347014cf2b633849e6ea92fff55425ec6912b0..7087904a8d98e270f112bc071f0dc0d3af868121 100755 (executable)
@@ -7,7 +7,7 @@ describe Puppet::Parser::Functions.function(:deep_merge) do
 
   describe 'when calling deep_merge from puppet' do
     it "should not compile when no arguments are passed" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
       Puppet[:code] = '$x = deep_merge()'
       expect {
         scope.compiler.compile
@@ -15,7 +15,7 @@ describe Puppet::Parser::Functions.function(:deep_merge) do
     end
 
     it "should not compile when 1 argument is passed" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
       Puppet[:code] = "$my_hash={'one' => 1}\n$x = deep_merge($my_hash)"
       expect {
         scope.compiler.compile
@@ -35,71 +35,71 @@ describe Puppet::Parser::Functions.function(:deep_merge) do
 
     it 'should be able to deep_merge two hashes' do
       new_hash = scope.function_deep_merge([{'one' => '1', 'two' => '1'}, {'two' => '2', 'three' => '2'}])
-      new_hash['one'].should   == '1'
-      new_hash['two'].should   == '2'
-      new_hash['three'].should == '2'
+      expect(new_hash['one']).to   eq('1')
+      expect(new_hash['two']).to   eq('2')
+      expect(new_hash['three']).to eq('2')
     end
 
     it 'should deep_merge multiple hashes' do
       hash = scope.function_deep_merge([{'one' => 1}, {'one' => '2'}, {'one' => '3'}])
-      hash['one'].should == '3'
+      expect(hash['one']).to eq('3')
     end
 
     it 'should accept empty hashes' do
-      scope.function_deep_merge([{},{},{}]).should == {}
+      expect(scope.function_deep_merge([{},{},{}])).to eq({})
     end
 
     it 'should deep_merge subhashes' do
       hash = scope.function_deep_merge([{'one' => 1}, {'two' => 2, 'three' => { 'four' => 4 } }])
-      hash['one'].should == 1
-      hash['two'].should == 2
-      hash['three'].should == { 'four' => 4 }
+      expect(hash['one']).to eq(1)
+      expect(hash['two']).to eq(2)
+      expect(hash['three']).to eq({ 'four' => 4 })
     end
 
     it 'should append to subhashes' do
       hash = scope.function_deep_merge([{'one' => { 'two' => 2 } }, { 'one' => { 'three' => 3 } }])
-      hash['one'].should == { 'two' => 2, 'three' => 3 }
+      expect(hash['one']).to eq({ 'two' => 2, 'three' => 3 })
     end
 
     it 'should append to subhashes 2' do
       hash = scope.function_deep_merge([{'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }, {'two' => 'dos', 'three' => { 'five' => 5 } }])
-      hash['one'].should == 1
-      hash['two'].should == 'dos'
-      hash['three'].should == { 'four' => 4, 'five' => 5 }
+      expect(hash['one']).to eq(1)
+      expect(hash['two']).to eq('dos')
+      expect(hash['three']).to eq({ 'four' => 4, 'five' => 5 })
     end
 
     it 'should append to subhashes 3' do
       hash = scope.function_deep_merge([{ 'key1' => { 'a' => 1, 'b' => 2 }, 'key2' => { 'c' => 3 } }, { 'key1' => { 'b' => 99 } }])
-      hash['key1'].should == { 'a' => 1, 'b' => 99 }
-      hash['key2'].should == { 'c' => 3 }
+      expect(hash['key1']).to eq({ 'a' => 1, 'b' => 99 })
+      expect(hash['key2']).to eq({ 'c' => 3 })
     end
 
     it 'should not change the original hashes' do
       hash1 = {'one' => { 'two' => 2 } }
       hash2 = { 'one' => { 'three' => 3 } }
       hash = scope.function_deep_merge([hash1, hash2])
-      hash1.should == {'one' => { 'two' => 2 } }
-      hash2.should == { 'one' => { 'three' => 3 } }
-      hash['one'].should == { 'two' => 2, 'three' => 3 }
+      expect(hash1).to eq({'one' => { 'two' => 2 } })
+      expect(hash2).to eq({ 'one' => { 'three' => 3 } })
+      expect(hash['one']).to eq({ 'two' => 2, 'three' => 3 })
     end
 
     it 'should not change the original hashes 2' do
       hash1 = {'one' => { 'two' => [1,2] } }
       hash2 = { 'one' => { 'three' => 3 } }
       hash = scope.function_deep_merge([hash1, hash2])
-      hash1.should == {'one' => { 'two' => [1,2] } }
-      hash2.should == { 'one' => { 'three' => 3 } }
-      hash['one'].should == { 'two' => [1,2], 'three' => 3 }
+      expect(hash1).to eq({'one' => { 'two' => [1,2] } })
+      expect(hash2).to eq({ 'one' => { 'three' => 3 } })
+      expect(hash['one']).to eq({ 'two' => [1,2], 'three' => 3 })
     end
 
     it 'should not change the original hashes 3' do
       hash1 = {'one' => { 'two' => [1,2, {'two' => 2} ] } }
       hash2 = { 'one' => { 'three' => 3 } }
       hash = scope.function_deep_merge([hash1, hash2])
-      hash1.should == {'one' => { 'two' => [1,2, {'two' => 2}] } }
-      hash2.should == { 'one' => { 'three' => 3 } }
-      hash['one'].should == { 'two' => [1,2, {'two' => 2} ], 'three' => 3 }
-      hash['one']['two'].should == [1,2, {'two' => 2}]
+      expect(hash1).to eq({'one' => { 'two' => [1,2, {'two' => 2}] } })
+      expect(hash2).to eq({ 'one' => { 'three' => 3 } })
+      expect(hash['one']).to eq({ 'two' => [1,2, {'two' => 2} ], 'three' => 3 })
+      expect(hash['one']['two']).to eq([1,2, {'two' => 2}])
     end
   end
 end
index 28dbab31192e88ec09c0bb190e1f5d27319fa140..359030474b55baed0d83e13499b2494b2769576e 100755 (executable)
@@ -4,16 +4,16 @@ require 'spec_helper'
 require 'rspec-puppet'
 describe 'defined_with_params' do
   describe 'when a resource is not specified' do
-    it { should run.with_params().and_raise_error(ArgumentError) }
+    it { is_expected.to run.with_params().and_raise_error(ArgumentError) }
   end
   describe 'when compared against a resource with no attributes' do
     let :pre_condition do
       'user { "dan": }'
     end
     it do
-      should run.with_params('User[dan]', {}).and_return(true)
-      should run.with_params('User[bob]', {}).and_return(false)
-      should run.with_params('User[dan]', {'foo' => 'bar'}).and_return(false)
+      is_expected.to run.with_params('User[dan]', {}).and_return(true)
+      is_expected.to run.with_params('User[bob]', {}).and_return(false)
+      is_expected.to run.with_params('User[dan]', {'foo' => 'bar'}).and_return(false)
     end
   end
 
@@ -22,14 +22,14 @@ describe 'defined_with_params' do
       'user { "dan": ensure => present, shell => "/bin/csh", managehome => false}'
     end
     it do
-      should run.with_params('User[dan]', {}).and_return(true)
-      should run.with_params('User[dan]', '').and_return(true)
-      should run.with_params('User[dan]', {'ensure' => 'present'}
+      is_expected.to run.with_params('User[dan]', {}).and_return(true)
+      is_expected.to run.with_params('User[dan]', '').and_return(true)
+      is_expected.to run.with_params('User[dan]', {'ensure' => 'present'}
                             ).and_return(true)
-      should run.with_params('User[dan]',
+      is_expected.to run.with_params('User[dan]',
                              {'ensure' => 'present', 'managehome' => false}
                             ).and_return(true)
-      should run.with_params('User[dan]',
+      is_expected.to run.with_params('User[dan]',
                              {'ensure' => 'absent', 'managehome' => false}
                             ).and_return(false)
     end
index 593cf45929f38520418c77f88299d6b9d45517f4..7c20aec42c96026712e335b091122edad9cc33d4 100755 (executable)
@@ -5,21 +5,21 @@ describe "the delete_at function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("delete_at").should == "function_delete_at"
+    expect(Puppet::Parser::Functions.function("delete_at")).to eq("function_delete_at")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_delete_at([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_delete_at([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should delete an item at specified location from an array" do
     result = scope.function_delete_at([['a','b','c'],1])
-    result.should(eq(['a','c']))
+    expect(result).to(eq(['a','c']))
   end
 
   it "should not change origin array passed as argument" do
     origin_array = ['a','b','c','d']
     result = scope.function_delete_at([origin_array, 1])
-    origin_array.should(eq(['a','b','c','d']))
+    expect(origin_array).to(eq(['a','b','c','d']))
   end
 end
index 1508a63e914eb93a0a65f28e03f1fbb06c5ebc0e..39b3176d0dac9c2c00061105e2fe6a106d08dc70 100755 (executable)
@@ -5,52 +5,52 @@ describe "the delete function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("delete").should == "function_delete"
+    expect(Puppet::Parser::Functions.function("delete")).to eq("function_delete")
   end
 
   it "should raise a ParseError if there are fewer than 2 arguments" do
-    lambda { scope.function_delete([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_delete([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should raise a ParseError if there are greater than 2 arguments" do
-    lambda { scope.function_delete([[], 'foo', 'bar']) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_delete([[], 'foo', 'bar']) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should raise a TypeError if a number is passed as the first argument" do
-    lambda { scope.function_delete([1, 'bar']) }.should( raise_error(TypeError))
+    expect { scope.function_delete([1, 'bar']) }.to( raise_error(TypeError))
   end
 
   it "should delete all instances of an element from an array" do
     result = scope.function_delete([['a','b','c','b'],'b'])
-    result.should(eq(['a','c']))
+    expect(result).to(eq(['a','c']))
   end
 
   it "should delete all instances of a substring from a string" do
     result = scope.function_delete(['foobarbabarz','bar'])
-    result.should(eq('foobaz'))
+    expect(result).to(eq('foobaz'))
   end
 
   it "should delete a key from a hash" do
     result = scope.function_delete([{ 'a' => 1, 'b' => 2, 'c' => 3 },'b'])
-    result.should(eq({ 'a' => 1, 'c' => 3 }))
+    expect(result).to(eq({ 'a' => 1, 'c' => 3 }))
   end
 
   it "should not change origin array passed as argument" do
     origin_array = ['a','b','c','d']
     result = scope.function_delete([origin_array, 'b'])
-    origin_array.should(eq(['a','b','c','d']))
+    expect(origin_array).to(eq(['a','b','c','d']))
   end
 
   it "should not change the origin string passed as argument" do
     origin_string = 'foobarbabarz'
     result = scope.function_delete([origin_string,'bar'])
-    origin_string.should(eq('foobarbabarz'))
+    expect(origin_string).to(eq('foobarbabarz'))
   end
 
   it "should not change origin hash passed as argument" do
     origin_hash = { 'a' => 1, 'b' => 2, 'c' => 3 }
     result = scope.function_delete([origin_hash, 'b'])
-    origin_hash.should(eq({ 'a' => 1, 'b' => 2, 'c' => 3 }))
+    expect(origin_hash).to(eq({ 'a' => 1, 'b' => 2, 'c' => 3 }))
   end
 
 end
index b341d888ae1411cc855989336bc98010a4346f67..dc679535f4125cf3345e7c135191dcbdcfe9493a 100755 (executable)
@@ -5,37 +5,37 @@ describe "the delete_undef_values function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("delete_undef_values").should == "function_delete_undef_values"
+    expect(Puppet::Parser::Functions.function("delete_undef_values")).to eq("function_delete_undef_values")
   end
 
   it "should raise a ParseError if there is less than 1 argument" do
-    lambda { scope.function_delete_undef_values([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_delete_undef_values([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should raise a ParseError if the argument is not Array nor Hash" do
-    lambda { scope.function_delete_undef_values(['']) }.should( raise_error(Puppet::ParseError))
-    lambda { scope.function_delete_undef_values([nil]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_delete_undef_values(['']) }.to( raise_error(Puppet::ParseError))
+    expect { scope.function_delete_undef_values([nil]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should delete all undef items from Array and only these" do
     result = scope.function_delete_undef_values([['a',:undef,'c','undef']])
-    result.should(eq(['a','c','undef']))
+    expect(result).to(eq(['a','c','undef']))
   end
 
   it "should delete all undef items from Hash and only these" do
     result = scope.function_delete_undef_values([{'a'=>'A','b'=>:undef,'c'=>'C','d'=>'undef'}])
-    result.should(eq({'a'=>'A','c'=>'C','d'=>'undef'}))
+    expect(result).to(eq({'a'=>'A','c'=>'C','d'=>'undef'}))
   end
 
   it "should not change origin array passed as argument" do
     origin_array = ['a',:undef,'c','undef']
     result = scope.function_delete_undef_values([origin_array])
-    origin_array.should(eq(['a',:undef,'c','undef']))
+    expect(origin_array).to(eq(['a',:undef,'c','undef']))
   end
 
   it "should not change origin hash passed as argument" do
     origin_hash = { 'a' => 1, 'b' => :undef, 'c' => 'undef' }
     result = scope.function_delete_undef_values([origin_hash])
-    origin_hash.should(eq({ 'a' => 1, 'b' => :undef, 'c' => 'undef' }))
+    expect(origin_hash).to(eq({ 'a' => 1, 'b' => :undef, 'c' => 'undef' }))
   end
 end
index 8d7f2315d4601c4895e61bb4519295832deabadf..4f4d411b8442d0825cc39f37822a84b6771bb945 100755 (executable)
@@ -5,32 +5,32 @@ describe "the delete_values function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("delete_values").should == "function_delete_values"
+    expect(Puppet::Parser::Functions.function("delete_values")).to eq("function_delete_values")
   end
 
   it "should raise a ParseError if there are fewer than 2 arguments" do
-    lambda { scope.function_delete_values([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_delete_values([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should raise a ParseError if there are greater than 2 arguments" do
-    lambda { scope.function_delete_values([[], 'foo', 'bar']) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_delete_values([[], 'foo', 'bar']) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should raise a TypeError if the argument is not a hash" do
-    lambda { scope.function_delete_values([1,'bar']) }.should( raise_error(TypeError))
-    lambda { scope.function_delete_values(['foo','bar']) }.should( raise_error(TypeError))
-    lambda { scope.function_delete_values([[],'bar']) }.should( raise_error(TypeError))
+    expect { scope.function_delete_values([1,'bar']) }.to( raise_error(TypeError))
+    expect { scope.function_delete_values(['foo','bar']) }.to( raise_error(TypeError))
+    expect { scope.function_delete_values([[],'bar']) }.to( raise_error(TypeError))
   end
 
   it "should delete all instances of a value from a hash" do
     result = scope.function_delete_values([{ 'a'=>'A', 'b'=>'B', 'B'=>'C', 'd'=>'B' },'B'])
-    result.should(eq({ 'a'=>'A', 'B'=>'C' }))
+    expect(result).to(eq({ 'a'=>'A', 'B'=>'C' }))
   end
 
   it "should not change origin hash passed as argument" do
     origin_hash = { 'a' => 1, 'b' => 2, 'c' => 3 }
     result = scope.function_delete_values([origin_hash, 2])
-    origin_hash.should(eq({ 'a' => 1, 'b' => 2, 'c' => 3 }))
+    expect(origin_hash).to(eq({ 'a' => 1, 'b' => 2, 'c' => 3 }))
   end
 
 end
index 9feff0918905d90a851c84a48b06d97a8dab1701..24b2b1bc630a721c607ec3892c955f2a35ace84b 100755 (executable)
@@ -5,15 +5,15 @@ describe "the difference function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("difference").should == "function_difference"
+    expect(Puppet::Parser::Functions.function("difference")).to eq("function_difference")
   end
 
   it "should raise a ParseError if there are fewer than 2 arguments" do
-    lambda { scope.function_difference([]) }.should( raise_error(Puppet::ParseError) )
+    expect { scope.function_difference([]) }.to( raise_error(Puppet::ParseError) )
   end
 
   it "should return the difference between two arrays" do
     result = scope.function_difference([["a","b","c"],["b","c","d"]])
-    result.should(eq(["a"]))
+    expect(result).to(eq(["a"]))
   end
 end
index fb3b4feca77381adec5a3359370cab71e2c74cf1..8a3bcabfc4b57cec0e45e0937acb5cf5f4b31b0f 100755 (executable)
@@ -5,20 +5,20 @@ describe "the dirname function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("dirname").should == "function_dirname"
+    expect(Puppet::Parser::Functions.function("dirname")).to eq("function_dirname")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_dirname([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_dirname([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return dirname for an absolute path" do
     result = scope.function_dirname(['/path/to/a/file.ext'])
-    result.should(eq('/path/to/a'))
+    expect(result).to(eq('/path/to/a'))
   end
 
   it "should return dirname for a relative path" do
     result = scope.function_dirname(['path/to/a/file.ext'])
-    result.should(eq('path/to/a'))
+    expect(result).to(eq('path/to/a'))
   end
 end
index acef1f05d9230bc4d4d83faa5634dea566f4e92c..a844780b1b0075be2717bd8e8e65e91ae817d762 100755 (executable)
@@ -5,20 +5,20 @@ describe "the downcase function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("downcase").should == "function_downcase"
+    expect(Puppet::Parser::Functions.function("downcase")).to eq("function_downcase")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_downcase([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_downcase([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should downcase a string" do
     result = scope.function_downcase(["ASFD"])
-    result.should(eq("asfd"))
+    expect(result).to(eq("asfd"))
   end
 
   it "should do nothing to a string that is already downcase" do
     result = scope.function_downcase(["asdf asdf"])
-    result.should(eq("asdf asdf"))
+    expect(result).to(eq("asdf asdf"))
   end
 end
index 7745875224865a8b27e5bf6fa6a07c6f5f35d4e8..1f2ace4caf779304cee67ca5f980e270242c4ba1 100755 (executable)
@@ -4,20 +4,20 @@ require 'spec_helper'
 describe "the empty function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
   it "should exist" do
-    Puppet::Parser::Functions.function("empty").should == "function_empty"
+    expect(Puppet::Parser::Functions.function("empty")).to eq("function_empty")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_empty([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_empty([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return a true for an empty string" do
     result = scope.function_empty([''])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return a false for a non-empty string" do
     result = scope.function_empty(['asdf'])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 end
index dba7a6bbdb1c243b22019e618fc8029561c926d5..de8c66d662c4da1e098d598b2adc1af77d5add9b 100755 (executable)
@@ -4,24 +4,24 @@ require 'spec_helper'
 describe "the flatten function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
   it "should exist" do
-    Puppet::Parser::Functions.function("flatten").should == "function_flatten"
+    expect(Puppet::Parser::Functions.function("flatten")).to eq("function_flatten")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_flatten([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_flatten([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should raise a ParseError if there is more than 1 argument" do
-    lambda { scope.function_flatten([[], []]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_flatten([[], []]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should flatten a complex data structure" do
     result = scope.function_flatten([["a","b",["c",["d","e"],"f","g"]]])
-    result.should(eq(["a","b","c","d","e","f","g"]))
+    expect(result).to(eq(["a","b","c","d","e","f","g"]))
   end
 
   it "should do nothing to a structure that is already flat" do
     result = scope.function_flatten([["a","b","c","d"]])
-    result.should(eq(["a","b","c","d"]))
+    expect(result).to(eq(["a","b","c","d"]))
   end
 end
index dbc8c773585ea9b6b74ac1b9064d54440f3bf484..12a69179805bebe2c21e026949cafd2e845bf59a 100755 (executable)
@@ -6,34 +6,34 @@ describe "the floor function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("floor").should == "function_floor"
+    expect(Puppet::Parser::Functions.function("floor")).to eq("function_floor")
   end
 
   it "should raise a ParseError if there is less than 1 argument" do
-    lambda { scope.function_floor([]) }.should( raise_error(Puppet::ParseError, /Wrong number of arguments/))
+    expect { scope.function_floor([]) }.to( raise_error(Puppet::ParseError, /Wrong number of arguments/))
   end
 
   it "should should raise a ParseError if input isn't numeric (eg. String)" do
-    lambda { scope.function_floor(["foo"]) }.should( raise_error(Puppet::ParseError, /Wrong argument type/))
+    expect { scope.function_floor(["foo"]) }.to( raise_error(Puppet::ParseError, /Wrong argument type/))
   end
 
   it "should should raise a ParseError if input isn't numeric (eg. Boolean)" do
-    lambda { scope.function_floor([true]) }.should( raise_error(Puppet::ParseError, /Wrong argument type/))
+    expect { scope.function_floor([true]) }.to( raise_error(Puppet::ParseError, /Wrong argument type/))
   end
 
   it "should return an integer when a numeric type is passed" do
     result = scope.function_floor([12.4])
-    result.is_a?(Integer).should(eq(true))
+    expect(result.is_a?(Integer)).to(eq(true))
   end
 
   it "should return the input when an integer is passed" do
     result = scope.function_floor([7])
-    result.should(eq(7))
+    expect(result).to(eq(7))
   end
 
   it "should return the largest integer less than or equal to the input" do
     result = scope.function_floor([3.8])
-    result.should(eq(3))
+    expect(result).to(eq(3))
   end
 end
 
index 2577723351a4e0f507ad6abf1428a5ea508a0f79..b2dc1f5a3f117b645d6831e173e4bb86916d3760 100755 (executable)
@@ -5,22 +5,22 @@ describe "the fqdn_rotate function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("fqdn_rotate").should == "function_fqdn_rotate"
+    expect(Puppet::Parser::Functions.function("fqdn_rotate")).to eq("function_fqdn_rotate")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_fqdn_rotate([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_fqdn_rotate([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should rotate a string and the result should be the same size" do
     scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1")
     result = scope.function_fqdn_rotate(["asdf"])
-    result.size.should(eq(4))
+    expect(result.size).to(eq(4))
   end
 
   it "should rotate a string to give the same results for one host" do
     scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1").twice
-    scope.function_fqdn_rotate(["abcdefg"]).should eql(scope.function_fqdn_rotate(["abcdefg"]))
+    expect(scope.function_fqdn_rotate(["abcdefg"])).to eql(scope.function_fqdn_rotate(["abcdefg"]))
   end
 
   it "should rotate a string to give different values on different hosts" do
@@ -28,6 +28,6 @@ describe "the fqdn_rotate function" do
      val1 = scope.function_fqdn_rotate(["abcdefghijklmnopqrstuvwxyz01234567890987654321"])
      scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.2")
      val2 = scope.function_fqdn_rotate(["abcdefghijklmnopqrstuvwxyz01234567890987654321"])
-     val1.should_not eql(val2)
+     expect(val1).not_to eql(val2)
   end
 end
index 486bef6f2006d3aa9d194b6199b6276157b80372..38ce64597e1177dcb588c83f336fa23ec4cc7086 100755 (executable)
@@ -29,18 +29,18 @@ describe Puppet::Parser::Functions.function(:get_module_path) do
 
     it 'should be able to find module paths from the modulepath setting' do
       Puppet::Module.expects(:find).with('foo', 'production').returns(path_of_module_foo)
-      scope.function_get_module_path(['foo']).should == path_of_module_foo.path
+      expect(scope.function_get_module_path(['foo'])).to eq(path_of_module_foo.path)
     end
     it 'should be able to find module paths when the modulepath is a list' do
       Puppet[:modulepath] = modulepath + ":/tmp"
       Puppet::Module.expects(:find).with('foo', 'production').returns(path_of_module_foo)
-      scope.function_get_module_path(['foo']).should == path_of_module_foo.path
+      expect(scope.function_get_module_path(['foo'])).to eq(path_of_module_foo.path)
     end
     it 'should respect the environment' do
-      pending("Disabled on Puppet 2.6.x") if Puppet.version =~ /^2\.6\b/
+      skip("Disabled on Puppet 2.6.x") if Puppet.version =~ /^2\.6\b/
       Puppet.settings[:environment] = 'danstestenv'
       Puppet::Module.expects(:find).with('foo', 'danstestenv').returns(path_of_module_foo)
-      scope('danstestenv').function_get_module_path(['foo']).should == path_of_module_foo.path
+      expect(scope('danstestenv').function_get_module_path(['foo'])).to eq(path_of_module_foo.path)
     end
   end
 end
index bf024af0e5c3dcbae3e1aae78ea24f2bcc6a3f68..833c4d4fb98ea31863b03704c4a1b76f2c56f6b9 100755 (executable)
@@ -25,7 +25,7 @@ describe 'getparam' do
   end
 
   it "should exist" do
-    Puppet::Parser::Functions.function("getparam").should == "function_getparam"
+    expect(Puppet::Parser::Functions.function("getparam")).to eq("function_getparam")
   end
 
   describe 'when a resource is not specified' do
index 5ff834ee71efa1d78d6918d767c59fd5d0e156c1..87ab9b5ac55d91c1eaa319f53b5dc6af71b1be4f 100755 (executable)
@@ -6,7 +6,7 @@ describe Puppet::Parser::Functions.function(:getvar) do
   describe 'when calling getvar from puppet' do
 
     it "should not compile when no arguments are passed" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
       Puppet[:code] = '$foo = getvar()'
       expect {
         scope.compiler.compile
@@ -14,7 +14,7 @@ describe Puppet::Parser::Functions.function(:getvar) do
     end
 
     it "should not compile when too many arguments are passed" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
       Puppet[:code] = '$foo = getvar("foo::bar", "baz")'
       expect {
         scope.compiler.compile
@@ -22,7 +22,7 @@ describe Puppet::Parser::Functions.function(:getvar) do
     end
 
     it "should lookup variables in other namespaces" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
       Puppet[:code] = <<-'ENDofPUPPETcode'
         class site::data { $foo = 'baz' }
         include site::data
index a93b842537e042a7d80a6df57e082563acc620e6..9c671dd8609fa73eda5ee8d8451adc3a9eb07ea9 100755 (executable)
@@ -5,15 +5,15 @@ describe "the grep function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("grep").should == "function_grep"
+    expect(Puppet::Parser::Functions.function("grep")).to eq("function_grep")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_grep([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_grep([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should grep contents from an array" do
     result = scope.function_grep([["aaabbb","bbbccc","dddeee"], "bbb"])
-    result.should(eq(["aaabbb","bbbccc"]))
+    expect(result).to(eq(["aaabbb","bbbccc"]))
   end
 end
index c5264e4f309906827f3485516ace8491b3b8f8c0..23e09a955291c5e21ccdffab9772286e3d41da05 100755 (executable)
@@ -20,10 +20,10 @@ describe Puppet::Parser::Functions.function(:has_interface_with) do
       scope.stubs(:lookupvar).with("interfaces").returns('lo0,gif0,stf0,en1,p2p0,fw0,en0,vmnet1,vmnet8,utun0')
     end
     it 'should have loopback (lo0)' do
-      subject.call(['lo0']).should be_true
+      expect(subject.call(['lo0'])).to be_truthy
     end
     it 'should not have loopback (lo)' do
-      subject.call(['lo']).should be_false
+      expect(subject.call(['lo'])).to be_falsey
     end
   end
   context "On Linux Systems" do
@@ -37,28 +37,28 @@ describe Puppet::Parser::Functions.function(:has_interface_with) do
       scope.stubs(:lookupvar).with('muppet_eth0').returns('kermit')
     end
     it 'should have loopback (lo)' do
-      subject.call(['lo']).should be_true
+      expect(subject.call(['lo'])).to be_truthy
     end
     it 'should not have loopback (lo0)' do
-      subject.call(['lo0']).should be_false
+      expect(subject.call(['lo0'])).to be_falsey
     end
     it 'should have ipaddress with 127.0.0.1' do
-      subject.call(['ipaddress', '127.0.0.1']).should be_true
+      expect(subject.call(['ipaddress', '127.0.0.1'])).to be_truthy
     end
     it 'should have ipaddress with 10.0.0.1' do
-      subject.call(['ipaddress', '10.0.0.1']).should be_true
+      expect(subject.call(['ipaddress', '10.0.0.1'])).to be_truthy
     end
     it 'should not have ipaddress with 10.0.0.2' do
-      subject.call(['ipaddress', '10.0.0.2']).should be_false
+      expect(subject.call(['ipaddress', '10.0.0.2'])).to be_falsey
     end
     it 'should have muppet named kermit' do
-      subject.call(['muppet', 'kermit']).should be_true
+      expect(subject.call(['muppet', 'kermit'])).to be_truthy
     end
     it 'should have muppet named mspiggy' do
-      subject.call(['muppet', 'mspiggy']).should be_true
+      expect(subject.call(['muppet', 'mspiggy'])).to be_truthy
     end
     it 'should not have muppet named bigbird' do
-      subject.call(['muppet', 'bigbird']).should be_false
+      expect(subject.call(['muppet', 'bigbird'])).to be_falsey
     end
   end
 end
index 5a684608209403edf956ac034e9eb6fa7d9f4432..0df12a7be3444c1b15942c0f3537cfc4e9792fd1 100755 (executable)
@@ -21,19 +21,19 @@ describe Puppet::Parser::Functions.function(:has_ip_address) do
     end
 
     it 'should have primary address (10.0.2.15)' do
-      subject.call(['10.0.2.15']).should be_true
+      expect(subject.call(['10.0.2.15'])).to be_truthy
     end
 
     it 'should have lookupback address (127.0.0.1)' do
-      subject.call(['127.0.0.1']).should be_true
+      expect(subject.call(['127.0.0.1'])).to be_truthy
     end
 
     it 'should not have other address' do
-      subject.call(['192.1681.1.1']).should be_false
+      expect(subject.call(['192.1681.1.1'])).to be_falsey
     end
 
     it 'should not have "mspiggy" on an interface' do
-      subject.call(['mspiggy']).should be_false
+      expect(subject.call(['mspiggy'])).to be_falsey
     end
   end
 end
index c3a289e37283b4d6d929906e5833f923a86657c5..2a2578e234084d36d0ed06f536cd851cc4ebb932 100755 (executable)
@@ -21,15 +21,15 @@ describe Puppet::Parser::Functions.function(:has_ip_network) do
     end
 
     it 'should have primary network (10.0.2.0)' do
-      subject.call(['10.0.2.0']).should be_true
+      expect(subject.call(['10.0.2.0'])).to be_truthy
     end
 
     it 'should have loopback network (127.0.0.0)' do
-      subject.call(['127.0.0.1']).should be_true
+      expect(subject.call(['127.0.0.1'])).to be_truthy
     end
 
     it 'should not have other network' do
-      subject.call(['192.168.1.0']).should be_false
+      expect(subject.call(['192.168.1.0'])).to be_falsey
     end
   end
 end
index 490daeae7cc2d30b67854b87ff783ee4be4ed52a..6b718005aaab92368aa17ff7956e7c281be242d2 100755 (executable)
@@ -6,7 +6,7 @@ describe Puppet::Parser::Functions.function(:has_key) do
 
   describe 'when calling has_key from puppet' do
     it "should not compile when no arguments are passed" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
       Puppet[:code] = '$x = has_key()'
       expect {
         scope.compiler.compile
@@ -14,7 +14,7 @@ describe Puppet::Parser::Functions.function(:has_key) do
     end
 
     it "should not compile when 1 argument is passed" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
       Puppet[:code] = "$x = has_key('foo')"
       expect {
         scope.compiler.compile
@@ -22,7 +22,7 @@ describe Puppet::Parser::Functions.function(:has_key) do
     end
 
     it "should require the first value to be a Hash" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
       Puppet[:code] = "$x = has_key('foo', 'bar')"
       expect {
         scope.compiler.compile
@@ -32,11 +32,11 @@ describe Puppet::Parser::Functions.function(:has_key) do
 
   describe 'when calling the function has_key from a scope instance' do
     it 'should detect existing keys' do
-      scope.function_has_key([{'one' => 1}, 'one']).should be_true
+      expect(scope.function_has_key([{'one' => 1}, 'one'])).to be_truthy
     end
 
     it 'should detect existing keys' do
-      scope.function_has_key([{'one' => 1}, 'two']).should be_false
+      expect(scope.function_has_key([{'one' => 1}, 'two'])).to be_falsey
     end
   end
 end
index 7c91be9077fdc515b52ce9e9bc2d4b4bebf1c3c2..ec2988b028b0461dc77694009e97daa979d5b486 100755 (executable)
@@ -5,15 +5,15 @@ describe "the hash function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("hash").should == "function_hash"
+    expect(Puppet::Parser::Functions.function("hash")).to eq("function_hash")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_hash([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_hash([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should convert an array to a hash" do
     result = scope.function_hash([['a',1,'b',2,'c',3]])
-    result.should(eq({'a'=>1,'b'=>2,'c'=>3}))
+    expect(result).to(eq({'a'=>1,'b'=>2,'c'=>3}))
   end
 end
index fd44f7fe3dca7fadd47f82459ab2b443e2395c72..6361304fecc34ec38ba61f276adeed330db2137f 100755 (executable)
@@ -5,15 +5,15 @@ describe "the intersection function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("intersection").should == "function_intersection"
+    expect(Puppet::Parser::Functions.function("intersection")).to eq("function_intersection")
   end
 
   it "should raise a ParseError if there are fewer than 2 arguments" do
-    lambda { scope.function_intersection([]) }.should( raise_error(Puppet::ParseError) )
+    expect { scope.function_intersection([]) }.to( raise_error(Puppet::ParseError) )
   end
 
   it "should return the intersection of two arrays" do
     result = scope.function_intersection([["a","b","c"],["b","c","d"]])
-    result.should(eq(["b","c"]))
+    expect(result).to(eq(["b","c"]))
   end
 end
index e7f4bcd6df4b931534c02c8a37e08c08a24287ff..94920a4cbe516b7bc095d58186c7e8c74b0e32b7 100755 (executable)
@@ -5,25 +5,25 @@ describe "the is_array function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("is_array").should == "function_is_array"
+    expect(Puppet::Parser::Functions.function("is_array")).to eq("function_is_array")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_is_array([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_is_array([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return true if passed an array" do
     result = scope.function_is_array([[1,2,3]])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return false if passed a hash" do
     result = scope.function_is_array([{'a'=>1}])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if passed a string" do
     result = scope.function_is_array(["asdf"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 end
index c94e83a9d9feda9ac68b6450e77c42fcab93a19d..4a342ba4f31c6c4243b1e22213ab666826a7a445 100755 (executable)
@@ -5,40 +5,40 @@ describe "the is_bool function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("is_bool").should == "function_is_bool"
+    expect(Puppet::Parser::Functions.function("is_bool")).to eq("function_is_bool")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_is_bool([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_is_bool([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return true if passed a TrueClass" do
     result = scope.function_is_bool([true])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return true if passed a FalseClass" do
     result = scope.function_is_bool([false])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return false if passed the string 'true'" do
     result = scope.function_is_bool(['true'])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if passed the string 'false'" do
     result = scope.function_is_bool(['false'])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if passed an array" do
     result = scope.function_is_bool([["a","b"]])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if passed a hash" do
     result = scope.function_is_bool([{"a" => "b"}])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 end
index f2ea76dac70b2bf918cf9cfc50d40842007b715d..4d05f5cdc58d5858ff696759612ea012d642eb92 100755 (executable)
@@ -5,60 +5,60 @@ describe "the is_domain_name function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("is_domain_name").should == "function_is_domain_name"
+    expect(Puppet::Parser::Functions.function("is_domain_name")).to eq("function_is_domain_name")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_is_domain_name([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_is_domain_name([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return true if a valid short domain name" do
     result = scope.function_is_domain_name(["x.com"])
-    result.should(be_true)
+    expect(result).to(be_truthy)
   end
 
   it "should return true if the domain is ." do
     result = scope.function_is_domain_name(["."])
-    result.should(be_true)
+    expect(result).to(be_truthy)
   end
 
   it "should return true if the domain is x.com." do
     result = scope.function_is_domain_name(["x.com."])
-    result.should(be_true)
+    expect(result).to(be_truthy)
   end
 
   it "should return true if a valid domain name" do
     result = scope.function_is_domain_name(["foo.bar.com"])
-    result.should(be_true)
+    expect(result).to(be_truthy)
   end
 
   it "should allow domain parts to start with numbers" do
     result = scope.function_is_domain_name(["3foo.2bar.com"])
-    result.should(be_true)
+    expect(result).to(be_truthy)
   end
 
   it "should allow domain to end with a dot" do
     result = scope.function_is_domain_name(["3foo.2bar.com."])
-    result.should(be_true)
+    expect(result).to(be_truthy)
   end
 
   it "should allow a single part domain" do
     result = scope.function_is_domain_name(["orange"])
-    result.should(be_true)
+    expect(result).to(be_truthy)
   end
 
   it "should return false if domain parts start with hyphens" do
     result = scope.function_is_domain_name(["-3foo.2bar.com"])
-    result.should(be_false)
+    expect(result).to(be_falsey)
   end
 
   it "should return true if domain contains hyphens" do
     result = scope.function_is_domain_name(["3foo-bar.2bar-fuzz.com"])
-    result.should(be_true)
+    expect(result).to(be_truthy)
   end
 
   it "should return false if domain name contains spaces" do
     result = scope.function_is_domain_name(["not valid"])
-    result.should(be_false)
+    expect(result).to(be_falsey)
   end
 end
index b7d73b04a2559901c926a221e1853927db6f3f48..d926634e83353025ba18d5b8da4cae8d0ec946bc 100755 (executable)
@@ -5,29 +5,29 @@ describe "the is_float function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("is_float").should == "function_is_float"
+    expect(Puppet::Parser::Functions.function("is_float")).to eq("function_is_float")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_is_float([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_is_float([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return true if a float" do
     result = scope.function_is_float(["0.12"])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return false if a string" do
     result = scope.function_is_float(["asdf"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if an integer" do
     result = scope.function_is_float(["3"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
   it "should return true if a float is created from an arithmetical operation" do
     result = scope.function_is_float([3.2*2])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 end
index d5669a75837fc4ab90e71eb3a6db2daf62a2c434..3a9aa1b2302b91d4bb12fcc87f2d759c4032b7fe 100755 (executable)
@@ -11,21 +11,21 @@ describe "the is_function_available function" do
   end
 
   it "should exist" do
-    Puppet::Parser::Functions.function("is_function_available").should == "function_is_function_available"
+    expect(Puppet::Parser::Functions.function("is_function_available")).to eq("function_is_function_available")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { @scope.function_is_function_available([]) }.should( raise_error(Puppet::ParseError))
+    expect { @scope.function_is_function_available([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return false if a nonexistent function is passed" do
     result = @scope.function_is_function_available(['jeff_mccunes_left_sock'])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return true if an available function is passed" do
     result = @scope.function_is_function_available(['require'])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
 end
index bbebf39f9c72783ceff58fbb918d92e141e0eb65..a8494111136df11056b8ea3c8511b42f0975ba66 100755 (executable)
@@ -5,25 +5,25 @@ describe "the is_hash function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("is_hash").should == "function_is_hash"
+    expect(Puppet::Parser::Functions.function("is_hash")).to eq("function_is_hash")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_is_hash([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_is_hash([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return true if passed a hash" do
     result = scope.function_is_hash([{"a"=>1,"b"=>2}])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return false if passed an array" do
     result = scope.function_is_hash([["a","b"]])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if passed a string" do
     result = scope.function_is_hash(["asdf"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 end
index 24141cc7b7e679b926a5ae94f8f09896573dd299..f0cbca807fe5b943098e414994f5cce8ca37dbd4 100755 (executable)
@@ -5,65 +5,65 @@ describe "the is_integer function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("is_integer").should == "function_is_integer"
+    expect(Puppet::Parser::Functions.function("is_integer")).to eq("function_is_integer")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_is_integer([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_is_integer([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return true if an integer" do
     result = scope.function_is_integer(["3"])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return true if a negative integer" do
     result = scope.function_is_integer(["-7"])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return false if a float" do
     result = scope.function_is_integer(["3.2"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if a string" do
     result = scope.function_is_integer(["asdf"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return true if an integer is created from an arithmetical operation" do
     result = scope.function_is_integer([3*2])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return false if an array" do
     result = scope.function_is_numeric([["asdf"]])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if a hash" do
     result = scope.function_is_numeric([{"asdf" => false}])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if a boolean" do
     result = scope.function_is_numeric([true])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if a whitespace is in the string" do
     result = scope.function_is_numeric([" -1324"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if it is zero prefixed" do
     result = scope.function_is_numeric(["0001234"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if it is wrapped inside an array" do
     result = scope.function_is_numeric([[1234]])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 end
index c0debb3d43b11166143877aa1b0bf98d0d005977..c16d12b16be4f7c4834e6ddb021c3f343ceaae39 100755 (executable)
@@ -5,35 +5,35 @@ describe "the is_ip_address function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("is_ip_address").should == "function_is_ip_address"
+    expect(Puppet::Parser::Functions.function("is_ip_address")).to eq("function_is_ip_address")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_is_ip_address([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_is_ip_address([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return true if an IPv4 address" do
     result = scope.function_is_ip_address(["1.2.3.4"])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return true if a full IPv6 address" do
     result = scope.function_is_ip_address(["fe80:0000:cd12:d123:e2f8:47ff:fe09:dd74"])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return true if a compressed IPv6 address" do
     result = scope.function_is_ip_address(["fe00::1"])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return false if not valid" do
     result = scope.function_is_ip_address(["asdf"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if IP octets out of range" do
     result = scope.function_is_ip_address(["1.1.1.300"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 end
index ca9c5904767f565ac71f780693eb2af70d68eac2..66edd197e450e9130b41b5e57d671a96a4771dbd 100755 (executable)
@@ -5,25 +5,25 @@ describe "the is_mac_address function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("is_mac_address").should == "function_is_mac_address"
+    expect(Puppet::Parser::Functions.function("is_mac_address")).to eq("function_is_mac_address")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_is_mac_address([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_is_mac_address([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return true if a valid mac address" do
     result = scope.function_is_mac_address(["00:a0:1f:12:7f:a0"])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return false if octets are out of range" do
     result = scope.function_is_mac_address(["00:a0:1f:12:7f:g0"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if not valid" do
     result = scope.function_is_mac_address(["not valid"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 end
index 1df149787115dfa918c97b904b52bcff706687b6..4176961d7af2f7c4f09e13ce25c2635072994db2 100755 (executable)
@@ -5,71 +5,71 @@ describe "the is_numeric function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("is_numeric").should == "function_is_numeric"
+    expect(Puppet::Parser::Functions.function("is_numeric")).to eq("function_is_numeric")
   end
 
   it "should raise a ParseError if there is less than 1 argument" do
-    lambda { scope.function_is_numeric([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_is_numeric([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return true if an integer" do
     result = scope.function_is_numeric(["3"])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return true if a float" do
     result = scope.function_is_numeric(["3.2"])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return true if an integer is created from an arithmetical operation" do
     result = scope.function_is_numeric([3*2])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return true if a float is created from an arithmetical operation" do
     result = scope.function_is_numeric([3.2*2])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return false if a string" do
     result = scope.function_is_numeric(["asdf"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if an array" do
     result = scope.function_is_numeric([["asdf"]])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if an array of integers" do
     result = scope.function_is_numeric([[1,2,3,4]])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if a hash" do
     result = scope.function_is_numeric([{"asdf" => false}])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if a hash with numbers in it" do
     result = scope.function_is_numeric([{1 => 2}])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if a boolean" do
     result = scope.function_is_numeric([true])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return true if a negative float with exponent" do
     result = scope.function_is_numeric(["-342.2315e-12"])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return false if a negative integer with whitespaces before/after the dash" do
     result = scope.function_is_numeric([" -  751"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
 #  it "should return true if a hexadecimal" do
index 3756bea8b5fa26582294434fa2fed2be81db2a85..6a0801ae8414bca7db66dfca84e8eed646ad670c 100755 (executable)
@@ -5,30 +5,30 @@ describe "the is_string function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("is_string").should == "function_is_string"
+    expect(Puppet::Parser::Functions.function("is_string")).to eq("function_is_string")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_is_string([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_is_string([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return true if a string" do
     result = scope.function_is_string(["asdf"])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return false if an integer" do
     result = scope.function_is_string(["3"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if a float" do
     result = scope.function_is_string(["3.23"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return false if an array" do
     result = scope.function_is_string([["a","b","c"]])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 end
index a52fb719f275e3567d517ab378f2ea9d1c9ff4b2..4a9ae87a21818cbd4fcb33ee7892b635320c4bc8 100755 (executable)
@@ -5,36 +5,36 @@ describe "the join_keys_to_values function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("join_keys_to_values").should == "function_join_keys_to_values"
+    expect(Puppet::Parser::Functions.function("join_keys_to_values")).to eq("function_join_keys_to_values")
   end
 
   it "should raise a ParseError if there are fewer than two arguments" do
-    lambda { scope.function_join_keys_to_values([{}]) }.should raise_error Puppet::ParseError
+    expect { scope.function_join_keys_to_values([{}]) }.to raise_error Puppet::ParseError
   end
 
   it "should raise a ParseError if there are greater than two arguments" do
-    lambda { scope.function_join_keys_to_values([{}, 'foo', 'bar']) }.should raise_error Puppet::ParseError
+    expect { scope.function_join_keys_to_values([{}, 'foo', 'bar']) }.to raise_error Puppet::ParseError
   end
 
   it "should raise a TypeError if the first argument is an array" do
-    lambda { scope.function_join_keys_to_values([[1,2], ',']) }.should raise_error TypeError
+    expect { scope.function_join_keys_to_values([[1,2], ',']) }.to raise_error TypeError
   end
 
   it "should raise a TypeError if the second argument is an array" do
-    lambda { scope.function_join_keys_to_values([{}, [1,2]]) }.should raise_error TypeError
+    expect { scope.function_join_keys_to_values([{}, [1,2]]) }.to raise_error TypeError
   end
 
   it "should raise a TypeError if the second argument is a number" do
-    lambda { scope.function_join_keys_to_values([{}, 1]) }.should raise_error TypeError
+    expect { scope.function_join_keys_to_values([{}, 1]) }.to raise_error TypeError
   end
 
   it "should return an empty array given an empty hash" do
     result = scope.function_join_keys_to_values([{}, ":"])
-    result.should == []
+    expect(result).to eq([])
   end
 
   it "should join hash's keys to its values" do
     result = scope.function_join_keys_to_values([{'a'=>1,2=>'foo',:b=>nil}, ":"])
-    result.should =~ ['a:1','2:foo','b:']
+    expect(result).to match_array(['a:1','2:foo','b:'])
   end
 end
index aafa1a7f76eaa52d5541919c2962bbc4fd40ed59..793c36fa32da6f2975d056a47811ecf928eeccfe 100755 (executable)
@@ -5,15 +5,15 @@ describe "the join function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("join").should == "function_join"
+    expect(Puppet::Parser::Functions.function("join")).to eq("function_join")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_join([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_join([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should join an array into a string" do
     result = scope.function_join([["a","b","c"], ":"])
-    result.should(eq("a:b:c"))
+    expect(result).to(eq("a:b:c"))
   end
 end
index fdd7a7073e51befc45873e7e6ecd98401e9eba56..f2e7d428ebb7ceeef2567eb05cb1a84b85929086 100755 (executable)
@@ -5,17 +5,17 @@ describe "the keys function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("keys").should == "function_keys"
+    expect(Puppet::Parser::Functions.function("keys")).to eq("function_keys")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_keys([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_keys([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return an array of keys when given a hash" do
     result = scope.function_keys([{'a'=>1, 'b'=>2}])
     # =~ performs 'array with same elements' (set) matching
     # For more info see RSpec::Matchers::MatchArray
-    result.should =~ ['a','b']
+    expect(result).to match_array(['a','b'])
   end
 end
index fe163182671893ecdd7c692179a599e66242eec9..cdc3d6f5150bde6aaf894ada21bc1566413f3d2b 100755 (executable)
@@ -7,7 +7,7 @@ describe "the loadyaml function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("loadyaml").should == "function_loadyaml"
+    expect(Puppet::Parser::Functions.function("loadyaml")).to eq("function_loadyaml")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
@@ -20,6 +20,6 @@ describe "the loadyaml function" do
       fh.write("---\n aaa: 1\n bbb: 2\n ccc: 3\n ddd: 4\n")
     end
     result = scope.function_loadyaml([yaml_file])
-    result.should == {"aaa" => 1, "bbb" => 2, "ccc" => 3, "ddd" => 4 }
+    expect(result).to eq({"aaa" => 1, "bbb" => 2, "ccc" => 3, "ddd" => 4 })
   end
 end
index b280ae7ac1dbdcf3868c4483493e4bb9b609ffe0..7025f97b838326a9b99a33dc3464e195b5ff1e99 100755 (executable)
@@ -5,15 +5,15 @@ describe "the lstrip function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("lstrip").should == "function_lstrip"
+    expect(Puppet::Parser::Functions.function("lstrip")).to eq("function_lstrip")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_lstrip([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_lstrip([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should lstrip a string" do
     result = scope.function_lstrip(["  asdf"])
-    result.should(eq('asdf'))
+    expect(result).to(eq('asdf'))
   end
 end
index ff6f2b361c3a8e6e8d780fff8509e053bbb071dc..c3d8a132fad918efd726ef12d34d716baae90c2a 100755 (executable)
@@ -6,22 +6,22 @@ describe "the max function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("max").should == "function_max"
+    expect(Puppet::Parser::Functions.function("max")).to eq("function_max")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_max([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_max([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should be able to compare strings" do
-    scope.function_max(["albatross","dog","horse"]).should(eq("horse"))
+    expect(scope.function_max(["albatross","dog","horse"])).to(eq("horse"))
   end
 
   it "should be able to compare numbers" do
-    scope.function_max([6,8,4]).should(eq(8))
+    expect(scope.function_max([6,8,4])).to(eq(8))
   end
 
   it "should be able to compare a number with a stringified number" do
-    scope.function_max([1,"2"]).should(eq("2"))
+    expect(scope.function_max([1,"2"])).to(eq("2"))
   end
 end
index 6e9a023fa46940a4d534f752cc833a324a9739a4..cee611082fe84ae8b244f9ac59ceb4eb5469ac19 100755 (executable)
@@ -5,20 +5,20 @@ describe "the member function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("member").should == "function_member"
+    expect(Puppet::Parser::Functions.function("member")).to eq("function_member")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_member([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_member([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return true if a member is in an array" do
     result = scope.function_member([["a","b","c"], "a"])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should return false if a member is not in an array" do
     result = scope.function_member([["a","b","c"], "d"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 end
index 15a5d94cf8249c6af2b4902f585effba5c526ca7..2abf97622418cc0c4f0a194dc1d63d924e8db2ba 100755 (executable)
@@ -7,7 +7,7 @@ describe Puppet::Parser::Functions.function(:merge) do
 
   describe 'when calling merge from puppet' do
     it "should not compile when no arguments are passed" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
       Puppet[:code] = '$x = merge()'
       expect {
         scope.compiler.compile
@@ -15,7 +15,7 @@ describe Puppet::Parser::Functions.function(:merge) do
     end
 
     it "should not compile when 1 argument is passed" do
-      pending("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
+      skip("Fails on 2.6.x, see bug #15912") if Puppet.version =~ /^2\.6\./
       Puppet[:code] = "$my_hash={'one' => 1}\n$x = merge($my_hash)"
       expect {
         scope.compiler.compile
@@ -35,18 +35,18 @@ describe Puppet::Parser::Functions.function(:merge) do
 
     it 'should be able to merge two hashes' do
       new_hash = scope.function_merge([{'one' => '1', 'two' => '1'}, {'two' => '2', 'three' => '2'}])
-      new_hash['one'].should   == '1'
-      new_hash['two'].should   == '2'
-      new_hash['three'].should == '2'
+      expect(new_hash['one']).to   eq('1')
+      expect(new_hash['two']).to   eq('2')
+      expect(new_hash['three']).to eq('2')
     end
 
     it 'should merge multiple hashes' do
       hash = scope.function_merge([{'one' => 1}, {'one' => '2'}, {'one' => '3'}])
-      hash['one'].should == '3'
+      expect(hash['one']).to eq('3')
     end
 
     it 'should accept empty hashes' do
-      scope.function_merge([{},{},{}]).should == {}
+      expect(scope.function_merge([{},{},{}])).to eq({})
     end
   end
 end
index 71d593ef091584bffbc9ccaf3f5ae963d5731cb3..35a08900bfeff332d396d4e1ebd437ca5a10bbe6 100755 (executable)
@@ -6,22 +6,22 @@ describe "the min function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("min").should == "function_min"
+    expect(Puppet::Parser::Functions.function("min")).to eq("function_min")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_min([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_min([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should be able to compare strings" do
-    scope.function_min(["albatross","dog","horse"]).should(eq("albatross"))
+    expect(scope.function_min(["albatross","dog","horse"])).to(eq("albatross"))
   end
 
   it "should be able to compare numbers" do
-    scope.function_min([6,8,4]).should(eq(4))
+    expect(scope.function_min([6,8,4])).to(eq(4))
   end
 
   it "should be able to compare a number with a stringified number" do
-    scope.function_min([1,"2"]).should(eq(1))
+    expect(scope.function_min([1,"2"])).to(eq(1))
   end
 end
index b56196d3c6bc7ed60d1d046c5e2684122c84a6b7..d0ba935488ceacce70e65472dab72a67930a5ae4 100755 (executable)
@@ -5,63 +5,63 @@ describe "the num2bool function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("num2bool").should == "function_num2bool"
+    expect(Puppet::Parser::Functions.function("num2bool")).to eq("function_num2bool")
   end
 
   it "should raise a ParseError if there are no arguments" do
-    lambda { scope.function_num2bool([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_num2bool([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should raise a ParseError if there are more than 1 arguments" do
-    lambda { scope.function_num2bool(["foo","bar"]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_num2bool(["foo","bar"]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should raise a ParseError if passed something non-numeric" do
-    lambda { scope.function_num2bool(["xyzzy"]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_num2bool(["xyzzy"]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return true if passed string 1" do
     result = scope.function_num2bool(["1"])
-    result.should(be_true)
+    expect(result).to(be_truthy)
   end
 
   it "should return true if passed string 1.5" do
     result = scope.function_num2bool(["1.5"])
-    result.should(be_true)
+    expect(result).to(be_truthy)
   end
 
   it "should return true if passed number 1" do
     result = scope.function_num2bool([1])
-    result.should(be_true)
+    expect(result).to(be_truthy)
   end
 
   it "should return false if passed string 0" do
     result = scope.function_num2bool(["0"])
-    result.should(be_false)
+    expect(result).to(be_falsey)
   end
 
   it "should return false if passed number 0" do
     result = scope.function_num2bool([0])
-    result.should(be_false)
+    expect(result).to(be_falsey)
   end
 
   it "should return false if passed string -1" do
     result = scope.function_num2bool(["-1"])
-    result.should(be_false)
+    expect(result).to(be_falsey)
   end
 
   it "should return false if passed string -1.5" do
     result = scope.function_num2bool(["-1.5"])
-    result.should(be_false)
+    expect(result).to(be_falsey)
   end
 
   it "should return false if passed number -1" do
     result = scope.function_num2bool([-1])
-    result.should(be_false)
+    expect(result).to(be_falsey)
   end
 
   it "should return false if passed float -1.5" do
     result = scope.function_num2bool([-1.5])
-    result.should(be_false)
+    expect(result).to(be_falsey)
   end
 end
index f179ac111a6f60cf5cbbf95166262abcb65b9aad..1dd41b9601add366ed2b53466174b8f3e129c6c1 100755 (executable)
@@ -5,11 +5,11 @@ describe "the parsejson function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("parsejson").should == "function_parsejson"
+    expect(Puppet::Parser::Functions.function("parsejson")).to eq("function_parsejson")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_parsejson([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_parsejson([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should convert JSON to a data structure" do
@@ -17,6 +17,6 @@ describe "the parsejson function" do
 ["aaa","bbb","ccc"]
 EOS
     result = scope.function_parsejson([json])
-    result.should(eq(['aaa','bbb','ccc']))
+    expect(result).to(eq(['aaa','bbb','ccc']))
   end
 end
index 0c7aea8a5ab4621566d638e0e48488597130c2db..e5f145ba1cad3742478019aadd74310cc59bc147 100755 (executable)
@@ -5,11 +5,11 @@ describe "the parseyaml function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("parseyaml").should == "function_parseyaml"
+    expect(Puppet::Parser::Functions.function("parseyaml")).to eq("function_parseyaml")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_parseyaml([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_parseyaml([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should convert YAML to a data structure" do
@@ -19,6 +19,6 @@ describe "the parseyaml function" do
 - ccc
 EOS
     result = scope.function_parseyaml([yaml])
-    result.should(eq(['aaa','bbb','ccc']))
+    expect(result).to(eq(['aaa','bbb','ccc']))
   end
 end
index c9235b534648842038f03ccb20333e57b1aa4fa2..db10cc3547b11c8464219323c7b9033bb7def759 100755 (executable)
@@ -5,51 +5,51 @@ describe "the pick_default function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("pick_default").should == "function_pick_default"
+    expect(Puppet::Parser::Functions.function("pick_default")).to eq("function_pick_default")
   end
 
   it 'should return the correct value' do
-    scope.function_pick_default(['first', 'second']).should == 'first'
+    expect(scope.function_pick_default(['first', 'second'])).to eq('first')
   end
 
   it 'should return the correct value if the first value is empty' do
-    scope.function_pick_default(['', 'second']).should == 'second'
+    expect(scope.function_pick_default(['', 'second'])).to eq('second')
   end
 
   it 'should skip empty string values' do
-    scope.function_pick_default(['', 'first']).should == 'first'
+    expect(scope.function_pick_default(['', 'first'])).to eq('first')
   end
 
   it 'should skip :undef values' do
-    scope.function_pick_default([:undef, 'first']).should == 'first'
+    expect(scope.function_pick_default([:undef, 'first'])).to eq('first')
   end
 
   it 'should skip :undefined values' do
-    scope.function_pick_default([:undefined, 'first']).should == 'first'
+    expect(scope.function_pick_default([:undefined, 'first'])).to eq('first')
   end
 
   it 'should return the empty string if it is the last possibility' do
-    scope.function_pick_default([:undef, :undefined, '']).should == ''
+    expect(scope.function_pick_default([:undef, :undefined, ''])).to eq('')
   end
 
   it 'should return :undef if it is the last possibility' do
-    scope.function_pick_default(['', :undefined, :undef]).should == :undef
+    expect(scope.function_pick_default(['', :undefined, :undef])).to eq(:undef)
   end
 
   it 'should return :undefined if it is the last possibility' do
-    scope.function_pick_default([:undef, '', :undefined]).should == :undefined
+    expect(scope.function_pick_default([:undef, '', :undefined])).to eq(:undefined)
   end
 
   it 'should return the empty string if it is the only possibility' do
-    scope.function_pick_default(['']).should == ''
+    expect(scope.function_pick_default([''])).to eq('')
   end
 
   it 'should return :undef if it is the only possibility' do
-    scope.function_pick_default([:undef]).should == :undef
+    expect(scope.function_pick_default([:undef])).to eq(:undef)
   end
 
   it 'should return :undefined if it is the only possibility' do
-    scope.function_pick_default([:undefined]).should == :undefined
+    expect(scope.function_pick_default([:undefined])).to eq(:undefined)
   end
 
   it 'should error if no values are passed' do
index f53fa800053765fb55245c5e0270ff29afe48733..8be8f5875329c76ebdafb531f2f3f54a68350927 100755 (executable)
@@ -5,27 +5,27 @@ describe "the pick function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("pick").should == "function_pick"
+    expect(Puppet::Parser::Functions.function("pick")).to eq("function_pick")
   end
 
   it 'should return the correct value' do
-    scope.function_pick(['first', 'second']).should == 'first'
+    expect(scope.function_pick(['first', 'second'])).to eq('first')
   end
 
   it 'should return the correct value if the first value is empty' do
-    scope.function_pick(['', 'second']).should == 'second'
+    expect(scope.function_pick(['', 'second'])).to eq('second')
   end
 
   it 'should remove empty string values' do
-    scope.function_pick(['', 'first']).should == 'first'
+    expect(scope.function_pick(['', 'first'])).to eq('first')
   end
 
   it 'should remove :undef values' do
-    scope.function_pick([:undef, 'first']).should == 'first'
+    expect(scope.function_pick([:undef, 'first'])).to eq('first')
   end
 
   it 'should remove :undefined values' do
-    scope.function_pick([:undefined, 'first']).should == 'first'
+    expect(scope.function_pick([:undefined, 'first'])).to eq('first')
   end
 
   it 'should error if no values are passed' do
index 6e8ddc58ee839b95addd140bc338dceb6f173267..34cac53050485277c86ba88b8518b3c16a468a59 100755 (executable)
@@ -23,6 +23,6 @@ describe "the prefix function" do
 
   it "returns a prefixed array" do
     result = scope.function_prefix([['a','b','c'], 'p'])
-    result.should(eq(['pa','pb','pc']))
+    expect(result).to(eq(['pa','pb','pc']))
   end
 end
index 0e1ad376f6fe8fc7cb80a113bffabc379e812733..9b9ece024f4b3908b1d1bd5eb03908db385d3aad 100755 (executable)
@@ -5,7 +5,7 @@ describe "the range function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "exists" do
-    Puppet::Parser::Functions.function("range").should == "function_range"
+    expect(Puppet::Parser::Functions.function("range")).to eq("function_range")
   end
 
   it "raises a ParseError if there is less than 1 arguments" do
@@ -15,56 +15,56 @@ describe "the range function" do
   describe 'with a letter range' do
     it "returns a letter range" do
       result = scope.function_range(["a","d"])
-      result.should eq ['a','b','c','d']
+      expect(result).to eq ['a','b','c','d']
     end
 
     it "returns a letter range given a step of 1" do
       result = scope.function_range(["a","d","1"])
-      result.should eq ['a','b','c','d']
+      expect(result).to eq ['a','b','c','d']
     end
 
     it "returns a stepped letter range" do
       result = scope.function_range(["a","d","2"])
-      result.should eq ['a','c']
+      expect(result).to eq ['a','c']
     end
 
     it "returns a stepped letter range given a negative step" do
       result = scope.function_range(["a","d","-2"])
-      result.should eq ['a','c']
+      expect(result).to eq ['a','c']
     end
   end
 
   describe 'with a number range' do
     it "returns a number range" do
       result = scope.function_range(["1","4"])
-      result.should eq [1,2,3,4]
+      expect(result).to eq [1,2,3,4]
     end
 
     it "returns a number range given a step of 1" do
       result = scope.function_range(["1","4","1"])
-      result.should eq [1,2,3,4]
+      expect(result).to eq [1,2,3,4]
     end
 
     it "returns a stepped number range" do
       result = scope.function_range(["1","4","2"])
-      result.should eq [1,3]
+      expect(result).to eq [1,3]
     end
 
     it "returns a stepped number range given a negative step" do
       result = scope.function_range(["1","4","-2"])
-      result.should eq [1,3]
+      expect(result).to eq [1,3]
     end
   end
 
   describe 'with a numeric-like string range' do
     it "works with padded hostname like strings" do
       expected = ("host01".."host10").to_a
-      scope.function_range(["host01","host10"]).should eq expected
+      expect(scope.function_range(["host01","host10"])).to eq expected
     end
 
     it "coerces zero padded digits to integers" do
       expected = (0..10).to_a
-      scope.function_range(["00", "10"]).should eq expected
+      expect(scope.function_range(["00", "10"])).to eq expected
     end
   end
 end
index f2cb7419352fcb41faf0e844690bbfcb6ce8a5e1..88a992efc9ff46e3b42d896b4c1a3a75cc7fb506 100755 (executable)
@@ -6,15 +6,15 @@ describe "the reject function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("reject").should == "function_reject"
+    expect(Puppet::Parser::Functions.function("reject")).to eq("function_reject")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_reject([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_reject([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should reject contents from an array" do
     result = scope.function_reject([["1111", "aaabbb","bbbccc","dddeee"], "bbb"])
-    result.should(eq(["1111", "dddeee"]))
+    expect(result).to(eq(["1111", "dddeee"]))
   end
 end
index 1b59206547891656c04458434436a775e1f6846f..bfeabfb84353d142806b6ad793a627cf5b357d1c 100755 (executable)
@@ -5,15 +5,15 @@ describe "the reverse function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("reverse").should == "function_reverse"
+    expect(Puppet::Parser::Functions.function("reverse")).to eq("function_reverse")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_reverse([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_reverse([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should reverse a string" do
     result = scope.function_reverse(["asdfghijkl"])
-    result.should(eq('lkjihgfdsa'))
+    expect(result).to(eq('lkjihgfdsa'))
   end
 end
index d90de1d06093aa929c9dd42cc4805f8df7bb87ba..81321d76637549e2181e6bd6c49e246a8376c3e4 100755 (executable)
@@ -5,20 +5,20 @@ describe "the rstrip function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("rstrip").should == "function_rstrip"
+    expect(Puppet::Parser::Functions.function("rstrip")).to eq("function_rstrip")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_rstrip([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_rstrip([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should rstrip a string" do
     result = scope.function_rstrip(["asdf  "])
-    result.should(eq('asdf'))
+    expect(result).to(eq('asdf'))
   end
 
   it "should rstrip each element in an array" do
     result = scope.function_rstrip([["a ","b ", "c "]])
-    result.should(eq(['a','b','c']))
+    expect(result).to(eq(['a','b','c']))
   end
 end
index 93346d5370009cb54f433b61d6c10530447dded8..ee0e2ffb22fd1f22a74d33d20cdcb07becd355f8 100755 (executable)
@@ -5,20 +5,20 @@ describe "the shuffle function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("shuffle").should == "function_shuffle"
+    expect(Puppet::Parser::Functions.function("shuffle")).to eq("function_shuffle")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_shuffle([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_shuffle([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should shuffle a string and the result should be the same size" do
     result = scope.function_shuffle(["asdf"])
-    result.size.should(eq(4))
+    expect(result.size).to(eq(4))
   end
 
   it "should shuffle a string but the sorted contents should still be the same" do
     result = scope.function_shuffle(["adfs"])
-    result.split("").sort.join("").should(eq("adfs"))
+    expect(result.split("").sort.join("")).to(eq("adfs"))
   end
 end
index b1c435a3027a958997c0229d981a8918214515fd..18eb48f96d8d7d48bb319b0322e7285880d89542 100755 (executable)
@@ -5,20 +5,20 @@ describe "the size function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("size").should == "function_size"
+    expect(Puppet::Parser::Functions.function("size")).to eq("function_size")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_size([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_size([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return the size of a string" do
     result = scope.function_size(["asdf"])
-    result.should(eq(4))
+    expect(result).to(eq(4))
   end
 
   it "should return the size of an array" do
     result = scope.function_size([["a","b","c"]])
-    result.should(eq(3))
+    expect(result).to(eq(3))
   end
 end
index 3187a5aecbc492af56da0a4f5a248eb771f9106d..4c2a66cf832db08a26e57a6548c5c3f954e3f57b 100755 (executable)
@@ -5,20 +5,20 @@ describe "the sort function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("sort").should == "function_sort"
+    expect(Puppet::Parser::Functions.function("sort")).to eq("function_sort")
   end
 
   it "should raise a ParseError if there is not 1 arguments" do
-    lambda { scope.function_sort(['','']) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_sort(['','']) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should sort an array" do
     result = scope.function_sort([["a","c","b"]])
-    result.should(eq(['a','b','c']))
+    expect(result).to(eq(['a','b','c']))
   end
 
   it "should sort a string" do
     result = scope.function_sort(["acb"])
-    result.should(eq('abc'))
+    expect(result).to(eq('abc'))
   end
 end
index 60e5a3028db9b88875c9048a0258ef62e319acce..cd0eb37fc5a2ec217a868cb744b1ca3c6aaf100b 100755 (executable)
@@ -5,20 +5,20 @@ describe "the squeeze function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("squeeze").should == "function_squeeze"
+    expect(Puppet::Parser::Functions.function("squeeze")).to eq("function_squeeze")
   end
 
   it "should raise a ParseError if there is less than 2 arguments" do
-    lambda { scope.function_squeeze([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_squeeze([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should squeeze a string" do
     result = scope.function_squeeze(["aaabbbbcccc"])
-    result.should(eq('abc'))
+    expect(result).to(eq('abc'))
   end
 
   it "should squeeze all elements in an array" do
     result = scope.function_squeeze([["aaabbbbcccc","dddfff"]])
-    result.should(eq(['abc','df']))
+    expect(result).to(eq(['abc','df']))
   end
 end
index 73c09c729225818a479d095677e0f84dfefe18ba..1d205d75d4769f6ca9dcc83acc23c0a51c8eed24 100755 (executable)
@@ -5,27 +5,27 @@ describe "the str2bool function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("str2bool").should == "function_str2bool"
+    expect(Puppet::Parser::Functions.function("str2bool")).to eq("function_str2bool")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_str2bool([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_str2bool([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should convert string 'true' to true" do
     result = scope.function_str2bool(["true"])
-    result.should(eq(true))
+    expect(result).to(eq(true))
   end
 
   it "should convert string 'undef' to false" do
     result = scope.function_str2bool(["undef"])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 
   it "should return the boolean it was called with" do
     result = scope.function_str2bool([true])
-    result.should(eq(true))
+    expect(result).to(eq(true))
     result = scope.function_str2bool([false])
-    result.should(eq(false))
+    expect(result).to(eq(false))
   end
 end
index df8fb8e905c85034af6e66b741db86aa5ac23fe7..ab7f57f113f2ba10900a9b6ea33e090a603af6f5 100755 (executable)
@@ -5,7 +5,7 @@ describe "the str2saltedsha512 function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("str2saltedsha512").should == "function_str2saltedsha512"
+    expect(Puppet::Parser::Functions.function("str2saltedsha512")).to eq("function_str2saltedsha512")
   end
 
   it "should raise a ParseError if there is less than 1 argument" do
@@ -18,7 +18,7 @@ describe "the str2saltedsha512 function" do
 
   it "should return a salted-sha512 password hash 136 characters in length" do
     result = scope.function_str2saltedsha512(["password"])
-    result.length.should(eq(136))
+    expect(result.length).to(eq(136))
   end
 
   it "should raise an error if you pass a non-string password" do
@@ -40,6 +40,6 @@ describe "the str2saltedsha512 function" do
     # Combine the Binary Salt with 'password' and compare the end result
     saltedpass    = Digest::SHA512.digest(str_salt + 'password')
     result        = (str_salt + saltedpass).unpack('H*')[0]
-    result.should == password_hash
+    expect(result).to eq(password_hash)
   end
 end
index df42b6f26bd1cfe2d7dd373439ee47f7fd8a5a89..ebec54b80fc624028aa780746ae1a88d2a9536eb 100755 (executable)
@@ -5,25 +5,25 @@ describe "the strftime function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("strftime").should == "function_strftime"
+    expect(Puppet::Parser::Functions.function("strftime")).to eq("function_strftime")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_strftime([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_strftime([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "using %s should be higher then when I wrote this test" do
     result = scope.function_strftime(["%s"])
-    result.to_i.should(be > 1311953157)
+    expect(result.to_i).to(be > 1311953157)
   end
 
   it "using %s should be lower then 1.5 trillion" do
     result = scope.function_strftime(["%s"])
-    result.to_i.should(be < 1500000000)
+    expect(result.to_i).to(be < 1500000000)
   end
 
   it "should return a date when given %Y-%m-%d" do
     result = scope.function_strftime(["%Y-%m-%d"])
-    result.should =~ /^\d{4}-\d{2}-\d{2}$/
+    expect(result).to match(/^\d{4}-\d{2}-\d{2}$/)
   end
 end
index fccdd26067c7ecfa1aa3ca3baef595f769411024..e228761d016478dd15758ca38fe6aeb4aeaead07 100755 (executable)
@@ -4,15 +4,15 @@ require 'spec_helper'
 describe "the strip function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
   it "should exist" do
-    Puppet::Parser::Functions.function("strip").should == "function_strip"
+    expect(Puppet::Parser::Functions.function("strip")).to eq("function_strip")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_strip([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_strip([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should strip a string" do
     result = scope.function_strip([" ab cd "])
-    result.should(eq('ab cd'))
+    expect(result).to(eq('ab cd'))
   end
 end
index 89ba3b82309126381067259e30480a47045b6af8..c7783c64d81d147b0d58adf8a679abd1f7f81310 100755 (executable)
@@ -22,6 +22,6 @@ describe "the suffix function" do
 
   it "returns a suffixed array" do
     result = scope.function_suffix([['a','b','c'], 'p'])
-    result.should(eq(['ap','bp','cp']))
+    expect(result).to(eq(['ap','bp','cp']))
   end
 end
index 808b415876775e3df7b74ea230e072fb1c67b5ac..c6838ab4e36e5567717e52930d2c63f22ed7cd5d 100755 (executable)
@@ -5,15 +5,15 @@ describe "the swapcase function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("swapcase").should == "function_swapcase"
+    expect(Puppet::Parser::Functions.function("swapcase")).to eq("function_swapcase")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_swapcase([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_swapcase([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should swapcase a string" do
     result = scope.function_swapcase(["aaBBccDD"])
-    result.should(eq('AAbbCCdd'))
+    expect(result).to(eq('AAbbCCdd'))
   end
 end
index e9fb76e6ac3c8f6f2f71a16e62c5abe898afe5c5..6e22515f1a6da3897d182332b211b67c8f40ba37 100755 (executable)
@@ -5,25 +5,25 @@ describe "the time function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("time").should == "function_time"
+    expect(Puppet::Parser::Functions.function("time")).to eq("function_time")
   end
 
   it "should raise a ParseError if there is more than 2 arguments" do
-    lambda { scope.function_time(['','']) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_time(['','']) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return a number" do
     result = scope.function_time([])
-    result.should be_an(Integer)
+    expect(result).to be_an(Integer)
   end
 
   it "should be higher then when I wrote this test" do
     result = scope.function_time([])
-    result.should(be > 1311953157)
+    expect(result).to(be > 1311953157)
   end
 
   it "should be lower then 1.5 trillion" do
     result = scope.function_time([])
-    result.should(be < 1500000000)
+    expect(result).to(be < 1500000000)
   end
 end
index d1ea4c80cc2147c9bcf1a9582f377929a3ae4253..68a1eb8b728d4815b4edad7aa9a57a0a786a2fda 100755 (executable)
@@ -6,53 +6,53 @@ describe "the to_bytes function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("to_bytes").should == "function_to_bytes"
+    expect(Puppet::Parser::Functions.function("to_bytes")).to eq("function_to_bytes")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_to_bytes([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_to_bytes([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should convert kB to B" do
     result = scope.function_to_bytes(["4 kB"])
-    result.should(eq(4096))
+    expect(result).to(eq(4096))
   end
 
   it "should work without B in unit" do
     result = scope.function_to_bytes(["4 k"])
-    result.should(eq(4096))
+    expect(result).to(eq(4096))
   end
 
   it "should work without a space before unit" do
     result = scope.function_to_bytes(["4k"])
-    result.should(eq(4096))
+    expect(result).to(eq(4096))
   end
 
   it "should work without a unit" do
     result = scope.function_to_bytes(["5678"])
-    result.should(eq(5678))
+    expect(result).to(eq(5678))
   end
 
   it "should convert fractions" do
     result = scope.function_to_bytes(["1.5 kB"])
-    result.should(eq(1536))
+    expect(result).to(eq(1536))
   end
 
   it "should convert scientific notation" do
     result = scope.function_to_bytes(["1.5e2 B"])
-    result.should(eq(150))
+    expect(result).to(eq(150))
   end
 
   it "should do nothing with a positive number" do
     result = scope.function_to_bytes([5678])
-    result.should(eq(5678))
+    expect(result).to(eq(5678))
   end
 
   it "should should raise a ParseError if input isn't a number" do
-    lambda { scope.function_to_bytes(["foo"]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_to_bytes(["foo"]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should should raise a ParseError if prefix is unknown" do
-    lambda { scope.function_to_bytes(["5 uB"]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_to_bytes(["5 uB"]) }.to( raise_error(Puppet::ParseError))
   end
 end
index 8fec88f2660ab23b15f5ee52c53e6c80255aef2d..9dfe9d7f5a5f1c65a6f8a1cc1dbe200d344a345e 100755 (executable)
@@ -4,40 +4,40 @@ require 'spec_helper'
 describe "the type function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
   it "should exist" do
-    Puppet::Parser::Functions.function("type").should == "function_type"
+    expect(Puppet::Parser::Functions.function("type")).to eq("function_type")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_type([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_type([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return string when given a string" do
     result = scope.function_type(["aaabbbbcccc"])
-    result.should(eq('string'))
+    expect(result).to(eq('string'))
   end
 
   it "should return array when given an array" do
     result = scope.function_type([["aaabbbbcccc","asdf"]])
-    result.should(eq('array'))
+    expect(result).to(eq('array'))
   end
 
   it "should return hash when given a hash" do
     result = scope.function_type([{"a"=>1,"b"=>2}])
-    result.should(eq('hash'))
+    expect(result).to(eq('hash'))
   end
 
   it "should return integer when given an integer" do
     result = scope.function_type(["1"])
-    result.should(eq('integer'))
+    expect(result).to(eq('integer'))
   end
 
   it "should return float when given a float" do
     result = scope.function_type(["1.34"])
-    result.should(eq('float'))
+    expect(result).to(eq('float'))
   end
 
   it "should return boolean when given a boolean" do
     result = scope.function_type([true])
-    result.should(eq('boolean'))
+    expect(result).to(eq('boolean'))
   end
 end
index 0d282caa6533a08b62fb632356432ea7003d7cb6..706f4cbcd04942c2cd07a5a5d869839c22d13731 100755 (executable)
@@ -5,15 +5,15 @@ describe "the union function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("union").should == "function_union"
+    expect(Puppet::Parser::Functions.function("union")).to eq("function_union")
   end
 
   it "should raise a ParseError if there are fewer than 2 arguments" do
-    lambda { scope.function_union([]) }.should( raise_error(Puppet::ParseError) )
+    expect { scope.function_union([]) }.to( raise_error(Puppet::ParseError) )
   end
 
   it "should join two arrays together" do
     result = scope.function_union([["a","b","c"],["b","c","d"]])
-    result.should(eq(["a","b","c","d"]))
+    expect(result).to(eq(["a","b","c","d"]))
   end
 end
index 5d48d49b723e3b85d2e9afb39f77e0fb18921cff..8ec1464eb4be5b167d5d8006e9a34165068f04c6 100755 (executable)
@@ -5,20 +5,20 @@ describe "the unique function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("unique").should == "function_unique"
+    expect(Puppet::Parser::Functions.function("unique")).to eq("function_unique")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_unique([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_unique([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should remove duplicate elements in a string" do
     result = scope.function_unique(["aabbc"])
-    result.should(eq('abc'))
+    expect(result).to(eq('abc'))
   end
 
   it "should remove duplicate elements in an array" do
     result = scope.function_unique([["a","a","b","b","c"]])
-    result.should(eq(['a','b','c']))
+    expect(result).to(eq(['a','b','c']))
   end
 end
index 5db55138a6935c45c4de9a392f5f583733783c5f..78e55ddf1e2c5bc2eff049c90ac9bb36e44e7b8e 100755 (executable)
@@ -5,20 +5,20 @@ describe "the upcase function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("upcase").should == "function_upcase"
+    expect(Puppet::Parser::Functions.function("upcase")).to eq("function_upcase")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_upcase([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_upcase([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should upcase a string" do
     result = scope.function_upcase(["abc"])
-    result.should(eq('ABC'))
+    expect(result).to(eq('ABC'))
   end
 
   it "should do nothing if a string is already upcase" do
     result = scope.function_upcase(["ABC"])
-    result.should(eq('ABC'))
+    expect(result).to(eq('ABC'))
   end
 end
index 7211c88783df3e99f753be7a27dd47d021f8929c..c44e9c19b05cec4e75020b5ff827543416e88363 100755 (executable)
@@ -5,20 +5,20 @@ describe "the uriescape function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("uriescape").should == "function_uriescape"
+    expect(Puppet::Parser::Functions.function("uriescape")).to eq("function_uriescape")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_uriescape([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_uriescape([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should uriescape a string" do
     result = scope.function_uriescape([":/?#[]@!$&'()*+,;= \"{}"])
-    result.should(eq(':/?%23[]@!$&\'()*+,;=%20%22%7B%7D'))
+    expect(result).to(eq(':/?%23[]@!$&\'()*+,;=%20%22%7B%7D'))
   end
 
   it "should do nothing if a string is already safe" do
     result = scope.function_uriescape(["ABCdef"])
-    result.should(eq('ABCdef'))
+    expect(result).to(eq('ABCdef'))
   end
 end
index 851835fa1e55ad7fa8d9ff0f1b44b559da5886de..e23f61a20e126ac233f2ff21980ef46e2900da10 100755 (executable)
@@ -6,7 +6,7 @@ describe "the validate_slength function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("validate_slength").should == "function_validate_slength"
+    expect(Puppet::Parser::Functions.function("validate_slength")).to eq("function_validate_slength")
   end
 
   describe "validating the input argument types" do
index 08e95a567bc436178f033acf1d057197e66d5d64..86e3c31c6e67c7467f3a57e57139d1ea4a410b05 100755 (executable)
@@ -5,34 +5,34 @@ describe "the values_at function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("values_at").should == "function_values_at"
+    expect(Puppet::Parser::Functions.function("values_at")).to eq("function_values_at")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_values_at([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_values_at([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should raise a ParseError if you try to use a range where stop is greater then start" do
-    lambda { scope.function_values_at([['a','b'],["3-1"]]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_values_at([['a','b'],["3-1"]]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return a value at from an array" do
     result = scope.function_values_at([['a','b','c'],"1"])
-    result.should(eq(['b']))
+    expect(result).to(eq(['b']))
   end
 
   it "should return a value at from an array when passed a range" do
     result = scope.function_values_at([['a','b','c'],"0-1"])
-    result.should(eq(['a','b']))
+    expect(result).to(eq(['a','b']))
   end
 
   it "should return chosen values from an array when passed number of indexes" do
     result = scope.function_values_at([['a','b','c'],["0","2"]])
-    result.should(eq(['a','c']))
+    expect(result).to(eq(['a','c']))
   end
 
   it "should return chosen values from an array when passed ranges and multiple indexes" do
     result = scope.function_values_at([['a','b','c','d','e','f','g'],["0","2","4-5"]])
-    result.should(eq(['a','c','e','f']))
+    expect(result).to(eq(['a','c','e','f']))
   end
 end
index 14ae4176380d46bf3fda26d52e64b97fa515dea6..08d21b037067251150c01dda8bede003ef1d27a8 100755 (executable)
@@ -5,27 +5,27 @@ describe "the values function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should exist" do
-    Puppet::Parser::Functions.function("values").should == "function_values"
+    expect(Puppet::Parser::Functions.function("values")).to eq("function_values")
   end
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_values([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_values([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should return values from a hash" do
     result = scope.function_values([{'a'=>'1','b'=>'2','c'=>'3'}])
     # =~ is the RSpec::Matchers::MatchArray matcher.
     # A.K.A. "array with same elements" (multiset) matching
-    result.should =~ %w{ 1 2 3 }
+    expect(result).to match_array(%w{ 1 2 3 })
   end
 
   it "should return a multiset" do
     result = scope.function_values([{'a'=>'1','b'=>'3','c'=>'3'}])
-    result.should     =~ %w{ 1 3 3 }
-    result.should_not =~ %w{ 1 3 }
+    expect(result).to     match_array(%w{ 1 3 3 })
+    expect(result).not_to match_array(%w{ 1 3 })
   end
 
   it "should raise a ParseError unless a Hash is provided" do
-    lambda { scope.function_values([['a','b','c']]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_values([['a','b','c']]) }.to( raise_error(Puppet::ParseError))
   end
 end
index f45ab17308d8f6d71c761bb5baad46b2e1887513..744bdd7868968e089e57ecc163cb135583225995 100755 (executable)
@@ -5,11 +5,11 @@ describe "the zip function" do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
   it "should raise a ParseError if there is less than 1 arguments" do
-    lambda { scope.function_zip([]) }.should( raise_error(Puppet::ParseError))
+    expect { scope.function_zip([]) }.to( raise_error(Puppet::ParseError))
   end
 
   it "should be able to zip an array" do
     result = scope.function_zip([['1','2','3'],['4','5','6']])
-    result.should(eq([["1", "4"], ["2", "5"], ["3", "6"]]))
+    expect(result).to(eq([["1", "4"], ["2", "5"], ["3", "6"]]))
   end
 end