]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
ammend .should raise_error to .to raise_error
authorstephen <stephen@puppetlabs.com>
Tue, 16 Oct 2012 10:54:14 +0000 (11:54 +0100)
committerJeff McCune <jeff@puppetlabs.com>
Wed, 6 Feb 2013 16:12:42 +0000 (08:12 -0800)
spec/unit/puppet/parser/functions/get_module_path_spec.rb
spec/unit/puppet/parser/functions/merge_spec.rb
spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb
spec/unit/puppet/parser/functions/validate_array_spec.rb
spec/unit/puppet/parser/functions/validate_bool_spec.rb
spec/unit/puppet/parser/functions/validate_hash_spec.rb
spec/unit/puppet/parser/functions/validate_string_spec.rb
spec/unit/puppet/type/file_line_spec.rb

index e761706c06d5eba7aa2e17ac32f55ce17c588ca8..486bef6f2006d3aa9d194b6199b6276157b80372 100644 (file)
@@ -15,11 +15,11 @@ describe Puppet::Parser::Functions.function(:get_module_path) do
   end
 
   it 'should only allow one argument' do
-    expect { scope.function_get_module_path([]) }.should raise_error(Puppet::ParseError, /Wrong number of arguments, expects one/)
-    expect { scope.function_get_module_path(['1','2','3']) }.should raise_error(Puppet::ParseError, /Wrong number of arguments, expects one/)
+    expect { scope.function_get_module_path([]) }.to raise_error(Puppet::ParseError, /Wrong number of arguments, expects one/)
+    expect { scope.function_get_module_path(['1','2','3']) }.to raise_error(Puppet::ParseError, /Wrong number of arguments, expects one/)
   end
   it 'should raise an exception when the module cannot be found' do
-    expect { scope.function_get_module_path(['foo']) }.should raise_error(Puppet::ParseError, /Could not find module/)
+    expect { scope.function_get_module_path(['foo']) }.to raise_error(Puppet::ParseError, /Could not find module/)
   end
   describe 'when locating a module' do
     let(:modulepath) { "/tmp/does_not_exist" }
index db7d837befc3db4b2585e7f7189cf41429f96ee0..04169e7e755de294d81725ef356ea1c7ee1daef7 100644 (file)
@@ -25,7 +25,7 @@ describe Puppet::Parser::Functions.function(:merge) do
 
   describe 'when calling merge on the scope instance' do
     it 'should require all parameters are hashes' do
-      expect { new_hash = scope.function_merge([{}, '2'])}.should raise_error(Puppet::ParseError, /unexpected argument type String/)
+      expect { new_hash = scope.function_merge([{}, '2'])}.to raise_error(Puppet::ParseError, /unexpected argument type String/)
     end
 
     it 'should be able to merge two hashes' do
index a692c31331facc61a85f419d35c8581385103b5a..df8fb8e905c85034af6e66b741db86aa5ac23fe7 100644 (file)
@@ -9,11 +9,11 @@ describe "the str2saltedsha512 function" do
   end
 
   it "should raise a ParseError if there is less than 1 argument" do
-    expect { scope.function_str2saltedsha512([]) }.should( raise_error(Puppet::ParseError) )
+    expect { scope.function_str2saltedsha512([]) }.to( raise_error(Puppet::ParseError) )
   end
 
   it "should raise a ParseError if there is more than 1 argument" do
-    expect { scope.function_str2saltedsha512(['foo', 'bar', 'baz']) }.should( raise_error(Puppet::ParseError) )
+    expect { scope.function_str2saltedsha512(['foo', 'bar', 'baz']) }.to( raise_error(Puppet::ParseError) )
   end
 
   it "should return a salted-sha512 password hash 136 characters in length" do
@@ -22,7 +22,7 @@ describe "the str2saltedsha512 function" do
   end
 
   it "should raise an error if you pass a non-string password" do
-    expect { scope.function_str2saltedsha512([1234]) }.should( raise_error(Puppet::ParseError) )
+    expect { scope.function_str2saltedsha512([1234]) }.to( raise_error(Puppet::ParseError) )
   end
 
   it "should generate a valid password" do
index 8eee72abbf93c9931707414e9ef1e0809bb3d9ab..4b31cfde42fcb152eef0e8022c8e153c0d302c23 100644 (file)
@@ -9,12 +9,12 @@ describe Puppet::Parser::Functions.function(:validate_array) do
     %w{ true false }.each do |the_string|
       it "should not compile when #{the_string} is a string" do
         Puppet[:code] = "validate_array('#{the_string}')"
-        expect { scope.compiler.compile }.should raise_error(Puppet::ParseError, /is not an Array/)
+        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not an Array/)
       end
 
       it "should not compile when #{the_string} is a bare word" do
         Puppet[:code] = "validate_array(#{the_string})"
-        expect { scope.compiler.compile }.should raise_error(Puppet::ParseError, /is not an Array/)
+        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not an Array/)
       end
     end
 
@@ -32,7 +32,7 @@ describe Puppet::Parser::Functions.function(:validate_array) do
         $foo = undef
         validate_array($foo)
       ENDofPUPPETcode
-      expect { scope.compiler.compile }.should raise_error(Puppet::ParseError, /is not an Array/)
+      expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not an Array/)
     end
   end
 end
index 31ab8fb72a1fddb6b954ad9c74bd340f2bad9fed..261fb2352dfca164ad0fdca480f933f52cd7d7c9 100644 (file)
@@ -10,7 +10,7 @@ describe Puppet::Parser::Functions.function(:validate_bool) do
 
       it "should not compile when #{the_string} is a string" do
         Puppet[:code] = "validate_bool('#{the_string}')"
-        expect { scope.compiler.compile }.should raise_error(Puppet::ParseError, /is not a boolean/)
+        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a boolean/)
       end
 
       it "should compile when #{the_string} is a bare word" do
@@ -22,12 +22,12 @@ describe Puppet::Parser::Functions.function(:validate_bool) do
 
     it "should not compile when an arbitrary string is passed" do
       Puppet[:code] = 'validate_bool("jeff and dan are awesome")'
-      expect { scope.compiler.compile }.should raise_error(Puppet::ParseError, /is not a boolean/)
+      expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a boolean/)
     end
 
     it "should not compile when no arguments are passed" do
       Puppet[:code] = 'validate_bool()'
-      expect { scope.compiler.compile }.should raise_error(Puppet::ParseError, /wrong number of arguments/)
+      expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /wrong number of arguments/)
     end
 
     it "should compile when multiple boolean arguments are passed" do
@@ -45,7 +45,7 @@ describe Puppet::Parser::Functions.function(:validate_bool) do
         $bar = false
         validate_bool($foo, $bar, true, false, 'jeff')
       ENDofPUPPETcode
-      expect { scope.compiler.compile }.should raise_error(Puppet::ParseError, /is not a boolean/)
+      expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a boolean/)
     end
   end
 end
index 06d77a18bb9aafa543f7f8a81493ba3a41b3fae4..a0c35c2304ff1e69d18f72896d216dfcfb816f7d 100644 (file)
@@ -11,12 +11,12 @@ describe Puppet::Parser::Functions.function(:validate_hash) do
 
       it "should not compile when #{the_string} is a string" do
         Puppet[:code] = "validate_hash('#{the_string}')"
-        expect { scope.compiler.compile }.should raise_error(Puppet::ParseError, /is not a Hash/)
+        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a Hash/)
       end
 
       it "should not compile when #{the_string} is a bare word" do
         Puppet[:code] = "validate_hash(#{the_string})"
-        expect { scope.compiler.compile }.should raise_error(Puppet::ParseError, /is not a Hash/)
+        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a Hash/)
       end
 
     end
@@ -35,7 +35,7 @@ describe Puppet::Parser::Functions.function(:validate_hash) do
         $foo = undef
         validate_hash($foo)
       ENDofPUPPETcode
-      expect { scope.compiler.compile }.should raise_error(Puppet::ParseError, /is not a Hash/)
+      expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a Hash/)
     end
 
   end
index 007b4ca9c041cee577c2bc9cf1bfd233c744b607..3b4fb3e1da154496fb5eabfe5bb61176f88db70d 100644 (file)
@@ -29,7 +29,7 @@ describe Puppet::Parser::Functions.function(:validate_string) do
 
       it "should not compile when #{the_string} is a bare word" do
         Puppet[:code] = "validate_string(#{the_string})"
-        expect { scope.compiler.compile }.should raise_error(Puppet::ParseError, /is not a string/)
+        expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a string/)
       end
     end
 
index 0cd8a262d2b9faa0f6687044b5deca857d969d77..edc64bd1e54c78f1698e2828e34479c35364a607 100644 (file)
@@ -37,13 +37,13 @@ describe Puppet::Type.type(:file_line) do
     file_line[:path].should == '/tmp/path'
   end
   it 'should not accept unqualified path' do
-    expect { file_line[:path] = 'file' }.should raise_error(Puppet::Error, /File paths must be fully qualified/)
+    expect { file_line[:path] = 'file' }.to raise_error(Puppet::Error, /File paths must be fully qualified/)
   end
   it 'should require that a line is specified' do
-    expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => '/tmp/file') }.should raise_error(Puppet::Error, /Both line and path are required attributes/)
+    expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => '/tmp/file') }.to raise_error(Puppet::Error, /Both line and path are required attributes/)
   end
   it 'should require that a file is specified' do
-    expect { Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'path') }.should raise_error(Puppet::Error, /Both line and path are required attributes/)
+    expect { Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'path') }.to raise_error(Puppet::Error, /Both line and path are required attributes/)
   end
   it 'should default to ensure => present' do
     file_line[:ensure].should eq :present