diff options
author | Seth Vargo <sethvargo@gmail.com> | 2013-09-24 17:38:44 -0400 |
---|---|---|
committer | Bryan McLellan <btm@opscode.com> | 2013-09-26 11:13:59 -0700 |
commit | 6315871ae7deeead95d84d2487c54a03c47e318f (patch) | |
tree | a2bf980c434c657aa350c0d3fc4073652cdf43cf /spec | |
parent | 61e98b94fb387353841d5b4575816a1d716cfbc9 (diff) | |
download | chef-6315871ae7deeead95d84d2487c54a03c47e318f.tar.gz |
Normalize whitespace on all files
Diffstat (limited to 'spec')
214 files changed, 1130 insertions, 1132 deletions
diff --git a/spec/data/apt/chef-integration-test-1.0/debian/rules b/spec/data/apt/chef-integration-test-1.0/debian/rules index b760bee7f4..955dd78b6a 100755 --- a/spec/data/apt/chef-integration-test-1.0/debian/rules +++ b/spec/data/apt/chef-integration-test-1.0/debian/rules @@ -10,4 +10,4 @@ #export DH_VERBOSE=1 %: - dh $@ + dh $@ diff --git a/spec/data/apt/chef-integration-test-1.1/debian/rules b/spec/data/apt/chef-integration-test-1.1/debian/rules index b760bee7f4..955dd78b6a 100755 --- a/spec/data/apt/chef-integration-test-1.1/debian/rules +++ b/spec/data/apt/chef-integration-test-1.1/debian/rules @@ -10,4 +10,4 @@ #export DH_VERBOSE=1 %: - dh $@ + dh $@ diff --git a/spec/data/apt/chef-integration-test_1.0-1_amd64.changes b/spec/data/apt/chef-integration-test_1.0-1_amd64.changes index 4746b834e5..350cc7485c 100644 --- a/spec/data/apt/chef-integration-test_1.0-1_amd64.changes +++ b/spec/data/apt/chef-integration-test_1.0-1_amd64.changes @@ -8,15 +8,15 @@ Distribution: unstable Urgency: low Maintainer: Joshua Timberman <Joshua Timberman <joshua@opscode.com>> Changed-By: Joshua Timberman <joshua@opscode.com> -Description: +Description: chef-integration-test - Chef integration tests for APT in Cucumber -Changes: +Changes: chef-integration-test (1.0-1) unstable; urgency=low . * Initial release (Closes: #CHEF-1718) -Checksums-Sha1: +Checksums-Sha1: b44685ff59626bc94c67e60665f06c4643fe9767 1680 chef-integration-test_1.0-1_amd64.deb -Checksums-Sha256: +Checksums-Sha256: da176f4405fa21fd7207d4785680c6996d395a1ca132f2d5565a61c5479b1116 1680 chef-integration-test_1.0-1_amd64.deb -Files: +Files: 713722480408ecc8e7220aea52bdd76e 1680 ruby extra chef-integration-test_1.0-1_amd64.deb diff --git a/spec/data/apt/chef-integration-test_1.1-1_amd64.changes b/spec/data/apt/chef-integration-test_1.1-1_amd64.changes index f014de813b..70246eff4e 100644 --- a/spec/data/apt/chef-integration-test_1.1-1_amd64.changes +++ b/spec/data/apt/chef-integration-test_1.1-1_amd64.changes @@ -8,15 +8,15 @@ Distribution: unstable Urgency: low Maintainer: Joshua Timberman <Joshua Timberman <joshua@opscode.com>> Changed-By: Joshua Timberman <joshua@opscode.com> -Description: +Description: chef-integration-test - Chef integration tests for APT in Cucumber -Changes: +Changes: chef-integration-test (1.1-1) unstable; urgency=low . * New upstream release (1.1) -Checksums-Sha1: +Checksums-Sha1: 43c5653a9a5b9419849173a4ec3a9855cf0327a3 1722 chef-integration-test_1.1-1_amd64.deb -Checksums-Sha256: +Checksums-Sha256: 84e2f087f7e11d1b73743007ecfc6b8b34e03f6917c0993b35c0758ee59702c1 1722 chef-integration-test_1.1-1_amd64.deb -Files: +Files: 4b05bace483dbca54efc21f97ee47e1d 1722 ruby extra chef-integration-test_1.1-1_amd64.deb diff --git a/spec/data/bad-config.rb b/spec/data/bad-config.rb index 5477a69366..0ae6cb8b6f 100644 --- a/spec/data/bad-config.rb +++ b/spec/data/bad-config.rb @@ -1 +1 @@ -monkey_soup("tastes nice")
\ No newline at end of file +monkey_soup("tastes nice") diff --git a/spec/data/big_json.json b/spec/data/big_json.json index 96c2818894..e795cfc36a 100644 --- a/spec/data/big_json.json +++ b/spec/data/big_json.json @@ -1,2 +1,2 @@ {"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":"test" -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
\ No newline at end of file +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} diff --git a/spec/data/bootstrap/test.erb b/spec/data/bootstrap/test.erb index 7cdc7dfdd0..e0ba0d630f 100644 --- a/spec/data/bootstrap/test.erb +++ b/spec/data/bootstrap/test.erb @@ -1 +1 @@ -<%= first_boot.to_json %>
\ No newline at end of file +<%= first_boot.to_json %> diff --git a/spec/data/cb_version_cookbooks/tatft/README.rdoc b/spec/data/cb_version_cookbooks/tatft/README.rdoc index 460d96b40d..103517ba62 100644 --- a/spec/data/cb_version_cookbooks/tatft/README.rdoc +++ b/spec/data/cb_version_cookbooks/tatft/README.rdoc @@ -1,3 +1,3 @@ = THIS RECIPE * is for testing CookbookLoader/CookbookVersion -* has at least one of every kind of file that cookbooks can have
\ No newline at end of file +* has at least one of every kind of file that cookbooks can have diff --git a/spec/data/cb_version_cookbooks/tatft/definitions/runit_service.rb b/spec/data/cb_version_cookbooks/tatft/definitions/runit_service.rb index 3912b37365..8b9f134364 100644 --- a/spec/data/cb_version_cookbooks/tatft/definitions/runit_service.rb +++ b/spec/data/cb_version_cookbooks/tatft/definitions/runit_service.rb @@ -1 +1 @@ -# IRL the runit_service is a definition to set up runit services
\ No newline at end of file +# IRL the runit_service is a definition to set up runit services diff --git a/spec/data/cb_version_cookbooks/tatft/files/default/giant_blob.tgz b/spec/data/cb_version_cookbooks/tatft/files/default/giant_blob.tgz index 3e7496601e..ba7be4266c 100644 --- a/spec/data/cb_version_cookbooks/tatft/files/default/giant_blob.tgz +++ b/spec/data/cb_version_cookbooks/tatft/files/default/giant_blob.tgz @@ -1 +1 @@ -# not really a giant blob #
\ No newline at end of file +# not really a giant blob # diff --git a/spec/data/cb_version_cookbooks/tatft/libraries/ownage.rb b/spec/data/cb_version_cookbooks/tatft/libraries/ownage.rb index fea05ba67b..490c0ee0a0 100644 --- a/spec/data/cb_version_cookbooks/tatft/libraries/ownage.rb +++ b/spec/data/cb_version_cookbooks/tatft/libraries/ownage.rb @@ -1 +1 @@ -# 0wnage
\ No newline at end of file +# 0wnage diff --git a/spec/data/cb_version_cookbooks/tatft/providers/lwp.rb b/spec/data/cb_version_cookbooks/tatft/providers/lwp.rb index 977ad19192..2aa056f7d8 100644 --- a/spec/data/cb_version_cookbooks/tatft/providers/lwp.rb +++ b/spec/data/cb_version_cookbooks/tatft/providers/lwp.rb @@ -1 +1 @@ -# a LWP
\ No newline at end of file +# a LWP diff --git a/spec/data/cb_version_cookbooks/tatft/recipes/default.rb b/spec/data/cb_version_cookbooks/tatft/recipes/default.rb index 48eacf848b..3db8a65e45 100644 --- a/spec/data/cb_version_cookbooks/tatft/recipes/default.rb +++ b/spec/data/cb_version_cookbooks/tatft/recipes/default.rb @@ -1 +1 @@ -# the default recipe
\ No newline at end of file +# the default recipe diff --git a/spec/data/cb_version_cookbooks/tatft/resources/lwr.rb b/spec/data/cb_version_cookbooks/tatft/resources/lwr.rb index 987114f4ca..cda9440331 100644 --- a/spec/data/cb_version_cookbooks/tatft/resources/lwr.rb +++ b/spec/data/cb_version_cookbooks/tatft/resources/lwr.rb @@ -1 +1 @@ -# a LWR #
\ No newline at end of file +# a LWR # diff --git a/spec/data/checksum/random.txt b/spec/data/checksum/random.txt index 9570fff833..45f087a281 100644 --- a/spec/data/checksum/random.txt +++ b/spec/data/checksum/random.txt @@ -1 +1 @@ -e4010abcac515ef3b78e92ee1f848a0d3bc3a526fcb826e7b4d39a6d516aa0487085c9b1be35e8d909617b250dca36dd4a55f01b7cdd310826bfd748cb27e0e43dd52b22968383c8086b06ee2d16e13574f98c058ce2bc3475b92ecf9c16e504022d60b132643986a8e7908d067526e20b4bafe1eb75349f27a4d3de02b077e76a2f59b73c14413f11e7208ae0bf6a408d51a97d490530e23476960ab8780ad86349947d82f1c9e57c85f86d71f80a6709b58be5f993a6a6df80c5a0857627d4a01e71484f6a6e983985089c00fe538e947230813c3a3e19baf6dae6db7082d07392a239ec1be385646356db3e3d76571488a6c72f0b96997f6191beea9846fc99f82a828f05af95cfc234cf681002f830915b1f3d35b2178b54a861c05d2694c5f6cfeb613a4a3670d849180461cdedf2c3cbb022608d8b19c86179d2d6da6b9acefccfc34b59663ef1282fec262bef79b2fbdd9b6669c90d6817b3762164dc309616469b33b83b1ded3420ae9177bc8f456d83939ff3c91b0a3683f3157401ceadf679c9f876da2aa413e081ee4c41d4b04f49e0c254d0082fd9bf2cb8eb8b966285be2cdcaab0ab70ea970737244b6683283598c30bdc206a05df72048b342eb40c2cd750c815d5fa944167b103ec40d60a99c49941a9e76d874149524f35ca294d081cf221757df77e027640556d983978be6b4b51aff26cd74a2f300d71
\ No newline at end of file +e4010abcac515ef3b78e92ee1f848a0d3bc3a526fcb826e7b4d39a6d516aa0487085c9b1be35e8d909617b250dca36dd4a55f01b7cdd310826bfd748cb27e0e43dd52b22968383c8086b06ee2d16e13574f98c058ce2bc3475b92ecf9c16e504022d60b132643986a8e7908d067526e20b4bafe1eb75349f27a4d3de02b077e76a2f59b73c14413f11e7208ae0bf6a408d51a97d490530e23476960ab8780ad86349947d82f1c9e57c85f86d71f80a6709b58be5f993a6a6df80c5a0857627d4a01e71484f6a6e983985089c00fe538e947230813c3a3e19baf6dae6db7082d07392a239ec1be385646356db3e3d76571488a6c72f0b96997f6191beea9846fc99f82a828f05af95cfc234cf681002f830915b1f3d35b2178b54a861c05d2694c5f6cfeb613a4a3670d849180461cdedf2c3cbb022608d8b19c86179d2d6da6b9acefccfc34b59663ef1282fec262bef79b2fbdd9b6669c90d6817b3762164dc309616469b33b83b1ded3420ae9177bc8f456d83939ff3c91b0a3683f3157401ceadf679c9f876da2aa413e081ee4c41d4b04f49e0c254d0082fd9bf2cb8eb8b966285be2cdcaab0ab70ea970737244b6683283598c30bdc206a05df72048b342eb40c2cd750c815d5fa944167b103ec40d60a99c49941a9e76d874149524f35ca294d081cf221757df77e027640556d983978be6b4b51aff26cd74a2f300d71 diff --git a/spec/data/config.rb b/spec/data/config.rb index 0b3340ce57..6beae90467 100644 --- a/spec/data/config.rb +++ b/spec/data/config.rb @@ -1,6 +1,6 @@ # # Sample Chef Config File -# +# cookbook_path "/etc/chef/cookbook", "/etc/chef/site-cookbook" diff --git a/spec/data/cookbooks/apache2/recipes/default.rb b/spec/data/cookbooks/apache2/recipes/default.rb index c2fa53be32..2d5457807e 100644 --- a/spec/data/cookbooks/apache2/recipes/default.rb +++ b/spec/data/cookbooks/apache2/recipes/default.rb @@ -1,3 +1,3 @@ # # Nothing ot see here -#
\ No newline at end of file +# diff --git a/spec/data/cookbooks/borken/recipes/default.rb b/spec/data/cookbooks/borken/recipes/default.rb index caf40b3974..8063e32a95 100644 --- a/spec/data/cookbooks/borken/recipes/default.rb +++ b/spec/data/cookbooks/borken/recipes/default.rb @@ -1,2 +1,2 @@ a cat walked on the keyboard one day... -(*&(*&(*&(*&(*^%$%^%#^^&(*)(*{}}}}}}}}+++++===))))))
\ No newline at end of file +(*&(*&(*&(*&(*^%$%^%#^^&(*)(*{}}}}}}}}+++++===)))))) diff --git a/spec/data/cookbooks/borken/templates/default/borken.erb b/spec/data/cookbooks/borken/templates/default/borken.erb index cbb32c1cd7..35321266ba 100644 --- a/spec/data/cookbooks/borken/templates/default/borken.erb +++ b/spec/data/cookbooks/borken/templates/default/borken.erb @@ -1,2 +1,2 @@ a cat walked on the keyboard one day... -<%= (*&)(*^^^^*******++_+_--- }}}}]]]end)%>
\ No newline at end of file +<%= (*&)(*^^^^*******++_+_--- }}}}]]]end)%> diff --git a/spec/data/cookbooks/ignorken/recipes/default.rb b/spec/data/cookbooks/ignorken/recipes/default.rb index 0f3b3a5d8d..921f80018a 100644 --- a/spec/data/cookbooks/ignorken/recipes/default.rb +++ b/spec/data/cookbooks/ignorken/recipes/default.rb @@ -1 +1 @@ -# This is fine!
\ No newline at end of file +# This is fine! diff --git a/spec/data/cookbooks/ignorken/recipes/ignoreme.rb b/spec/data/cookbooks/ignorken/recipes/ignoreme.rb index caf40b3974..8063e32a95 100644 --- a/spec/data/cookbooks/ignorken/recipes/ignoreme.rb +++ b/spec/data/cookbooks/ignorken/recipes/ignoreme.rb @@ -1,2 +1,2 @@ a cat walked on the keyboard one day... -(*&(*&(*&(*&(*^%$%^%#^^&(*)(*{}}}}}}}}+++++===))))))
\ No newline at end of file +(*&(*&(*&(*&(*^%$%^%#^^&(*)(*{}}}}}}}}+++++===)))))) diff --git a/spec/data/cookbooks/java/files/default/java.response b/spec/data/cookbooks/java/files/default/java.response index eb4aa3c124..ca275ecf76 100644 --- a/spec/data/cookbooks/java/files/default/java.response +++ b/spec/data/cookbooks/java/files/default/java.response @@ -1,2 +1,2 @@ # Hi, I'm pretending to be the preseed file for installing the Sun JDK on debian -# or Ubuntu
\ No newline at end of file +# or Ubuntu diff --git a/spec/data/cookbooks/openldap/attributes/default.rb b/spec/data/cookbooks/openldap/attributes/default.rb index d0756f17e3..0cc8c6a55f 100644 --- a/spec/data/cookbooks/openldap/attributes/default.rb +++ b/spec/data/cookbooks/openldap/attributes/default.rb @@ -12,5 +12,5 @@ else default[:ldap_server] = "ops1prod" default[:ldap_basedn] = "dc=hjksolutions,dc=com" - default[:ldap_replication_password] = "forsure" + default[:ldap_replication_password] = "forsure" end diff --git a/spec/data/cookbooks/openldap/files/default/.ssh/id_rsa b/spec/data/cookbooks/openldap/files/default/.ssh/id_rsa index 20a3ea410a..ed61f6b9c4 100644 --- a/spec/data/cookbooks/openldap/files/default/.ssh/id_rsa +++ b/spec/data/cookbooks/openldap/files/default/.ssh/id_rsa @@ -1 +1 @@ -FAKE KEY
\ No newline at end of file +FAKE KEY diff --git a/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file1.txt b/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file1.txt index 7632730912..8a90b78aac 100644 --- a/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file1.txt +++ b/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file1.txt @@ -1,3 +1,3 @@ # remote directory # file specificity: default -# relpath: remotedir/remote_dir_file1.txt
\ No newline at end of file +# relpath: remotedir/remote_dir_file1.txt diff --git a/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file2.txt b/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file2.txt index fab0433922..0e3509a78c 100644 --- a/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file2.txt +++ b/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file2.txt @@ -1,3 +1,3 @@ # remote directory # file specificity: default -# relpath: remotedir/remote_dir_file2.txt
\ No newline at end of file +# relpath: remotedir/remote_dir_file2.txt diff --git a/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file1.txt b/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file1.txt index 611294cb81..b970be4122 100644 --- a/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file1.txt +++ b/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file1.txt @@ -1,3 +1,3 @@ # remote directory # file specificity: default -# relpath: remotedir/remotesubdir/remote_dir_file1.txt
\ No newline at end of file +# relpath: remotedir/remotesubdir/remote_dir_file1.txt diff --git a/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file2.txt b/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file2.txt index e0396542a4..a82def80b2 100644 --- a/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file2.txt +++ b/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file2.txt @@ -1,3 +1,3 @@ # remote directory # file specificity: default -# relpath: remotedir/remotesubdir/remote_dir_file2.txt
\ No newline at end of file +# relpath: remotedir/remotesubdir/remote_dir_file2.txt diff --git a/spec/data/cookbooks/openldap/templates/default/openldap_stuff.conf.erb b/spec/data/cookbooks/openldap/templates/default/openldap_stuff.conf.erb index af82f1d96c..ca40f8425b 100644 --- a/spec/data/cookbooks/openldap/templates/default/openldap_stuff.conf.erb +++ b/spec/data/cookbooks/openldap/templates/default/openldap_stuff.conf.erb @@ -1 +1 @@ -slappiness is <%= node[:slappiness] -%>
\ No newline at end of file +slappiness is <%= node[:slappiness] -%> diff --git a/spec/data/cookbooks/openldap/templates/default/some_windows_line_endings.erb b/spec/data/cookbooks/openldap/templates/default/some_windows_line_endings.erb index fa25999b6a..1957786e74 100644 --- a/spec/data/cookbooks/openldap/templates/default/some_windows_line_endings.erb +++ b/spec/data/cookbooks/openldap/templates/default/some_windows_line_endings.erb @@ -1,4 +1,3 @@ Template rendering libraries -should support
+should support different line endings -
diff --git a/spec/data/definitions/test.rb b/spec/data/definitions/test.rb index b0d0effc27..aaec15b8a0 100644 --- a/spec/data/definitions/test.rb +++ b/spec/data/definitions/test.rb @@ -2,4 +2,4 @@ define :rico_suave, :rich => "smooth" do zen_master "test" do something "#{params[:rich]}" end -end
\ No newline at end of file +end diff --git a/spec/data/environment-config.rb b/spec/data/environment-config.rb index a157ecf0ea..984017b57a 100644 --- a/spec/data/environment-config.rb +++ b/spec/data/environment-config.rb @@ -2,4 +2,4 @@ # Sample Chef Config File # -environment "production"
\ No newline at end of file +environment "production" diff --git a/spec/data/kitchen/openldap/attributes/robinson.rb b/spec/data/kitchen/openldap/attributes/robinson.rb index 9d6b44d464..8c7d52c268 100644 --- a/spec/data/kitchen/openldap/attributes/robinson.rb +++ b/spec/data/kitchen/openldap/attributes/robinson.rb @@ -1,3 +1,3 @@ # # Smokey lives here -#
\ No newline at end of file +# diff --git a/spec/data/kitchen/openldap/definitions/drewbarrymore.rb b/spec/data/kitchen/openldap/definitions/drewbarrymore.rb index 510f0c35da..83bb5b1a15 100644 --- a/spec/data/kitchen/openldap/definitions/drewbarrymore.rb +++ b/spec/data/kitchen/openldap/definitions/drewbarrymore.rb @@ -1,3 +1,3 @@ # -# Was in people magazine this month... -#
\ No newline at end of file +# Was in people magazine this month... +# diff --git a/spec/data/kitchen/openldap/recipes/gigantor.rb b/spec/data/kitchen/openldap/recipes/gigantor.rb index 70a41960eb..0ac8a9bb4b 100644 --- a/spec/data/kitchen/openldap/recipes/gigantor.rb +++ b/spec/data/kitchen/openldap/recipes/gigantor.rb @@ -1,3 +1,3 @@ cat "blanket" do pretty_kitty true -end
\ No newline at end of file +end diff --git a/spec/data/kitchen/openldap/recipes/ignoreme.rb b/spec/data/kitchen/openldap/recipes/ignoreme.rb index 15095986c6..d80a313a50 100644 --- a/spec/data/kitchen/openldap/recipes/ignoreme.rb +++ b/spec/data/kitchen/openldap/recipes/ignoreme.rb @@ -1,3 +1,3 @@ # # this file will never be seen -#
\ No newline at end of file +# diff --git a/spec/data/knife_subcommand/test_explicit_category.rb b/spec/data/knife_subcommand/test_explicit_category.rb index 96d50691a1..2b68c161af 100644 --- a/spec/data/knife_subcommand/test_explicit_category.rb +++ b/spec/data/knife_subcommand/test_explicit_category.rb @@ -4,4 +4,4 @@ module KnifeSpecs # category instead of cookbook (which is what would be assumed) category "cookbook site" end -end
\ No newline at end of file +end diff --git a/spec/data/knife_subcommand/test_name_mapping.rb b/spec/data/knife_subcommand/test_name_mapping.rb index 25c49b0df0..8fcf1b6a1d 100644 --- a/spec/data/knife_subcommand/test_name_mapping.rb +++ b/spec/data/knife_subcommand/test_name_mapping.rb @@ -1,4 +1,4 @@ module KnifeSpecs class TestNameMapping < Chef::Knife - end + end end diff --git a/spec/data/lwrp_override/providers/buck_passer.rb b/spec/data/lwrp_override/providers/buck_passer.rb index 75917a58c9..8d5156af81 100644 --- a/spec/data/lwrp_override/providers/buck_passer.rb +++ b/spec/data/lwrp_override/providers/buck_passer.rb @@ -7,4 +7,4 @@ action :pass_buck do action :twiddle_thumbs provider :lwrp_thumb_twiddler end -end
\ No newline at end of file +end diff --git a/spec/data/recipes/test.rb b/spec/data/recipes/test.rb index c33d714a2c..89ae003ab5 100644 --- a/spec/data/recipes/test.rb +++ b/spec/data/recipes/test.rb @@ -1,7 +1,7 @@ -file "/etc/nsswitch.conf" do +file "/etc/nsswitch.conf" do action :create owner "root" - group "root" + group "root" mode 0644 end diff --git a/spec/data/remote_directory_data/remote_dir_file.txt b/spec/data/remote_directory_data/remote_dir_file.txt index 17aa3a6838..96efb55215 100644 --- a/spec/data/remote_directory_data/remote_dir_file.txt +++ b/spec/data/remote_directory_data/remote_dir_file.txt @@ -1 +1 @@ -I'm a file inside a the root remote_directory source dir.
\ No newline at end of file +I'm a file inside a the root remote_directory source dir. diff --git a/spec/data/remote_directory_data/remote_subdirectory/remote_subdir_file.txt b/spec/data/remote_directory_data/remote_subdirectory/remote_subdir_file.txt index a73728a4bb..2531df2345 100644 --- a/spec/data/remote_directory_data/remote_subdirectory/remote_subdir_file.txt +++ b/spec/data/remote_directory_data/remote_subdirectory/remote_subdir_file.txt @@ -1 +1 @@ -I'm a file in a subdirectory inside a remote_directory source
\ No newline at end of file +I'm a file in a subdirectory inside a remote_directory source diff --git a/spec/data/shef-config.rb b/spec/data/shef-config.rb index 3c3ae9045a..378ac29e65 100644 --- a/spec/data/shef-config.rb +++ b/spec/data/shef-config.rb @@ -1,6 +1,6 @@ -Ohai::Config[:disabled_plugins] << 'darwin::system_profiler' << 'darwin::kernel' << 'darwin::ssh_host_key' << 'network_listeners' +Ohai::Config[:disabled_plugins] << 'darwin::system_profiler' << 'darwin::kernel' << 'darwin::ssh_host_key' << 'network_listeners' Ohai::Config[:disabled_plugins] << "virtualization" << "darwin::virtualization" -Ohai::Config[:disabled_plugins] << 'darwin::uptime' << 'darwin::filesystem' << 'dmi' << 'lanuages' << 'perl' << 'python' << 'java' +Ohai::Config[:disabled_plugins] << 'darwin::uptime' << 'darwin::filesystem' << 'dmi' << 'lanuages' << 'perl' << 'python' << 'java' Ohai::Config[:disabled_plugins] << "linux::block_device" << "linux::kernel" << "linux::ssh_host_key" << "linux::virtualization" Ohai::Config[:disabled_plugins] << "linux::cpu" << "linux::memory" << "ec2" << "rackspace" << "eucalyptus" << "ip_scopes" Ohai::Config[:disabled_plugins] << "solaris2::cpu" << "solaris2::dmi" << "solaris2::filesystem" << "solaris2::kernel" diff --git a/spec/data/templates/seattle.txt b/spec/data/templates/seattle.txt index 19f6290939..e1b2fe006e 100644 --- a/spec/data/templates/seattle.txt +++ b/spec/data/templates/seattle.txt @@ -1 +1 @@ -Seattle is a great town. Next time you visit, you should buy me a beer.
\ No newline at end of file +Seattle is a great town. Next time you visit, you should buy me a beer. diff --git a/spec/functional/knife/cookbook_delete_spec.rb b/spec/functional/knife/cookbook_delete_spec.rb index 1dbd604ca5..2d52fb91a3 100644 --- a/spec/functional/knife/cookbook_delete_spec.rb +++ b/spec/functional/knife/cookbook_delete_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -94,7 +94,7 @@ describe Chef::Knife::CookbookDelete do stdout.string.should match(/#{Regexp.escape('Are you sure you want to purge files')}/) stdout.string.should match(/#{Regexp.escape('Do you really want to delete obsolete-cookbook version 1.0.0? (Y/N)')}/) cb100_deleted.should be_true - + end end diff --git a/spec/functional/resource/batch_spec.rb b/spec/functional/resource/batch_spec.rb index 7f7125a91e..818cc7a0f4 100644 --- a/spec/functional/resource/batch_spec.rb +++ b/spec/functional/resource/batch_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,14 +22,14 @@ shared_context Chef::Resource::WindowsScript do before(:all) do ohai_reader = Ohai::System.new - ohai_reader.require_plugin("os") + ohai_reader.require_plugin("os") ohai_reader.require_plugin("windows::platform") new_node = Chef::Node.new new_node.consume_external_attrs(ohai_reader.data,{}) - + events = Chef::EventDispatch::Dispatcher.new - + @run_context = Chef::RunContext.new(new_node, {}, events) end @@ -38,7 +38,7 @@ shared_context Chef::Resource::WindowsScript do end before(:each) do -k File.delete(script_output_path) if File.exists?(script_output_path) +k File.delete(script_output_path) if File.exists?(script_output_path) end after(:each) do @@ -54,11 +54,11 @@ describe Chef::Resource::WindowsScript::Batch, :windows_only do end context "when the run action is invoked on Windows" do - include_context Chef::Resource::WindowsScript + include_context Chef::Resource::WindowsScript it "executes the script code" do resource.code(script_content + " > #{script_output_path}") resource.returns(0) resource.run_action(:run) end - end + end end diff --git a/spec/functional/resource/cron_spec.rb b/spec/functional/resource/cron_spec.rb index 35be2bbaa6..4c20023d78 100644 --- a/spec/functional/resource/cron_spec.rb +++ b/spec/functional/resource/cron_spec.rb @@ -78,7 +78,7 @@ describe Chef::Resource::Cron, :requires_root, :unix_only do it "should delete a crontab entry" do # Note that test cron is created by previous test new_resource.run_action(:delete) - + cron_should_not_exists(new_resource.name) end end @@ -144,4 +144,4 @@ describe Chef::Resource::Cron, :requires_root, :unix_only do end end -end
\ No newline at end of file +end diff --git a/spec/functional/resource/mount_spec.rb b/spec/functional/resource/mount_spec.rb index 4070cacfda..7eedfeab41 100644 --- a/spec/functional/resource/mount_spec.rb +++ b/spec/functional/resource/mount_spec.rb @@ -83,7 +83,7 @@ describe Chef::Resource::Mount, :requires_root, :external => include_flag do validation_cmd << " | grep #{options.join(',')} " unless options.nil? || options.empty? puts "validation_cmd = #{validation_cmd}" expect(shell_out(validation_cmd).exitstatus).to eq(0) - end + end end def mount_should_not_exists(mount_point) @@ -100,7 +100,7 @@ describe Chef::Resource::Mount, :requires_root, :external => include_flag do else mount_config = "/etc/fstab" end - end + end def mount_should_be_enabled(mount_point, device) if windows? @@ -108,10 +108,10 @@ describe Chef::Resource::Mount, :requires_root, :external => include_flag do case ohai[:platform] when 'aix' expect(shell_out("cat #{unix_mount_config_file} | grep \"#{mount_point}:\" ").exitstatus).to eq(0) - else + else expect(shell_out("cat #{unix_mount_config_file} | grep \"#{mount_point}\" | grep \"#{device}\" ").exitstatus).to eq(0) end - end + end end def mount_should_be_disabled(mount_point) @@ -228,4 +228,4 @@ describe Chef::Resource::Mount, :requires_root, :external => include_flag do mount_should_be_disabled(new_resource.mount_point) end end -end
\ No newline at end of file +end diff --git a/spec/functional/resource/powershell_spec.rb b/spec/functional/resource/powershell_spec.rb index 4d31eb3ef1..d217515ce1 100644 --- a/spec/functional/resource/powershell_spec.rb +++ b/spec/functional/resource/powershell_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,7 +21,7 @@ require 'functional/resource/batch_spec.rb' describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do - include_context Chef::Resource::WindowsScript + include_context Chef::Resource::WindowsScript let(:successful_executable_script_content) { "#{ENV['SystemRoot']}\\system32\\attrib.exe $env:systemroot" } let(:failed_executable_script_content) { "#{ENV['SystemRoot']}\\system32\\attrib.exe /badargument" } @@ -36,7 +36,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do let(:arbitrary_nonzero_process_exit_code) { 4193 } let(:arbitrary_nonzero_process_exit_code_content) { "exit #{arbitrary_nonzero_process_exit_code}" } let(:invalid_powershell_interpreter_flag) { "/thisflagisinvalid" } - let(:valid_powershell_interpreter_flag) { "-Sta" } + let(:valid_powershell_interpreter_flag) { "-Sta" } let!(:resource) do r = Chef::Resource::WindowsScript::PowershellScript.new("Powershell resource functional test", @run_context) r.code(successful_executable_script_content) @@ -53,31 +53,31 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do it "returns the process exit code" do resource.code(arbitrary_nonzero_process_exit_code_content) resource.returns(arbitrary_nonzero_process_exit_code) - resource.run_action(:run) + resource.run_action(:run) end it "returns 0 if the last command was a cmdlet that succeeded" do resource.code(cmdlet_exit_code_success_content) resource.returns(0) - resource.run_action(:run) + resource.run_action(:run) end it "returns 0 if the last command was a cmdlet that succeeded and was preceded by a non-cmdlet Windows binary that failed" do resource.code([windows_process_exit_code_not_found_content, cmdlet_exit_code_success_content].join(';')) resource.returns(0) - resource.run_action(:run) + resource.run_action(:run) end - + it "returns 1 if the last command was a cmdlet that failed" do resource.code(cmdlet_exit_code_not_found_content) resource.returns(1) - resource.run_action(:run) + resource.run_action(:run) end it "returns 1 if the last command was a cmdlet that failed and was preceded by a successfully executed non-cmdlet Windows binary" do resource.code([windows_process_exit_code_success_content, cmdlet_exit_code_not_found_content].join(';')) resource.returns(1) - resource.run_action(:run) + resource.run_action(:run) end # This somewhat ambiguous case, two failures of different types, @@ -91,34 +91,34 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do it "returns 1 if the last command was a cmdlet that failed and was preceded by an unsuccessfully executed non-cmdlet Windows binary" do resource.code([arbitrary_nonzero_process_exit_code_content,cmdlet_exit_code_not_found_content].join(';')) resource.returns(arbitrary_nonzero_process_exit_code) - resource.run_action(:run) + resource.run_action(:run) end it "returns 0 if the last command was a non-cmdlet Windows binary that succeeded and was preceded by a failed cmdlet" do resource.code([cmdlet_exit_code_success_content, arbitrary_nonzero_process_exit_code_content].join(';')) resource.returns(arbitrary_nonzero_process_exit_code) - resource.run_action(:run) + resource.run_action(:run) end - + it "returns a specific error code if the last command was a non-cmdlet Windows binary that failed and was preceded by cmdlet that succeeded" do resource.code([cmdlet_exit_code_success_content, arbitrary_nonzero_process_exit_code_content].join(';')) resource.returns(arbitrary_nonzero_process_exit_code) - resource.run_action(:run) + resource.run_action(:run) end it "returns a specific error code if the last command was a non-cmdlet Windows binary that failed and was preceded by cmdlet that failed" do resource.code([cmdlet_exit_code_not_found_content, arbitrary_nonzero_process_exit_code_content].join(';')) resource.returns(arbitrary_nonzero_process_exit_code) - resource.run_action(:run) + resource.run_action(:run) end - + it "executes a script with a 64-bit process on a 64-bit OS, otherwise a 32-bit process" do resource.code(processor_architecture_script_content + " | out-file -encoding ASCII #{script_output_path}") resource.returns(0) resource.run_action(:run) is_64_bit = (ENV['PROCESSOR_ARCHITECTURE'] == 'AMD64') || (ENV['PROCESSOR_ARCHITEW6432'] == 'AMD64') - + detected_64_bit = source_contains_case_insensitive_content?( get_script_output, 'AMD64' ) is_64_bit.should == detected_64_bit @@ -128,15 +128,15 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do resource.code(cmdlet_exit_code_success_content) resource.flags(invalid_powershell_interpreter_flag) resource.returns(1) - resource.run_action(:run) + resource.run_action(:run) end it "returns 0 if a valid flag is passed to the interpreter" do resource.code(cmdlet_exit_code_success_content) resource.flags(valid_powershell_interpreter_flag) resource.returns(0) - resource.run_action(:run) - end + resource.run_action(:run) + end end context "when running on a 32-bit version of Windows", :windows32_only do @@ -167,7 +167,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do source_contains_case_insensitive_content?( get_script_output, 'AMD64' ).should == true end - + it "executes a script with a 32-bit process if :i386 arch is specified" do resource.code(processor_architecture_script_content + " | out-file -encoding ASCII #{script_output_path}") resource.architecture(:i386) diff --git a/spec/functional/shell_spec.rb b/spec/functional/shell_spec.rb index 518f1f7adf..64bd28f16c 100644 --- a/spec/functional/shell_spec.rb +++ b/spec/functional/shell_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -58,7 +58,7 @@ describe Shell do sleep 0.01 end exitstatus[1] - end + end def run_chef_shell_with(options) case ohai[:platform] diff --git a/spec/functional/tiny_server_spec.rb b/spec/functional/tiny_server_spec.rb index 68ab9e7294..4262d9e536 100644 --- a/spec/functional/tiny_server_spec.rb +++ b/spec/functional/tiny_server_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/functional/win32/versions_spec.rb b/spec/functional/win32/versions_spec.rb index 5cf3a13fd8..acb8bb126d 100644 --- a/spec/functional/win32/versions_spec.rb +++ b/spec/functional/win32/versions_spec.rb @@ -44,7 +44,7 @@ describe "Chef::ReservedNames::Win32::Version", :windows_only do # The name from WMI is actually what we want in Win2k8R2+. # So this expectation sould continue to hold without modification # as new versions of Windows are released. - @current_os_version = host.caption + @current_os_version = host.caption end @version = Chef::ReservedNames::Win32::Version.new @@ -55,10 +55,10 @@ describe "Chef::ReservedNames::Win32::Version", :windows_only do @current_os_version.should include(@version.marketing_name) end end - + def is_windows_server_2008?(wmi_host) is_win2k8 = false - + os_version = wmi_host.send('Version') # The operating system version is a string in the following form diff --git a/spec/integration/knife/download_spec.rb b/spec/integration/knife/download_spec.rb index eb5761bded..bb7dc17856 100644 --- a/spec/integration/knife/download_spec.rb +++ b/spec/integration/knife/download_spec.rb @@ -592,7 +592,7 @@ EOM context 'except the role file is textually different, but not ACTUALLY different' do file 'roles/x.json', <<EOM -{ +{ "chef_type": "role" , "default_attributes": { }, @@ -604,7 +604,7 @@ EOM "override_attributes": { }, "run_list": [ - + ] } EOM diff --git a/spec/support/lib/chef/provider/easy.rb b/spec/support/lib/chef/provider/easy.rb index 054b45256c..a4d285a838 100644 --- a/spec/support/lib/chef/provider/easy.rb +++ b/spec/support/lib/chef/provider/easy.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,11 +22,11 @@ class Chef def load_current_resource true end - + def action_sell true end - + def action_buy true end diff --git a/spec/support/lib/chef/provider/snakeoil.rb b/spec/support/lib/chef/provider/snakeoil.rb index c5d8d52a82..e9d01f654f 100644 --- a/spec/support/lib/chef/provider/snakeoil.rb +++ b/spec/support/lib/chef/provider/snakeoil.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,7 +22,7 @@ class Chef def load_current_resource true end - + def action_purr @new_resource.updated_by_last_action(true) true @@ -31,7 +31,7 @@ class Chef def action_sell true end - + def action_buy true end diff --git a/spec/support/lib/chef/resource/cat.rb b/spec/support/lib/chef/resource/cat.rb index 83eb9f08a3..ecca50cb53 100644 --- a/spec/support/lib/chef/resource/cat.rb +++ b/spec/support/lib/chef/resource/cat.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,15 +19,15 @@ class Chef class Resource class Cat < Chef::Resource - + attr_accessor :action - + def initialize(name, run_context=nil) @resource_name = :cat super @action = "sell" end - + def pretty_kitty(arg=nil) if arg == true or arg == false @pretty_kitty = arg diff --git a/spec/support/shared/unit/script_resource.rb b/spec/support/shared/unit/script_resource.rb index 0451f4694a..5f37506df6 100644 --- a/spec/support/shared/unit/script_resource.rb +++ b/spec/support/shared/unit/script_resource.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,26 +23,26 @@ shared_examples_for "a script resource" do before(:each) do @resource = script_resource - end + end it "should create a new Chef::Resource::Script" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Script) end - + it "should have a resource name of :script" do @resource.resource_name.should eql(resource_name) end - + it "should set command to the argument provided to new" do @resource.command.should eql(resource_instance_name) end - + it "should accept a string for the code" do @resource.code "hey jude" @resource.code.should eql("hey jude") end - + it "should accept a string for the flags" do @resource.flags "-f" @resource.flags.should eql("-f") diff --git a/spec/support/shared/unit/windows_script_resource.rb b/spec/support/shared/unit/windows_script_resource.rb index 0a0079a287..23dbfbe722 100644 --- a/spec/support/shared/unit/windows_script_resource.rb +++ b/spec/support/shared/unit/windows_script_resource.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,10 +29,10 @@ shared_examples_for "a Windows script resource" do node.default["kernel"][:machine] = :x86_64.to_s run_context = Chef::RunContext.new(node, nil, nil) - + @resource = resource_instance - end + end it "should be a kind of Chef::Resource::WindowsScript" do @resource.should be_a_kind_of(Chef::Resource) @@ -40,9 +40,9 @@ shared_examples_for "a Windows script resource" do end context "script" do - let(:script_resource) { resource_instance } - it_should_behave_like "a script resource" + let(:script_resource) { resource_instance } + it_should_behave_like "a script resource" end - + end diff --git a/spec/tiny_server.rb b/spec/tiny_server.rb index fb8dfc6290..340c5d5fb6 100644 --- a/spec/tiny_server.rb +++ b/spec/tiny_server.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/api_client/registration_spec.rb b/spec/unit/api_client/registration_spec.rb index 3efbe9914b..0d21730664 100644 --- a/spec/unit/api_client/registration_spec.rb +++ b/spec/unit/api_client/registration_spec.rb @@ -57,7 +57,7 @@ describe Chef::ApiClient::Registration do end it "creates a new ApiClient on the server using the validator identity" do - response = {"uri" => "https://chef.local/clients/silent-bob", + response = {"uri" => "https://chef.local/clients/silent-bob", "private_key" => "--begin rsa key etc--"} http_mock.should_receive(:post). with("clients", :name => 'silent-bob', :admin => false). diff --git a/spec/unit/application/apply.rb b/spec/unit/application/apply.rb index 8a00413225..0dc24544b0 100644 --- a/spec/unit/application/apply.rb +++ b/spec/unit/application/apply.rb @@ -60,7 +60,7 @@ describe Chef::Application::Apply do describe "temp_recipe_file" do before do @app.instance_variable_set(:@recipe_text, @recipe_text) - @app.temp_recipe_file + @app.temp_recipe_file @recipe_fh = @app.instance_variable_get(:@recipe_fh) end it "should open a tempfile" do diff --git a/spec/unit/chef_spec.rb b/spec/unit/chef_spec.rb index cf60e64629..b0f0359806 100644 --- a/spec/unit/chef_spec.rb +++ b/spec/unit/chef_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/cookbook/metadata_spec.rb b/spec/unit/cookbook/metadata_spec.rb index 2757f92506..9822146131 100644 --- a/spec/unit/cookbook/metadata_spec.rb +++ b/spec/unit/cookbook/metadata_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,7 @@ require 'spec_helper' require 'chef/cookbook/metadata' -describe Chef::Cookbook::Metadata do +describe Chef::Cookbook::Metadata do before(:each) do @cookbook = Chef::CookbookVersion.new('test_cookbook') @meta = Chef::Cookbook::Metadata.new(@cookbook) @@ -86,7 +86,7 @@ describe Chef::Cookbook::Metadata do it "should return a Chef::Cookbook::Metadata object" do @meta.should be_a_kind_of(Chef::Cookbook::Metadata) end - + it "should allow a cookbook as the first argument" do lambda { Chef::Cookbook::Metadata.new(@cookbook) }.should_not raise_error end @@ -96,7 +96,7 @@ describe Chef::Cookbook::Metadata do end it "should set the maintainer name from the second argument" do - md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown') + md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown') md.maintainer.should == 'Bobo T. Clown' end @@ -105,7 +105,7 @@ describe Chef::Cookbook::Metadata do end it "should set the maintainer email from the third argument" do - md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown', 'bobo@clown.co') + md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown', 'bobo@clown.co') md.maintainer_email.should == 'bobo@clown.co' end @@ -114,10 +114,10 @@ describe Chef::Cookbook::Metadata do end it "should set the license from the fourth argument" do - md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown', 'bobo@clown.co', 'Clown License v1') + md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown', 'bobo@clown.co', 'Clown License v1') md.license.should == 'Clown License v1' end - end + end describe "cookbook" do it "should return the cookbook we were initialized with" do @@ -133,7 +133,7 @@ describe Chef::Cookbook::Metadata do describe "platforms" do it "should return the current platform hash" do - @meta.platforms.should be_a_kind_of(Hash) + @meta.platforms.should be_a_kind_of(Hash) end end @@ -235,7 +235,7 @@ describe Chef::Cookbook::Metadata do end end end - + describe "attribute groupings" do it "should allow you set a grouping" do group = { @@ -312,7 +312,7 @@ describe Chef::Cookbook::Metadata do @meta.attribute("db/mysql/databases", {}) @meta.attributes["db/mysql/databases"][:choice].should == [] end - + it "should let calculated be true or false" do lambda { @meta.attribute("db/mysql/databases", :calculated => true) @@ -324,7 +324,7 @@ describe Chef::Cookbook::Metadata do @meta.attribute("db/mysql/databases", :calculated => Hash.new) }.should raise_error(ArgumentError) end - + it "should set calculated to false by default" do @meta.attribute("db/mysql/databases", {}) @meta.attributes["db/mysql/databases"][:calculated].should == false @@ -350,7 +350,7 @@ describe Chef::Cookbook::Metadata do @meta.attribute("db/mysql/databases", :type => "symbol") }.should_not raise_error(ArgumentError) end - + it "should let type be hash (backwards compatability only)" do lambda { @meta.attribute("db/mysql/databases", :type => "hash") @@ -375,7 +375,7 @@ describe Chef::Cookbook::Metadata do }.should_not raise_error(ArgumentError) #attrib = @meta.attributes["db/mysql/databases"][:required].should == "required" end - + it "should convert required false to optional" do lambda { @meta.attribute("db/mysql/databases", :required => false) @@ -387,7 +387,7 @@ describe Chef::Cookbook::Metadata do @meta.attribute("db/mysql/databases", {}) @meta.attributes["db/mysql/databases"][:required].should == 'optional' end - + it "should make sure recipes is an array" do lambda { @meta.attribute("db/mysql/databases", :recipes => []) @@ -399,7 +399,7 @@ describe Chef::Cookbook::Metadata do it "should set recipes to an empty array by default" do @meta.attribute("db/mysql/databases", {}) - @meta.attributes["db/mysql/databases"][:recipes].should == [] + @meta.attributes["db/mysql/databases"][:recipes].should == [] end it "should allow the default value to be a string, array, or hash" do @@ -438,14 +438,14 @@ describe Chef::Cookbook::Metadata do lambda { attrs = { :choice => [ "a", "b", "c"], - :default => "b" + :default => "b" } @meta.attribute("db/mysql/databases", attrs) }.should_not raise_error(ArgumentError) lambda { attrs = { :choice => [ "a", "b", "c", "d", "e"], - :default => ["b", "d"] + :default => ["b", "d"] } @meta.attribute("db/mysql/databases", attrs) }.should_not raise_error(ArgumentError) @@ -455,7 +455,7 @@ describe Chef::Cookbook::Metadata do lambda { attrs = { :choice => [ "a", "b", "c"], - :default => "d" + :default => "d" } @meta.attribute("db/mysql/databases", attrs) }.should raise_error(ArgumentError) @@ -470,11 +470,11 @@ describe Chef::Cookbook::Metadata do end describe "recipes" do - before(:each) do + before(:each) do @cookbook.recipe_files = [ "default.rb", "enlighten.rb" ] @meta = Chef::Cookbook::Metadata.new(@cookbook) end - + it "should have the names of the recipes" do @meta.recipes["test_cookbook"].should == "" @meta.recipes["test_cookbook::enlighten"].should == "" @@ -493,7 +493,7 @@ describe Chef::Cookbook::Metadata do end describe "json" do - before(:each) do + before(:each) do @cookbook.recipe_files = [ "default.rb", "enlighten.rb" ] @meta = Chef::Cookbook::Metadata.new(@cookbook) @meta.version "1.0" @@ -509,8 +509,8 @@ describe Chef::Cookbook::Metadata do @meta.provides "foo(:bar, :baz)" @meta.replaces "snarkitron" @meta.recipe "test_cookbook::enlighten", "is your buddy" - @meta.attribute "bizspark/has_login", - :display_name => "You have nothing" + @meta.attribute "bizspark/has_login", + :display_name => "You have nothing" @meta.version "1.2.3" end @@ -524,23 +524,23 @@ describe Chef::Cookbook::Metadata do end %w{ - name - description - long_description - maintainer - maintainer_email + name + description + long_description + maintainer + maintainer_email license - platforms - dependencies - suggestions - recommendations - conflicting + platforms + dependencies + suggestions + recommendations + conflicting providing - replacing - attributes + replacing + attributes recipes version - }.each do |t| + }.each do |t| it "should include '#{t}'" do @serial[t].should == @meta.send(t.to_sym) end @@ -557,23 +557,23 @@ describe Chef::Cookbook::Metadata do end %w{ - name - description - long_description - maintainer - maintainer_email + name + description + long_description + maintainer + maintainer_email license - platforms - dependencies - suggestions - recommendations - conflicting + platforms + dependencies + suggestions + recommendations + conflicting providing - replacing - attributes + replacing + attributes recipes version - }.each do |t| + }.each do |t| it "should match '#{t}'" do @deserial.send(t.to_sym).should == @meta.send(t.to_sym) end diff --git a/spec/unit/cookbook/synchronizer_spec.rb b/spec/unit/cookbook/synchronizer_spec.rb index 4c6aa0c0ed..31f30c5bf4 100644 --- a/spec/unit/cookbook/synchronizer_spec.rb +++ b/spec/unit/cookbook/synchronizer_spec.rb @@ -176,11 +176,11 @@ describe Chef::CookbookSynchronizer do @cookbook_a_template_default_tempfile = mock("Tempfile for cookbook_a apache.conf.erb template", :path => "/tmp/cookbook_a_template_default_tempfile") end - + after do Chef::Config[:no_lazy_load] = false end - + it "fetches templates and cookbook files" do @file_cache.should_receive(:has_key?). with("cookbooks/cookbook_a/files/default/megaman.conf"). @@ -206,7 +206,7 @@ describe Chef::CookbookSynchronizer do @file_cache.should_receive(:load). with("cookbooks/cookbook_a/templates/default/apache2.conf.erb", false). and_return("/file-cache/cookbooks/cookbook_a/templates/default/apache2.conf.erb") - + @synchronizer.sync_cookbooks end end diff --git a/spec/unit/cookbook_loader_spec.rb b/spec/unit/cookbook_loader_spec.rb index c3303dd09a..59079a82de 100644 --- a/spec/unit/cookbook_loader_spec.rb +++ b/spec/unit/cookbook_loader_spec.rb @@ -71,7 +71,7 @@ describe Chef::CookbookLoader do seen[5].should == "openldap" end end - + describe "load_cookbooks" do it "should find all the cookbooks in the cookbook path" do Chef::Config.cookbook_path << File.expand_path(File.join(CHEF_SPEC_DATA, "hidden-cookbooks")) @@ -79,7 +79,7 @@ describe Chef::CookbookLoader do @cookbook_loader.should have_key(:openldap) @cookbook_loader.should have_key(:apache2) end - + it "should allow you to override an attribute file via cookbook_path" do @cookbook_loader[:openldap].attribute_filenames.detect { |f| f =~ /cookbooks\/openldap\/attributes\/default.rb/ @@ -88,13 +88,13 @@ describe Chef::CookbookLoader do f =~ /kitchen\/openldap\/attributes\/default.rb/ }.should eql(nil) end - + it "should load different attribute files from deeper paths" do @cookbook_loader[:openldap].attribute_filenames.detect { |f| f =~ /kitchen\/openldap\/attributes\/robinson.rb/ }.should_not eql(nil) end - + it "should allow you to override a definition file via cookbook_path" do @cookbook_loader[:openldap].definition_filenames.detect { |f| f =~ /cookbooks\/openldap\/definitions\/client.rb/ @@ -103,13 +103,13 @@ describe Chef::CookbookLoader do f =~ /kitchen\/openldap\/definitions\/client.rb/ }.should eql(nil) end - + it "should load definition files from deeper paths" do @cookbook_loader[:openldap].definition_filenames.detect { |f| f =~ /kitchen\/openldap\/definitions\/drewbarrymore.rb/ }.should_not eql(nil) end - + it "should allow you to override a recipe file via cookbook_path" do @cookbook_loader[:openldap].recipe_filenames.detect { |f| f =~ /cookbooks\/openldap\/recipes\/gigantor.rb/ @@ -118,19 +118,19 @@ describe Chef::CookbookLoader do f =~ /kitchen\/openldap\/recipes\/gigantor.rb/ }.should eql(nil) end - + it "should load recipe files from deeper paths" do @cookbook_loader[:openldap].recipe_filenames.detect { |f| f =~ /kitchen\/openldap\/recipes\/woot.rb/ }.should_not eql(nil) end - + it "should allow you to have an 'ignore' file, which skips loading files in later cookbooks" do @cookbook_loader[:openldap].recipe_filenames.detect { |f| f =~ /kitchen\/openldap\/recipes\/ignoreme.rb/ }.should eql(nil) end - + it "should find files that start with a ." do @cookbook_loader[:openldap].file_filenames.detect { |f| f =~ /\.dotfile$/ @@ -139,7 +139,7 @@ describe Chef::CookbookLoader do f =~ /\.ssh\/id_rsa$/ }.should =~ /\.ssh\/id_rsa$/ end - + it "should load the metadata for the cookbook" do @cookbook_loader.metadata[:openldap].name.should == :openldap @cookbook_loader.metadata[:openldap].should be_a_kind_of(Chef::Cookbook::Metadata) @@ -202,7 +202,7 @@ describe Chef::CookbookLoader do end seen.should have_key("openldap") seen.should have_key("apache2") - end + end end end # loading only one cookbook end diff --git a/spec/unit/cookbook_manifest_spec.rb b/spec/unit/cookbook_manifest_spec.rb index 7da87e93a5..e87b8e1e9a 100644 --- a/spec/unit/cookbook_manifest_spec.rb +++ b/spec/unit/cookbook_manifest_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -96,7 +96,7 @@ describe "Chef::CookbookVersion manifest" do :checksum => "csum-host-2", :specificity => "host-examplehost.example.org" }, - + { :name => "anotherfile1.rb", :path => "files/ubuntu-9.10/adirectory/anotherfile1.rb.platform-full-version", @@ -122,7 +122,7 @@ describe "Chef::CookbookVersion manifest" do :checksum => "csum-platver-partial-2", :specificity => "nweubuntu-9" }, - + { :name => "anotherfile1.rb", :path => "files/ubuntu/adirectory/anotherfile1.rb.platform", @@ -135,7 +135,7 @@ describe "Chef::CookbookVersion manifest" do :checksum => "csum-plat-2", :specificity => "ubuntu" }, - + { :name => "anotherfile1.rb", :path => "files/default/adirectory/anotherfile1.rb.default", @@ -201,8 +201,8 @@ describe "Chef::CookbookVersion manifest" do } end - - + + it "should return a manifest record based on priority preference: host" do node = Chef::Node.new node.automatic_attrs[:platform] = "ubuntu" @@ -213,7 +213,7 @@ describe "Chef::CookbookVersion manifest" do manifest_record.should_not be_nil manifest_record[:checksum].should == "csum-host" end - + it "should return a manifest record based on priority preference: platform & full version" do node = Chef::Node.new node.automatic_attrs[:platform] = "ubuntu" @@ -235,7 +235,7 @@ describe "Chef::CookbookVersion manifest" do manifest_record.should_not be_nil manifest_record[:checksum].should == "csum-platver-partial" end - + it "should return a manifest record based on priority preference: platform only" do node = Chef::Node.new node.automatic_attrs[:platform] = "ubuntu" @@ -246,7 +246,7 @@ describe "Chef::CookbookVersion manifest" do manifest_record.should_not be_nil manifest_record[:checksum].should == "csum-plat" end - + it "should return a manifest record based on priority preference: default" do node = Chef::Node.new node.automatic_attrs[:platform] = "notubuntu" @@ -301,7 +301,7 @@ describe "Chef::CookbookVersion manifest" do manifest_record.should_not be_nil manifest_record[:checksum].should == "csum4-platver-full" end - + describe "when fetching the contents of a directory by file specificity" do it "should return a directory of manifest records based on priority preference: host" do diff --git a/spec/unit/data_bag_item_spec.rb b/spec/unit/data_bag_item_spec.rb index 6f46c81054..6bc5954fa5 100644 --- a/spec/unit/data_bag_item_spec.rb +++ b/spec/unit/data_bag_item_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -130,7 +130,7 @@ describe Chef::DataBagItem do end describe "to_hash" do - before(:each) do + before(:each) do @data_bag_item.data_bag("still_lost") @data_bag_item.raw_data = { "id" => "whoa", "i_know" => "kung_fu" } @to_hash = @data_bag_item.to_hash @@ -197,7 +197,7 @@ describe Chef::DataBagItem do before do @rest = mock("Chef::REST") Chef::REST.stub!(:new).and_return(@rest) - @data_bag_item['id'] = "heart of darkness" + @data_bag_item['id'] = "heart of darkness" raw_data = {"id" => "heart_of_darkness", "author" => "Conrad"} @data_bag_item.raw_data = raw_data @data_bag_item.data_bag("books") @@ -207,7 +207,7 @@ describe Chef::DataBagItem do @data_bag_item.save end - it "should create if the item is not found" do + it "should create if the item is not found" do exception = mock("404 error", :code => "404") @rest.should_receive(:put_rest).and_raise(Net::HTTPServerException.new("foo", exception)) @rest.should_receive(:post_rest).with("data/books", @data_bag_item) @@ -228,7 +228,7 @@ describe Chef::DataBagItem do end end - + end describe "when loading" do diff --git a/spec/unit/data_bag_spec.rb b/spec/unit/data_bag_spec.rb index 273ef38d9f..d8ad535915 100644 --- a/spec/unit/data_bag_spec.rb +++ b/spec/unit/data_bag_spec.rb @@ -69,7 +69,7 @@ describe Chef::DataBag do end - describe "when saving" do + describe "when saving" do before do @data_bag.name('piggly_wiggly') @rest = mock("Chef::REST") @@ -77,16 +77,16 @@ describe Chef::DataBag do end it "should update the data bag when it already exists" do - @rest.should_receive(:put_rest).with("data/piggly_wiggly", @data_bag) + @rest.should_receive(:put_rest).with("data/piggly_wiggly", @data_bag) @data_bag.save end - it "should create the data bag when it is not found" do + it "should create the data bag when it is not found" do exception = mock("404 error", :code => "404") @rest.should_receive(:put_rest).and_raise(Net::HTTPServerException.new("foo", exception)) @rest.should_receive(:post_rest).with("data", @data_bag) @data_bag.save - end + end describe "when whyrun mode is enabled" do before do diff --git a/spec/unit/digester_spec.rb b/spec/unit/digester_spec.rb index 28e3e918fe..7f0074c670 100644 --- a/spec/unit/digester_spec.rb +++ b/spec/unit/digester_spec.rb @@ -8,9 +8,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,7 +34,7 @@ describe Chef::Digester do it "computes a checksum of a file" do fixture_file = CHEF_SPEC_DATA + "/checksum/random.txt" - expected = "09ee9c8cc70501763563bcf9c218d71b2fbf4186bf8e1e0da07f0f42c80a3394" + expected = "dc6665c18676f5f30fdaa420343960edf1883790f83f51f437dbfa0ff678499d" @cache.checksum_for_file(fixture_file).should == expected end diff --git a/spec/unit/file_cache_spec.rb b/spec/unit/file_cache_spec.rb index 6596326565..7680852cb9 100644 --- a/spec/unit/file_cache_spec.rb +++ b/spec/unit/file_cache_spec.rb @@ -41,7 +41,7 @@ describe Chef::FileCache do end end - + describe "when storing a file" do before do File.stub!(:open).and_yield(@io) diff --git a/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb index e1f8f28bb9..0b20b0ef86 100644 --- a/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +++ b/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -98,7 +98,7 @@ describe Chef::Formatters::ErrorInspectors::CompileErrorInspector do before do Chef::Config.stub!(:cookbook_path).and_return([ "C:/opscode/chef/var/cache/cookbooks" ]) recipe_lines = BAD_RECIPE.split("\n").map {|l| l << "\n" } - IO.should_receive(:readlines).at_least(1).times.with(/:\/opscode\/chef\/var\/cache\/cookbooks\/foo\/recipes\/default.rb/).and_return(recipe_lines) + IO.should_receive(:readlines).at_least(1).times.with(/:\/opscode\/chef\/var\/cache\/cookbooks\/foo\/recipes\/default.rb/).and_return(recipe_lines) @trace = [ "C:/opscode/chef/var/cache/cookbooks/foo/recipes/default.rb:14 in `from_file'", "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:144:in `rescue in block in load_libraries'", @@ -141,7 +141,7 @@ describe Chef::Formatters::ErrorInspectors::CompileErrorInspector do @inspector.add_explanation(@description) @inspector.culprit_file.should == "c:/opscode/chef/var/cache/cookbooks/foo/recipes/default.rb" end - end + end it "finds the line number of the error from the stack trace" do @inspector.culprit_line.should == 14 diff --git a/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb index cf668fbb0d..93129eadb8 100644 --- a/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb +++ b/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb index 6db7aaaa0d..eb8d302e5b 100644 --- a/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb +++ b/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/formatters/error_inspectors/node_load_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/node_load_error_inspector_spec.rb index bd3cc6b764..d2bbffafee 100644 --- a/spec/unit/formatters/error_inspectors/node_load_error_inspector_spec.rb +++ b/spec/unit/formatters/error_inspectors/node_load_error_inspector_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/formatters/error_inspectors/registration_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/registration_error_inspector_spec.rb index 4fcf034d80..4c21dadd82 100644 --- a/spec/unit/formatters/error_inspectors/registration_error_inspector_spec.rb +++ b/spec/unit/formatters/error_inspectors/registration_error_inspector_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb b/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb index b6d48d0255..fdbb601005 100644 --- a/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +++ b/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -129,7 +129,7 @@ describe Chef::Formatters::ErrorInspectors::ResourceFailureInspector do @inspector = Chef::Formatters::ErrorInspectors::ResourceFailureInspector.new(@resource, :create, @exception) @inspector.recipe_snippet.should match(/^# In \/home\/btm/) end - + context "when the recipe file does not exist" do before do File.stub!(:exists?).and_return(false) @@ -141,7 +141,7 @@ describe Chef::Formatters::ErrorInspectors::ResourceFailureInspector do @inspector = Chef::Formatters::ErrorInspectors::ResourceFailureInspector.new(@resource, :create, @exception) @inspector.recipe_snippet.should be_nil end - + it "does not raise an exception trying to load a non-existant file (CHEF-3411)" do @resource.source_line = "/somewhere/in/space" @inspector = Chef::Formatters::ErrorInspectors::ResourceFailureInspector.new(@resource, :create, @exception) diff --git a/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb index 4b6751a120..706ff59c06 100644 --- a/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb +++ b/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/handler_spec.rb b/spec/unit/handler_spec.rb index 9eeba478ac..eab98e76a2 100644 --- a/spec/unit/handler_spec.rb +++ b/spec/unit/handler_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -126,9 +126,9 @@ describe Chef::Handler do @end_time = @start_time + 4.2 Time.stub!(:now).and_return(@start_time, @end_time) @run_status.start_clock - @run_status.stop_clock + @run_status.stop_clock end - + it "has a shortcut for all resources" do @handler.all_resources.should == @all_resources end @@ -158,7 +158,7 @@ describe Chef::Handler do end it "has a shortcut for the success? and failed? predicates" do - @handler.success?.should be_true + @handler.success?.should be_true @handler.failed?.should be_false end diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb index f77268333b..de11a6ef15 100644 --- a/spec/unit/knife/bootstrap_spec.rb +++ b/spec/unit/knife/bootstrap_spec.rb @@ -205,7 +205,7 @@ describe Chef::Knife::Bootstrap do it "configures the ssh port" do @knife_ssh.config[:ssh_port].should == '4001' end - + it "configures the ssh agent forwarding" do @knife_ssh.config[:forward_agent].should == true end @@ -265,7 +265,7 @@ describe Chef::Knife::Bootstrap do it "configures the ssh port" do @knife_ssh.config[:ssh_port].should == '2430' end - + it "configures the ssh agent forwarding" do @knife_ssh.config[:forward_agent].should == true end diff --git a/spec/unit/knife/client_bulk_delete_spec.rb b/spec/unit/knife/client_bulk_delete_spec.rb index 55351554d1..b7864ed098 100644 --- a/spec/unit/knife/client_bulk_delete_spec.rb +++ b/spec/unit/knife/client_bulk_delete_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,31 +37,31 @@ describe Chef::Knife::ClientBulkDelete do end Chef::ApiClient.stub!(:list).and_return(@clients) end - + describe "run" do - + it "should get the list of the clients" do Chef::ApiClient.should_receive(:list).and_return(@clients) @knife.run end - + it "should print the clients you are about to delete" do @knife.run @stdout.string.should match(/#{@knife.ui.list(@clients.keys.sort, :columns_down)}/) end - + it "should confirm you really want to delete them" do @knife.ui.should_receive(:confirm) @knife.run end - + it "should delete each client" do @clients.each_value do |c| c.should_receive(:destroy) end @knife.run end - + it "should only delete clients that match the regex" do @knife.name_args = ["tim"] @clients["tim"].should_receive(:destroy) diff --git a/spec/unit/knife/client_create_spec.rb b/spec/unit/knife/client_create_spec.rb index c049748074..d07b6ceb17 100644 --- a/spec/unit/knife/client_create_spec.rb +++ b/spec/unit/knife/client_create_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/knife/client_delete_spec.rb b/spec/unit/knife/client_delete_spec.rb index 865f19f713..9ebccbae15 100644 --- a/spec/unit/knife/client_delete_spec.rb +++ b/spec/unit/knife/client_delete_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/knife/client_edit_spec.rb b/spec/unit/knife/client_edit_spec.rb index 1308d14fd5..1d7049be30 100644 --- a/spec/unit/knife/client_edit_spec.rb +++ b/spec/unit/knife/client_edit_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/knife/client_list_spec.rb b/spec/unit/knife/client_list_spec.rb index 6237a0d14c..c4834ad8d1 100644 --- a/spec/unit/knife/client_list_spec.rb +++ b/spec/unit/knife/client_list_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/knife/client_reregister_spec.rb b/spec/unit/knife/client_reregister_spec.rb index d9fc8ec180..d84978c497 100644 --- a/spec/unit/knife/client_reregister_spec.rb +++ b/spec/unit/knife/client_reregister_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/knife/client_show_spec.rb b/spec/unit/knife/client_show_spec.rb index 5bac3b4af6..ce5f93ab5f 100644 --- a/spec/unit/knife/client_show_spec.rb +++ b/spec/unit/knife/client_show_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/knife/cookbook_metadata_from_file_spec.rb b/spec/unit/knife/cookbook_metadata_from_file_spec.rb index 60555d89dc..6f406de6b7 100644 --- a/spec/unit/knife/cookbook_metadata_from_file_spec.rb +++ b/spec/unit/knife/cookbook_metadata_from_file_spec.rb @@ -8,9 +8,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/knife/cookbook_show_spec.rb b/spec/unit/knife/cookbook_show_spec.rb index 2f2d841fea..96fe738b0b 100644 --- a/spec/unit/knife/cookbook_show_spec.rb +++ b/spec/unit/knife/cookbook_show_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -171,7 +171,7 @@ describe Chef::Knife::CookbookShow do @response = "Example recipe text" end - + describe "with --fqdn" do it "should pass the fqdn" do @knife.config[:platform] = "example_platform" diff --git a/spec/unit/knife/cookbook_site_install_spec.rb b/spec/unit/knife/cookbook_site_install_spec.rb index 43afe09f5e..f7d7a397e6 100644 --- a/spec/unit/knife/cookbook_site_install_spec.rb +++ b/spec/unit/knife/cookbook_site_install_spec.rb @@ -25,7 +25,7 @@ describe Chef::Knife::CookbookSiteInstall do @knife.config = {} if Chef::Platform.windows? @install_path = 'C:/tmp/chef' - else + else @install_path = '/var/tmp/chef' end @knife.config[:cookbook_path] = [ @install_path ] diff --git a/spec/unit/knife/data_bag_show_spec.rb b/spec/unit/knife/data_bag_show_spec.rb index 08ecfaa0a7..d64b4f286d 100644 --- a/spec/unit/knife/data_bag_show_spec.rb +++ b/spec/unit/knife/data_bag_show_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/knife/environment_from_file_spec.rb b/spec/unit/knife/environment_from_file_spec.rb index d2234d9be1..7d028ae3b8 100644 --- a/spec/unit/knife/environment_from_file_spec.rb +++ b/spec/unit/knife/environment_from_file_spec.rb @@ -49,13 +49,13 @@ describe Chef::Knife::EnvironmentFromFile do @env_apple.name("apple") @knife.loader.stub!(:load_from).with("apple.rb").and_return @env_apple end - + it "loads multiple environments if given" do @knife.name_args = [ "spec.rb", "apple.rb" ] @environment.should_receive(:save).twice @knife.run end - + it "loads all environments with -a" do File.stub!(:expand_path).with("./environments/*.{json,rb}").and_return("/tmp/environments") Dir.stub!(:glob).with("/tmp/environments").and_return(["spec.rb", "apple.rb"]) diff --git a/spec/unit/knife/index_rebuild_spec.rb b/spec/unit/knife/index_rebuild_spec.rb index 414ec95fad..eb4e8020c8 100644 --- a/spec/unit/knife/index_rebuild_spec.rb +++ b/spec/unit/knife/index_rebuild_spec.rb @@ -91,7 +91,7 @@ describe Chef::Knife::IndexRebuild do context "against a Chef 11 server" do let(:api_info) do - {"flavor" => "osc", + {"flavor" => "osc", "version" => "11.0.0", "erchef" => "1.2.3" } diff --git a/spec/unit/knife/node_delete_spec.rb b/spec/unit/knife/node_delete_spec.rb index b1b3db1aa4..bc30ae7e83 100644 --- a/spec/unit/knife/node_delete_spec.rb +++ b/spec/unit/knife/node_delete_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,7 +28,7 @@ describe Chef::Knife::NodeDelete do @knife.name_args = [ "adam" ] @knife.stub!(:output).and_return(true) @knife.stub!(:confirm).and_return(true) - @node = Chef::Node.new() + @node = Chef::Node.new() @node.stub!(:destroy).and_return(true) Chef::Node.stub!(:load).and_return(@node) @stdout = StringIO.new diff --git a/spec/unit/knife/node_edit_spec.rb b/spec/unit/knife/node_edit_spec.rb index 0ba2e90cfe..e8f6937a31 100644 --- a/spec/unit/knife/node_edit_spec.rb +++ b/spec/unit/knife/node_edit_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/knife/node_list_spec.rb b/spec/unit/knife/node_list_spec.rb index 5637d679c8..3482eab87c 100644 --- a/spec/unit/knife/node_list_spec.rb +++ b/spec/unit/knife/node_list_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -49,7 +49,7 @@ describe Chef::Knife::NodeList do Chef::Node.should_receive(:list_by_environment).with("prod").and_return(@list) @knife.run end - + describe "with -w or --with-uri" do it "should pretty print the hash" do @knife.config[:with_uri] = true diff --git a/spec/unit/knife/node_run_list_add_spec.rb b/spec/unit/knife/node_run_list_add_spec.rb index ee0cfc9038..80e372c30a 100644 --- a/spec/unit/knife/node_run_list_add_spec.rb +++ b/spec/unit/knife/node_run_list_add_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,7 +27,7 @@ describe Chef::Knife::NodeRunListAdd do } @knife.name_args = [ "adam", "role[monkey]" ] @knife.stub!(:output).and_return(true) - @node = Chef::Node.new() + @node = Chef::Node.new() @node.stub!(:save).and_return(true) Chef::Node.stub!(:load).and_return(@node) end diff --git a/spec/unit/knife/node_show_spec.rb b/spec/unit/knife/node_show_spec.rb index 6600b2aa96..eb3593fea1 100644 --- a/spec/unit/knife/node_show_spec.rb +++ b/spec/unit/knife/node_show_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,7 +29,7 @@ describe Chef::Knife::NodeShow do } @knife.name_args = [ "adam" ] @knife.stub!(:output).and_return(true) - @node = Chef::Node.new() + @node = Chef::Node.new() Chef::Node.stub!(:load).and_return(@node) end diff --git a/spec/unit/knife/role_create_spec.rb b/spec/unit/knife/role_create_spec.rb index af3a6bf539..39fed8fb68 100644 --- a/spec/unit/knife/role_create_spec.rb +++ b/spec/unit/knife/role_create_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,7 +27,7 @@ describe Chef::Knife::RoleCreate do } @knife.name_args = [ "adam" ] @knife.stub!(:output).and_return(true) - @role = Chef::Role.new() + @role = Chef::Role.new() @role.stub!(:save) Chef::Role.stub!(:new).and_return(@role) @knife.stub!(:edit_data).and_return(@role) diff --git a/spec/unit/knife/role_delete_spec.rb b/spec/unit/knife/role_delete_spec.rb index d2d8b889b3..37b16de7df 100644 --- a/spec/unit/knife/role_delete_spec.rb +++ b/spec/unit/knife/role_delete_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,7 +28,7 @@ describe Chef::Knife::RoleDelete do @knife.name_args = [ "adam" ] @knife.stub!(:output).and_return(true) @knife.stub!(:confirm).and_return(true) - @role = Chef::Role.new() + @role = Chef::Role.new() @role.stub!(:destroy).and_return(true) Chef::Role.stub!(:load).and_return(@role) @stdout = StringIO.new diff --git a/spec/unit/knife/role_list_spec.rb b/spec/unit/knife/role_list_spec.rb index 1a5e8e2a72..d0cd3b4413 100644 --- a/spec/unit/knife/role_list_spec.rb +++ b/spec/unit/knife/role_list_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/log_spec.rb b/spec/unit/log_spec.rb index b91ee020bb..7be40f77e6 100644 --- a/spec/unit/log_spec.rb +++ b/spec/unit/log_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/mash_spec.rb b/spec/unit/mash_spec.rb index b9a7cd0932..7358781e60 100644 --- a/spec/unit/mash_spec.rb +++ b/spec/unit/mash_spec.rb @@ -35,7 +35,7 @@ describe Mash do @copy = @orig.dup @copy.to_hash.should == Mash.new(data).to_hash @copy[:z] << 4 - @orig[:z].should == [1,2,3] + @orig[:z].should == [1,2,3] end it "should duplicate a nested mash to a new mash" do @@ -44,7 +44,7 @@ describe Mash do @copy = @orig.dup @copy.to_hash.should == Mash.new(data).to_hash @copy[:z][:a] << 4 - @orig[:z][:a].should == [1,2,3] + @orig[:z][:a].should == [1,2,3] end # add more! diff --git a/spec/unit/mixin/checksum_spec.rb b/spec/unit/mixin/checksum_spec.rb index 19af1c7d2b..cb31df828d 100644 --- a/spec/unit/mixin/checksum_spec.rb +++ b/spec/unit/mixin/checksum_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,7 @@ require 'spec_helper' require 'chef/mixin/checksum' require 'stringio' -class Chef::CMCCheck +class Chef::CMCCheck include Chef::Mixin::Checksum end @@ -34,7 +34,7 @@ describe Chef::Mixin::Checksum do end it "gets the checksum of a file" do - @checksum_user.checksum(@file).should == "09ee9c8cc70501763563bcf9c218d71b2fbf4186bf8e1e0da07f0f42c80a3394" + @checksum_user.checksum(@file).should == "dc6665c18676f5f30fdaa420343960edf1883790f83f51f437dbfa0ff678499d" end end diff --git a/spec/unit/mixin/convert_to_class_name_spec.rb b/spec/unit/mixin/convert_to_class_name_spec.rb index b78d3f9101..240decc6da 100644 --- a/spec/unit/mixin/convert_to_class_name_spec.rb +++ b/spec/unit/mixin/convert_to_class_name_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,23 +23,23 @@ class ConvertToClassTestHarness end describe Chef::Mixin::ConvertToClassName do - + before do @convert = ConvertToClassTestHarness.new end - + it "converts a_snake_case_word to a CamelCaseWord" do @convert.convert_to_class_name("now_camelized").should == "NowCamelized" end - + it "converts a CamelCaseWord to a snake_case_word" do @convert.convert_to_snake_case("NowImASnake").should == "now_im_a_snake" end - + it "removes the base classes before snake casing" do @convert.convert_to_snake_case("NameSpaced::Class::ThisIsWin", "NameSpaced::Class").should == "this_is_win" end - + it "removes the base classes without explicitly naming them and returns snake case" do @convert.snake_case_basename("NameSpaced::Class::ExtraWin").should == "extra_win" end diff --git a/spec/unit/mixin/deprecation_spec.rb b/spec/unit/mixin/deprecation_spec.rb index c3170007de..3ebf06e830 100644 --- a/spec/unit/mixin/deprecation_spec.rb +++ b/spec/unit/mixin/deprecation_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/mixin/params_validate_spec.rb b/spec/unit/mixin/params_validate_spec.rb index aa37362dc3..2947ebea4a 100644 --- a/spec/unit/mixin/params_validate_spec.rb +++ b/spec/unit/mixin/params_validate_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,7 @@ require 'spec_helper' class TinyClass include Chef::Mixin::ParamsValidate - + def music(is_good=true) is_good end @@ -30,136 +30,136 @@ describe Chef::Mixin::ParamsValidate do before(:each) do @vo = TinyClass.new() end - + it "should allow a hash and a hash as arguments to validate" do lambda { @vo.validate({:one => "two"}, {}) }.should_not raise_error(ArgumentError) end - + it "should raise an argument error if validate is called incorrectly" do lambda { @vo.validate("one", "two") }.should raise_error(ArgumentError) end - + it "should require validation map keys to be symbols or strings" do lambda { @vo.validate({:one => "two"}, { :one => true }) }.should_not raise_error(ArgumentError) lambda { @vo.validate({:one => "two"}, { "one" => true }) }.should_not raise_error(ArgumentError) lambda { @vo.validate({:one => "two"}, { Hash.new => true }) }.should raise_error(ArgumentError) end - + it "should allow options to be required with true" do lambda { @vo.validate({:one => "two"}, { :one => true }) }.should_not raise_error(ArgumentError) end - + it "should allow options to be optional with false" do lambda { @vo.validate({}, {:one => false})}.should_not raise_error(ArgumentError) - end - + end + it "should allow you to check what kind_of? thing an argument is with kind_of" do - lambda { + lambda { @vo.validate( - {:one => "string"}, + {:one => "string"}, { :one => { :kind_of => String } } - ) + ) }.should_not raise_error(ArgumentError) - - lambda { + + lambda { @vo.validate( - {:one => "string"}, + {:one => "string"}, { :one => { :kind_of => Array } } - ) + ) }.should raise_error(ArgumentError) end - + it "should allow you to specify an argument is required with required" do - lambda { + lambda { @vo.validate( - {:one => "string"}, + {:one => "string"}, { :one => { :required => true } } - ) + ) }.should_not raise_error(ArgumentError) - - lambda { + + lambda { @vo.validate( - {:two => "string"}, + {:two => "string"}, { :one => { :required => true } } - ) + ) }.should raise_error(ArgumentError) - - lambda { + + lambda { @vo.validate( - {:two => "string"}, + {:two => "string"}, { :one => { :required => false } } - ) + ) }.should_not raise_error(ArgumentError) end - + it "should allow you to specify whether an object has a method with respond_to" do - lambda { + lambda { @vo.validate( - {:one => @vo}, + {:one => @vo}, { :one => { :respond_to => "validate" } } - ) + ) }.should_not raise_error(ArgumentError) - - lambda { + + lambda { @vo.validate( - {:one => @vo}, + {:one => @vo}, { :one => { :respond_to => "monkey" } } - ) + ) }.should raise_error(ArgumentError) end - + it "should allow you to specify whether an object has all the given methods with respond_to and an array" do - lambda { + lambda { @vo.validate( - {:one => @vo}, + {:one => @vo}, { :one => { :respond_to => ["validate", "music"] } } - ) + ) }.should_not raise_error(ArgumentError) - - lambda { + + lambda { @vo.validate( - {:one => @vo}, + {:one => @vo}, { :one => { :respond_to => ["monkey", "validate"] } } - ) + ) }.should raise_error(ArgumentError) end - + it "should let you set a default value with default => value" do arguments = Hash.new @vo.validate(arguments, { @@ -169,9 +169,9 @@ describe Chef::Mixin::ParamsValidate do }) arguments[:one].should == "is the loneliest number" end - + it "should let you check regular expressions" do - lambda { + lambda { @vo.validate( { :one => "is good" }, { @@ -181,8 +181,8 @@ describe Chef::Mixin::ParamsValidate do } ) }.should_not raise_error(ArgumentError) - - lambda { + + lambda { @vo.validate( { :one => "is good" }, { @@ -193,9 +193,9 @@ describe Chef::Mixin::ParamsValidate do ) }.should raise_error(ArgumentError) end - + it "should let you specify your own callbacks" do - lambda { + lambda { @vo.validate( { :one => "is good" }, { @@ -208,9 +208,9 @@ describe Chef::Mixin::ParamsValidate do } } ) - }.should_not raise_error(ArgumentError) - - lambda { + }.should_not raise_error(ArgumentError) + + lambda { @vo.validate( { :one => "is bad" }, { @@ -223,12 +223,12 @@ describe Chef::Mixin::ParamsValidate do } } ) - }.should raise_error(ArgumentError) + }.should raise_error(ArgumentError) end - + it "should let you combine checks" do args = { :one => "is good", :two => "is bad" } - lambda { + lambda { @vo.validate( args, { @@ -276,7 +276,7 @@ describe Chef::Mixin::ParamsValidate do ) }.should raise_error(ArgumentError) end - + it "should raise an ArgumentError if the validation map has an unknown check" do lambda { @vo.validate( { :one => "two" }, @@ -288,43 +288,43 @@ describe Chef::Mixin::ParamsValidate do ) }.should raise_error(ArgumentError) end - + it "should accept keys that are strings in the options" do lambda { - @vo.validate({ "one" => "two" }, { :one => { :regex => /^two$/ }}) + @vo.validate({ "one" => "two" }, { :one => { :regex => /^two$/ }}) }.should_not raise_error(ArgumentError) end - + it "should allow an array to kind_of" do - lambda { + lambda { @vo.validate( - {:one => "string"}, + {:one => "string"}, { :one => { :kind_of => [ String, Array ] } } - ) + ) }.should_not raise_error(ArgumentError) - lambda { + lambda { @vo.validate( - {:one => ["string"]}, + {:one => ["string"]}, { :one => { :kind_of => [ String, Array ] } } - ) + ) }.should_not raise_error(ArgumentError) - lambda { + lambda { @vo.validate( - {:one => Hash.new}, + {:one => Hash.new}, { :one => { :kind_of => [ String, Array ] } } - ) + ) }.should raise_error(ArgumentError) end @@ -403,5 +403,5 @@ describe Chef::Mixin::ParamsValidate do @vo.set_or_return(:test, nil, {}).object_id.should == value.object_id @vo.set_or_return(:test, nil, {}).should be_a(Proc) end - + end diff --git a/spec/unit/mixin/windows_architecture_helper_spec.rb b/spec/unit/mixin/windows_architecture_helper_spec.rb index c7813a5efc..f59602d716 100644 --- a/spec/unit/mixin/windows_architecture_helper_spec.rb +++ b/spec/unit/mixin/windows_architecture_helper_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,7 +32,7 @@ describe Chef::Mixin::WindowsArchitectureHelper do @node_i386 = Chef::Node.new @node_x86_64 = Chef::Node.new end - + it "returns true when valid architectures are passed to valid_windows_architecture?" do @valid_architectures.each do | architecture | valid_windows_architecture?(architecture).should == true @@ -67,7 +67,7 @@ describe Chef::Mixin::WindowsArchitectureHelper do it "returns false for each unsupported desired architecture for all nodes with each valid architecture passed to node_supports_windows_architecture?" do enumerate_architecture_node_combinations(true) end - + def enumerate_architecture_node_combinations(only_valid_combinations) @valid_architectures.each do | node_architecture | new_node = Chef::Node.new @@ -76,7 +76,7 @@ describe Chef::Mixin::WindowsArchitectureHelper do @valid_architectures.each do | supported_architecture | node_supports_windows_architecture?(new_node, supported_architecture).should == true if only_valid_combinations && (supported_architecture != :x86_64 && node_architecture != :i386 ) - node_supports_windows_architecture?(new_node, supported_architecture).should == false if ! only_valid_combinations && (supported_architecture == :x86_64 && node_architecture == :i386 ) + node_supports_windows_architecture?(new_node, supported_architecture).should == false if ! only_valid_combinations && (supported_architecture == :x86_64 && node_architecture == :i386 ) end end end diff --git a/spec/unit/mixin/xml_escape_spec.rb b/spec/unit/mixin/xml_escape_spec.rb index d05854ade4..83debb5907 100644 --- a/spec/unit/mixin/xml_escape_spec.rb +++ b/spec/unit/mixin/xml_escape_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb index 5aa563aedf..70905d334b 100644 --- a/spec/unit/node/attribute_spec.rb +++ b/spec/unit/node/attribute_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,9 +20,9 @@ require 'spec_helper' require 'chef/node/attribute' -describe Chef::Node::Attribute do +describe Chef::Node::Attribute do before(:each) do - @attribute_hash = + @attribute_hash = {"dmi"=>{}, "command"=>{"ps"=>"ps -ef"}, "platform_version"=>"10.5.7", @@ -193,7 +193,7 @@ describe Chef::Node::Attribute do @default_hash = { "domain" => "opscode.com", "hot" => { "day" => "saturday" }, - "music" => { + "music" => { "jimmy_eat_world" => "is fun!", "mastodon" => "rocks", "mars_volta" => "is loud and nutty", @@ -225,7 +225,7 @@ describe Chef::Node::Attribute do [ :normal, :default, :override, :automatic ].each do |accessor| it "should set #{accessor}" do na = Chef::Node::Attribute.new({ :normal => true }, { :default => true }, { :override => true }, { :automatic => true }) - na.send(accessor).should == { accessor.to_s => true } + na.send(accessor).should == { accessor.to_s => true } end end @@ -520,7 +520,7 @@ describe Chef::Node::Attribute do [:include?, :key?, :member?].each do |method| it "should alias the method #{method} to itself" do - @attributes.should respond_to(method) + @attributes.should respond_to(method) end it "#{method} should behave like has_key?" do @@ -582,7 +582,7 @@ describe Chef::Node::Attribute do collect.include?("snakes").should == true collect.include?("snack").should == true collect.include?("place").should == true - collect.length.should == 5 + collect.length.should == 5 end it "should yield lower if we go deeper" do @@ -593,7 +593,7 @@ describe Chef::Node::Attribute do collect.include?("two").should == true collect.include?("four").should == true collect.include?("six").should == true - collect.length.should == 3 + collect.length.should == 3 end it "should not raise an exception if one of the hashes has a nil value on a deep lookup" do @@ -667,7 +667,7 @@ describe Chef::Node::Attribute do @attributes.each_key do |k| collect << k end - + collect.should include("one") collect.should include("snack") collect.should include("hut") @@ -710,7 +710,7 @@ describe Chef::Node::Attribute do collect["snack"].should == "cookies" end end - + describe "each_value" do before do @attributes = Chef::Node::Attribute.new( diff --git a/spec/unit/node/immutable_collections_spec.rb b/spec/unit/node/immutable_collections_spec.rb index db4a79f21b..0c2b878cd2 100644 --- a/spec/unit/node/immutable_collections_spec.rb +++ b/spec/unit/node/immutable_collections_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/platform_spec.rb b/spec/unit/platform_spec.rb index 03357830cc..3904435ea0 100644 --- a/spec/unit/platform_spec.rb +++ b/spec/unit/platform_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,7 +32,7 @@ describe "Chef::Platform supports" do :redhat, :oracle, :gentoo, - :arch, + :arch, :solaris, :mswin, :mingw32, @@ -50,11 +50,11 @@ describe Chef::Platform do before :all do @original_platform_map = Chef::Platform.platforms end - + after :all do || Chef::Platform.platforms = @original_platform_map end - + before(:each) do Chef::Platform.platforms = { :darwin => { @@ -80,13 +80,13 @@ describe Chef::Platform do } @events = Chef::EventDispatch::Dispatcher.new end - + it "should allow you to look up a platform by name and version, returning the provider map for it" do pmap = Chef::Platform.find("Darwin", "9.2.2") pmap.should be_a_kind_of(Hash) pmap[:file].should eql("darwinian") end - + it "should allow you to look up a platform by name and version using \"greater than\" style operators" do pmap = Chef::Platform.find("Darwin", "11.1.0") pmap.should be_a_kind_of(Hash) @@ -98,46 +98,46 @@ describe Chef::Platform do pmap.should be_a_kind_of(Hash) pmap[:file].should eql("old school") end - + it "should use the default providers if the os doesn't give me a default, but does exist" do pmap = Chef::Platform.find("mars_volta", "1") pmap.should be_a_kind_of(Hash) pmap[:file].should eql(Chef::Provider::File) end - + it "should use the default provider if the os does not exist" do pmap = Chef::Platform.find("AIX", "1") pmap.should be_a_kind_of(Hash) pmap[:file].should eql(Chef::Provider::File) end - + it "should merge the defaults for an os with the specific version" do pmap = Chef::Platform.find("Darwin", "9.2.2") pmap[:file].should eql("darwinian") pmap[:snicker].should eql("snack") end - + it "should merge the defaults for an os with the universal defaults" do pmap = Chef::Platform.find("Darwin", "9.2.2") pmap[:file].should eql("darwinian") pmap[:pax].should eql("brittania") end - + it "should allow you to look up a provider for a platform directly by symbol" do Chef::Platform.find_provider("Darwin", "9.2.2", :file).should eql("darwinian") end - + it "should raise an exception if a provider cannot be found for a resource type" do lambda { Chef::Platform.find_provider("Darwin", "9.2.2", :coffee) }.should raise_error(ArgumentError) end - + it "should look up a provider for a resource with a Chef::Resource object" do kitty = Chef::Resource::Cat.new("loulou") Chef::Platform.find_provider("Darwin", "9.2.2", kitty).should eql("nice") end - + it "should look up a provider with a node and a Chef::Resource object" do - kitty = Chef::Resource::Cat.new("loulou") + kitty = Chef::Resource::Cat.new("loulou") node = Chef::Node.new node.name("Intel") node.automatic_attrs[:platform] = "mac_os_x" @@ -150,7 +150,7 @@ describe Chef::Platform do end it "should prefer an explicit provider" do - kitty = Chef::Resource::Cat.new("loulou") + kitty = Chef::Resource::Cat.new("loulou") kitty.stub!(:provider).and_return(Chef::Provider::File) node = Chef::Node.new node.name("Intel") @@ -169,7 +169,7 @@ describe Chef::Platform do node.automatic_attrs[:platform_version] = "8.5" Chef::Platform.find_provider_for_node(node, kitty).should eql(Chef::Provider::Cat) end - + def setup_file_resource node = Chef::Node.new node.automatic_attrs[:platform] = "mac_os_x" @@ -185,7 +185,7 @@ describe Chef::Platform do provider.new_resource.should equal(file) provider.run_context.should equal(run_context) end - + it "returns a provider object given a Chef::Resource object which has a valid run context without an action" do file, run_context = setup_file_resource provider = Chef::Platform.provider_for_resource(file) @@ -193,7 +193,7 @@ describe Chef::Platform do provider.new_resource.should equal(file) provider.run_context.should equal(run_context) end - + it "raises an error when trying to find the provider for a resource with no run context" do file = Chef::Resource::File.new("whateva") lambda {Chef::Platform.provider_for_resource(file)}.should raise_error(ArgumentError) @@ -203,44 +203,44 @@ describe Chef::Platform do lambda {Chef::Platform.provider_for_node('node', 'resource')}.should raise_error(NotImplementedError) end - it "should update the provider map with map" do + it "should update the provider map with map" do Chef::Platform.set( :platform => :darwin, :version => "9.2.2", - :resource => :file, + :resource => :file, :provider => "masterful" ) Chef::Platform.platforms[:darwin]["9.2.2"][:file].should eql("masterful") Chef::Platform.set( :platform => :darwin, :resource => :file, - :provider => "masterful" + :provider => "masterful" ) Chef::Platform.platforms[:darwin][:default][:file].should eql("masterful") Chef::Platform.set( - :resource => :file, + :resource => :file, :provider => "masterful" - ) + ) Chef::Platform.platforms[:default][:file].should eql("masterful") - + Chef::Platform.set( :platform => :hero, :version => "9.2.2", - :resource => :file, + :resource => :file, :provider => "masterful" ) Chef::Platform.platforms[:hero]["9.2.2"][:file].should eql("masterful") - + Chef::Platform.set( - :resource => :file, + :resource => :file, :provider => "masterful" ) Chef::Platform.platforms[:default][:file].should eql("masterful") - + Chef::Platform.platforms = {} - + Chef::Platform.set( - :resource => :file, + :resource => :file, :provider => "masterful" ) Chef::Platform.platforms[:default][:file].should eql("masterful") @@ -248,8 +248,8 @@ describe Chef::Platform do Chef::Platform.platforms = { :neurosis => {} } Chef::Platform.set(:platform => :neurosis, :resource => :package, :provider => "masterful") Chef::Platform.platforms[:neurosis][:default][:package].should eql("masterful") - + end - - + + end diff --git a/spec/unit/provider/cron_spec.rb b/spec/unit/provider/cron_spec.rb index f0d800741d..8a819b699c 100644 --- a/spec/unit/provider/cron_spec.rb +++ b/spec/unit/provider/cron_spec.rb @@ -181,7 +181,7 @@ CRONTAB before :each do @provider.stub!(:read_crontab).and_return(<<-CRONTAB) 0 2 * * * /some/other/command - + # Chef Name: cronhole some stuff * 5 * Jan Mon /bin/true param1 param2 # Chef Name: something else @@ -196,7 +196,7 @@ CRONTAB @provider.cron_exists.should == true @provider.cron_empty.should == false end - + it "should pull the details out of the cron line" do cron = @provider.load_current_resource cron.minute.should == '*' @@ -581,7 +581,7 @@ CRONTAB end it "should log nothing changed" do - Chef::Log.should_receive(:debug).with("Found cron '#{@new_resource.name}'") + Chef::Log.should_receive(:debug).with("Found cron '#{@new_resource.name}'") Chef::Log.should_receive(:debug).with("Skipping existing cron entry '#{@new_resource.name}'") @provider.run_action(:create) end diff --git a/spec/unit/provider/deploy/timestamped_spec.rb b/spec/unit/provider/deploy/timestamped_spec.rb index b891a03ce2..a9cea1142e 100644 --- a/spec/unit/provider/deploy/timestamped_spec.rb +++ b/spec/unit/provider/deploy/timestamped_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,7 +19,7 @@ require 'spec_helper' describe Chef::Provider::Deploy::Timestamped do - + before do @release_time = Time.utc( 2004, 8, 15, 16, 23, 42) Time.stub!(:now).and_return(@release_time) @@ -32,9 +32,9 @@ describe Chef::Provider::Deploy::Timestamped do @runner = mock("runnah") Chef::Runner.stub!(:new).and_return(@runner) end - + it "gives a timestamp for release_slug" do @timestamped_deploy.send(:release_slug).should == "20040815162342" end - + end diff --git a/spec/unit/provider/deploy_spec.rb b/spec/unit/provider/deploy_spec.rb index 0d837f99c3..1a9fee8831 100644 --- a/spec/unit/provider/deploy_spec.rb +++ b/spec/unit/provider/deploy_spec.rb @@ -163,18 +163,18 @@ describe Chef::Provider::Deploy do @provider.stub!(:deploy).and_return{ raise "Unexpected error" } @provider.stub!(:previous_release_path).and_return('previous_release') @provider.should_not_receive(:rollback) - lambda { + lambda { @provider.run_action(:deploy) }.should raise_exception(RuntimeError, "Unexpected error") end - + it "rollbacks to previous release if error happens on deploy" do @resource.rollback_on_error true @provider.stub!(:all_releases).and_return(['previous_release']) @provider.stub!(:deploy).and_return{ raise "Unexpected error" } @provider.stub!(:previous_release_path).and_return('previous_release') @provider.should_receive(:rollback) - lambda { + lambda { @provider.run_action(:deploy) }.should raise_exception(RuntimeError, "Unexpected error") end @@ -225,15 +225,15 @@ describe Chef::Provider::Deploy do #FileUtils.should_receive(:rm_rf).with("/my/deploy/dir/releases/20040815162342") #@provider.run_action(:rollback) #@provider.release_path.should eql(NIL) -- no check needed since assertions will fail - lambda { + lambda { @provider.run_action(:rollback) }.should raise_exception(RuntimeError, "There is no release to rollback to!") end - + it "an exception is raised when there are no releases" do all_releases = [] Dir.stub!(:glob).with("/my/deploy/dir/releases/*").and_return(all_releases) - lambda { + lambda { @provider.run_action(:rollback) }.should raise_exception(RuntimeError, "There is no release to rollback to!") end @@ -433,7 +433,7 @@ describe Chef::Provider::Deploy do @provider.should_receive(:enforce_ownership) @provider.link_tempfiles_to_current_release end - + end it "does nothing for restart if restart_command is empty" do diff --git a/spec/unit/provider/execute_spec.rb b/spec/unit/provider/execute_spec.rb index bf913cca12..0d108f521d 100644 --- a/spec/unit/provider/execute_spec.rb +++ b/spec/unit/provider/execute_spec.rb @@ -31,7 +31,7 @@ describe Chef::Provider::Execute do @provider = Chef::Provider::Execute.new(@new_resource, @run_context) @current_resource = Chef::Resource::Ifconfig.new("foo_resource", @run_context) @provider.current_resource = @current_resource - Chef::Log.level = :info + Chef::Log.level = :info # FIXME: There should be a test for how STDOUT.tty? changes the live_stream option being passed STDOUT.stub!(:tty?).and_return(true) end @@ -73,7 +73,7 @@ describe Chef::Provider::Execute do @provider.run_action(:run) @new_resource.should_not be_updated - end + end it "should warn if user specified relative path without cwd" do @new_resource.creates "foo_resource" diff --git a/spec/unit/provider/group/dscl_spec.rb b/spec/unit/provider/group/dscl_spec.rb index b526848dfd..28d78cbdbd 100644 --- a/spec/unit/provider/group/dscl_spec.rb +++ b/spec/unit/provider/group/dscl_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,14 +27,14 @@ describe Chef::Provider::Group::Dscl do @current_resource = Chef::Resource::Group.new("aj") @provider = Chef::Provider::Group::Dscl.new(@new_resource, @run_context) @provider.current_resource = @current_resource - @status = mock("Process::Status", :exitstatus => 0) + @status = mock("Process::Status", :exitstatus => 0) @pid = 2342 @stdin = StringIO.new @stdout = StringIO.new("\n") @stderr = StringIO.new("") @provider.stub!(:popen4).and_yield(@pid,@stdin,@stdout,@stderr).and_return(@status) end - + it "should run popen4 with the supplied array of arguments appended to the dscl command" do @provider.should_receive(:popen4).with("dscl . -cmd /Path arg1 arg2") @provider.dscl("cmd", "/Path", "arg1", "arg2") @@ -52,7 +52,7 @@ describe Chef::Provider::Group::Dscl do @provider = Chef::Provider::Group::Dscl.new(@node, @new_resource) @provider.stub!(:dscl).and_return(["cmd", @status, "stdout", "stderr"]) end - + it "should run dscl with the supplied cmd /Path args" do @provider.should_receive(:dscl).with("cmd /Path args") @provider.safe_dscl("cmd /Path args") @@ -84,7 +84,7 @@ describe Chef::Provider::Group::Dscl do lambda { @provider.safe_dscl("cmd /Path arguments") }.should raise_error(Chef::Exceptions::Group) end end - + describe "with the dscl command returning a zero exit status" do it "should return the third array element, the string of standard output" do safe_dscl_retval = @provider.safe_dscl("cmd /Path args") @@ -100,7 +100,7 @@ describe Chef::Provider::Group::Dscl do @provider = Chef::Provider::Group::Dscl.new(@node, @new_resource) @provider.stub!(:safe_dscl).and_return("\naj 200\njt 201\n") end - + it "should run safe_dscl with list /Groups gid" do @provider.should_receive(:safe_dscl).with("list /Groups gid") @provider.get_free_gid @@ -109,7 +109,7 @@ describe Chef::Provider::Group::Dscl do it "should return the first unused gid number on or above 200" do @provider.get_free_gid.should equal(202) end - + it "should raise an exception when the search limit is exhausted" do search_limit = 1 lambda { @provider.get_free_gid(search_limit) }.should raise_error(RuntimeError) @@ -127,7 +127,7 @@ describe Chef::Provider::Group::Dscl do @provider.should_receive(:safe_dscl).with("list /Groups gid") @provider.gid_used?(500) end - + it "should return true for a used gid number" do @provider.gid_used?(500).should be_true end @@ -151,7 +151,7 @@ describe Chef::Provider::Group::Dscl do lambda { @provider.set_gid }.should raise_error(Chef::Exceptions::Group) end end - + describe "with no gid number for the new resources" do it "should run get_free_gid and return a valid, unused gid number" do @provider.should_receive(:get_free_gid).and_return(501) @@ -220,7 +220,7 @@ describe Chef::Provider::Group::Dscl do @provider.set_members end end - + describe "with no members in the new resource" do before do @new_resource.append(true) @@ -276,7 +276,7 @@ describe Chef::Provider::Group::Dscl do @provider.should_receive(:set_gid) @provider.manage_group end - + it "should manage the members if it changed and the new resources members is not null" do @current_resource.members(%{charlie root}) @new_resource.members(%{crab revenge}) diff --git a/spec/unit/provider/group/gpasswd_spec.rb b/spec/unit/provider/group/gpasswd_spec.rb index 59da88e851..8889ba322e 100644 --- a/spec/unit/provider/group/gpasswd_spec.rb +++ b/spec/unit/provider/group/gpasswd_spec.rb @@ -36,8 +36,8 @@ describe Chef::Provider::Group::Gpasswd, "modify_group_members" do @provider.define_resource_requirements end - # Checking for required binaries is already done in the spec - # for Chef::Provider::Group - no need to repeat it here. We'll + # Checking for required binaries is already done in the spec + # for Chef::Provider::Group - no need to repeat it here. We'll # include only what's specific to this provider. it "should raise an error if the required binary /usr/bin/gpasswd doesn't exist" do File.stub!(:exists?).and_return(true) diff --git a/spec/unit/provider/group/groupmod_spec.rb b/spec/unit/provider/group/groupmod_spec.rb index c9c56313b5..69b96c6edb 100644 --- a/spec/unit/provider/group/groupmod_spec.rb +++ b/spec/unit/provider/group/groupmod_spec.rb @@ -29,7 +29,7 @@ describe Chef::Provider::Group::Groupmod do @new_resource.append false @provider = Chef::Provider::Group::Groupmod.new(@new_resource, @run_context) end - + describe "manage_group" do describe "when determining the current group state" do it "should raise an error if the required binary /usr/sbin/group doesn't exist" do @@ -41,25 +41,25 @@ describe Chef::Provider::Group::Groupmod do File.should_receive(:exists?).with("/usr/sbin/user").and_return(false) lambda { @provider.load_current_resource }.should raise_error(Chef::Exceptions::Group) end - + it "shouldn't raise an error if the required binaries exist" do File.stub!(:exists?).and_return(true) lambda { @provider.load_current_resource }.should_not raise_error(Chef::Exceptions::Group) end end - + describe "after the group's current state is known" do before do @current_resource = @new_resource.dup @provider.current_resource = @current_resource end - + describe "when no group members are specified and append is not set" do before do @new_resource.append(false) @new_resource.members([]) end - + it "logs a message and sets group's members to 'none', then removes existing group members" do Chef::Log.should_receive(:debug).with("group[wheel] setting group members to: none") Chef::Log.should_receive(:debug).with("group[wheel] removing members lobster, rage, fist") @@ -69,26 +69,26 @@ describe Chef::Provider::Group::Groupmod do @provider.manage_group end end - + describe "when no group members are specified and append is set" do before do @new_resource.append(true) @new_resource.members([]) end - + it "logs a message and does not modify group membership" do Chef::Log.should_receive(:debug).with("group[wheel] not changing group members, the group has no members to add") @provider.should_not_receive(:shell_out!) @provider.manage_group end end - + describe "when removing some group members" do before do @new_resource.append(false) @new_resource.members(%w{ lobster }) end - + it "updates group membership correctly" do Chef::Log.stub!(:debug) @provider.should_receive(:shell_out!).with("group mod -n wheel_bak wheel") @@ -100,14 +100,14 @@ describe Chef::Provider::Group::Groupmod do end end end - + describe "create_group" do describe "when creating a new group" do before do @current_resource = Chef::Resource::Group.new("wheel") @provider.current_resource = @current_resource end - + it "should run a group add command and some user mod commands" do @provider.should_receive(:shell_out!).with("group add -g '123' wheel") @provider.should_receive(:shell_out!).with("user mod -G wheel lobster") @@ -117,14 +117,14 @@ describe Chef::Provider::Group::Groupmod do end end end - + describe "remove_group" do describe "when removing an existing group" do before do @current_resource = @new_resource.dup @provider.current_resource = @current_resource end - + it "should run a group del command" do @provider.should_receive(:shell_out!).with("group del wheel") @provider.remove_group diff --git a/spec/unit/provider/group/pw_spec.rb b/spec/unit/provider/group/pw_spec.rb index a7dbdb8615..e7c38f9555 100644 --- a/spec/unit/provider/group/pw_spec.rb +++ b/spec/unit/provider/group/pw_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,7 +23,7 @@ describe Chef::Provider::Group::Pw do @node = Chef::Node.new @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - + @new_resource = Chef::Resource::Group.new("wheel") @new_resource.gid 50 @new_resource.members [ "root", "aj"] @@ -34,12 +34,12 @@ describe Chef::Provider::Group::Pw do @provider = Chef::Provider::Group::Pw.new(@new_resource, @run_context) @provider.current_resource = @current_resource end - + describe "when setting options for the pw command" do it "does not set the gid option if gids match or are unmanaged" do @provider.set_options.should == " wheel" end - + it "sets the option for gid if it is not nil" do @new_resource.gid(42) @provider.set_options.should eql(" wheel -g '42'") @@ -55,7 +55,7 @@ describe Chef::Provider::Group::Pw do end describe "when managing the group" do - + it "should run pw groupmod with the return of set_options" do @new_resource.gid(42) @provider.should_receive(:run_command).with({ :command => "pw groupmod wheel -g '42' -M root,aj" }).and_return(true) @@ -72,18 +72,18 @@ describe Chef::Provider::Group::Pw do end describe "when setting group membership" do - + describe "with an empty members array in both the new and current resource" do before do @new_resource.stub!(:members).and_return([]) @current_resource.stub!(:members).and_return([]) end - + it "should log an appropriate message" do Chef::Log.should_receive(:debug).with("group[wheel] not changing group members, the group has no members") @provider.set_members_option end - + it "should set no options" do @provider.set_members_option.should eql("") end @@ -94,28 +94,28 @@ describe Chef::Provider::Group::Pw do @new_resource.stub!(:members).and_return([]) @current_resource.stub!(:members).and_return(["all", "your", "base"]) end - + it "should log an appropriate message" do Chef::Log.should_receive(:debug).with("group[wheel] removing group members all, your, base") @provider.set_members_option end - + it "should set the -d option with the members joined by ','" do @provider.set_members_option.should eql(" -d all,your,base") end end - + describe "with supplied members array in the new resource and an empty members array in the current resource" do before do @new_resource.stub!(:members).and_return(["all", "your", "base"]) @current_resource.stub!(:members).and_return([]) end - + it "should log an appropriate debug message" do Chef::Log.should_receive(:debug).with("group[wheel] setting group members to all, your, base") @provider.set_members_option end - + it "should set the -M option with the members joined by ','" do @provider.set_members_option.should eql(" -M all,your,base") end @@ -123,7 +123,7 @@ describe Chef::Provider::Group::Pw do end describe"load_current_resource" do - before (:each) do + before (:each) do @provider.load_current_resource @provider.define_resource_requirements end @@ -131,7 +131,7 @@ describe Chef::Provider::Group::Pw do File.should_receive(:exists?).with("/usr/sbin/pw").and_return(false) lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Group) end - + it "shouldn't raise an error if /usr/sbin/pw exists" do File.stub!(:exists?).and_return(true) lambda { @provider.process_resource_requirements }.should_not raise_error(Chef::Exceptions::Group) diff --git a/spec/unit/provider/group/usermod_spec.rb b/spec/unit/provider/group/usermod_spec.rb index 880a3b01e4..7f2931f2e2 100644 --- a/spec/unit/provider/group/usermod_spec.rb +++ b/spec/unit/provider/group/usermod_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,20 +28,20 @@ describe Chef::Provider::Group::Usermod do @provider = Chef::Provider::Group::Usermod.new(@new_resource, @run_context) @provider.stub!(:run_command) end - + describe "modify_group_members" do - + describe "with an empty members array" do before do @new_resource.stub!(:members).and_return([]) end - + it "should log an appropriate message" do Chef::Log.should_receive(:debug).with("group[wheel] not changing group members, the group has no members") @provider.modify_group_members end end - + describe "with supplied members" do platforms = { "openbsd" => "-G", @@ -61,10 +61,10 @@ describe Chef::Provider::Group::Usermod do @provider.define_resource_requirements @provider.load_current_resource @provider.instance_variable_set("@group_exists", true) - @provider.action = :modify + @provider.action = :modify lambda { @provider.run_action(@provider.process_resource_requirements) }.should raise_error(Chef::Exceptions::Group, "setting group members directly is not supported by #{@provider.to_s}, must set append true in group") end - + platforms.each do |platform, flags| it "should usermod each user when the append option is set on #{platform}" do @node.automatic_attrs[:platform] = platform @@ -89,7 +89,7 @@ describe Chef::Provider::Group::Usermod do File.should_receive(:exists?).with("/usr/sbin/usermod").and_return(false) lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Group) end - + it "shouldn't raise an error if the required binaries exist" do File.stub!(:exists?).and_return(true) lambda { @provider.process_resource_requirements }.should_not raise_error(Chef::Exceptions::Group) diff --git a/spec/unit/provider/group_spec.rb b/spec/unit/provider/group_spec.rb index 8fceb7428e..caad9878b6 100644 --- a/spec/unit/provider/group_spec.rb +++ b/spec/unit/provider/group_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ describe Chef::Provider::User do @current_resource = Chef::Resource::Group.new("aj", @run_context) @current_resource.gid 500 @current_resource.members "aj" - + @provider.current_resource = @current_resource @pw_group = mock("Struct::Group", @@ -43,13 +43,13 @@ describe Chef::Provider::User do ) Etc.stub!(:getgrnam).with('wheel').and_return(@pw_group) end - + it "assumes the group exists by default" do @provider.group_exists.should be_true end describe "when establishing the current state of the group" do - + it "sets the group name of the current resource to the group name of the new resource" do @provider.load_current_resource @provider.current_resource.group_name.should == 'wheel' @@ -65,22 +65,22 @@ describe Chef::Provider::User do @provider.load_current_resource @new_resource.gid.should == 20 end - + it "looks up the group in /etc/group with getgrnam" do Etc.should_receive(:getgrnam).with(@new_resource.group_name).and_return(@pw_group) @provider.load_current_resource @provider.current_resource.gid.should == 20 @provider.current_resource.members.should == %w{root aj} end - + it "should flip the value of exists if it cannot be found in /etc/group" do Etc.stub!(:getgrnam).and_raise(ArgumentError) @provider.load_current_resource @provider.group_exists.should be_false end - + it "should return the current resource" do - @provider.load_current_resource.should equal(@provider.current_resource) + @provider.load_current_resource.should equal(@provider.current_resource) end end @@ -91,7 +91,7 @@ describe Chef::Provider::User do @provider.compare_group.should be_true end end - + it "should return false if gid and members are equal" do @provider.compare_group.should be_false end @@ -116,28 +116,28 @@ describe Chef::Provider::User do @provider.should_receive(:create_group).and_return(true) @provider.run_action(:create) end - + it "should set the new_resources updated flag when it creates the group" do @provider.group_exists = false @provider.stub!(:create_group) @provider.run_action(:create) @provider.new_resource.should be_updated end - + it "should check to see if the group has mismatched attributes if the group exists" do @provider.group_exists = true @provider.stub!(:compare_group).and_return(false) @provider.run_action(:create) @provider.new_resource.should_not be_updated end - + it "should call manage_group if the group exists and has mismatched attributes" do @provider.group_exists = true @provider.stub!(:compare_group).and_return(true) @provider.should_receive(:manage_group).and_return(true) @provider.run_action(:create) end - + it "should set the new_resources updated flag when it creates the group if we call manage_group" do @provider.group_exists = true @provider.stub!(:compare_group).and_return(true) @@ -148,14 +148,14 @@ describe Chef::Provider::User do end describe "when removing a group" do - + it "should not call remove_group if the group does not exist" do @provider.group_exists = false - @provider.should_not_receive(:remove_group) + @provider.should_not_receive(:remove_group) @provider.run_action(:remove) @provider.new_resource.should_not be_updated end - + it "should call remove_group if the group exists" do @provider.group_exists = true @provider.should_receive(:remove_group) @@ -169,26 +169,26 @@ describe Chef::Provider::User do @provider.group_exists = true @provider.stub!(:manage_group).and_return(true) end - + it "should run manage_group if the group exists and has mismatched attributes" do @provider.should_receive(:compare_group).and_return(true) @provider.should_receive(:manage_group).and_return(true) @provider.run_action(:manage) end - + it "should set the new resources updated flag to true if manage_group is called" do @provider.stub!(:compare_group).and_return(true) @provider.stub!(:manage_group).and_return(true) @provider.run_action(:manage) @new_resource.should be_updated end - + it "should not run manage_group if the group does not exist" do @provider.group_exists = false @provider.should_not_receive(:manage_group) @provider.run_action(:manage) end - + it "should not run manage_group if the group exists but has no differing attributes" do @provider.should_receive(:compare_group).and_return(false) @provider.should_not_receive(:manage_group) @@ -201,26 +201,26 @@ describe Chef::Provider::User do @provider.group_exists = true @provider.stub!(:manage_group).and_return(true) end - + it "should run manage_group if the group exists and has mismatched attributes" do @provider.should_receive(:compare_group).and_return(true) @provider.should_receive(:manage_group).and_return(true) @provider.run_action(:modify) end - + it "should set the new resources updated flag to true if manage_group is called" do @provider.stub!(:compare_group).and_return(true) @provider.stub!(:manage_group).and_return(true) @provider.run_action(:modify) @new_resource.should be_updated end - + it "should not run manage_group if the group exists but has no differing attributes" do @provider.should_receive(:compare_group).and_return(false) @provider.should_not_receive(:manage_group) @provider.run_action(:modify) end - + it "should raise a Chef::Exceptions::Group if the group doesn't exist" do @provider.group_exists = false lambda { @provider.run_action(:modify) }.should raise_error(Chef::Exceptions::Group) @@ -230,7 +230,7 @@ describe Chef::Provider::User do describe "when determining the reason for a change" do it "should report which group members are missing if members are missing and appending to the group" do @new_resource.members << "user1" - @new_resource.members << "user2" + @new_resource.members << "user2" @new_resource.stub!(:append).and_return true @provider.compare_group.should be_true @provider.change_desc.should == "add missing member(s): user1, user2" @@ -238,7 +238,7 @@ describe Chef::Provider::User do it "should report that the group members will be overwritten if not appending" do @new_resource.members << "user1" - @new_resource.stub!(:append).and_return false + @new_resource.stub!(:append).and_return false @provider.compare_group.should be_true @provider.change_desc.should == "replace group members with new list of members" end diff --git a/spec/unit/provider/ifconfig/aix_spec.rb b/spec/unit/provider/ifconfig/aix_spec.rb index a97853b22c..39e9919740 100644 --- a/spec/unit/provider/ifconfig/aix_spec.rb +++ b/spec/unit/provider/ifconfig/aix_spec.rb @@ -20,7 +20,7 @@ require 'spec_helper' require 'chef/exceptions' describe Chef::Provider::Ifconfig::Aix do - + before(:all) do @ifconfig_output = <<-IFCONFIG en1: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN> @@ -47,8 +47,8 @@ IFCONFIG @provider = Chef::Provider::Ifconfig::Aix.new(@new_resource, @run_context) end - describe "#load_current_resource" do - before do + describe "#load_current_resource" do + before do status = double("Status", :exitstatus => 0) @provider.should_receive(:popen4).with("ifconfig -a").and_yield(@pid,@stdin,StringIO.new(@ifconfig_output),@stderr).and_return(status) @new_resource.device "en0" @@ -177,4 +177,4 @@ IFCONFIG end end end -end
\ No newline at end of file +end diff --git a/spec/unit/provider/ifconfig_spec.rb b/spec/unit/provider/ifconfig_spec.rb index d1d20f7f22..f4fdc23353 100644 --- a/spec/unit/provider/ifconfig_spec.rb +++ b/spec/unit/provider/ifconfig_spec.rb @@ -38,20 +38,20 @@ describe Chef::Provider::Ifconfig do status = mock("Status", :exitstatus => 0) @provider.instance_variable_set("@status", status) @provider.current_resource = @current_resource - + end - describe Chef::Provider::Ifconfig, "load_current_resource" do - before do + describe Chef::Provider::Ifconfig, "load_current_resource" do + before do status = mock("Status", :exitstatus => 1) - @provider.should_receive(:popen4).and_return status + @provider.should_receive(:popen4).and_return status @provider.load_current_resource end it "should track state of ifconfig failure." do @provider.instance_variable_get("@status").exitstatus.should_not == 0 end - it "should thrown an exception when ifconfig fails" do + it "should thrown an exception when ifconfig fails" do @provider.define_resource_requirements - lambda { @provider.process_resource_requirements }.should raise_error Chef::Exceptions::Ifconfig + lambda { @provider.process_resource_requirements }.should raise_error Chef::Exceptions::Ifconfig end end describe Chef::Provider::Ifconfig, "action_add" do @@ -84,7 +84,7 @@ describe Chef::Provider::Ifconfig do end describe Chef::Provider::Ifconfig, "action_enable" do - + it "should enable interface if does not exist" do @provider.stub!(:load_current_resource) @current_resource.inet_addr nil @@ -129,7 +129,7 @@ describe Chef::Provider::Ifconfig do @new_resource.should_not be_updated end end - + describe Chef::Provider::Ifconfig, "action_disable" do it "should disable interface if it exists" do diff --git a/spec/unit/provider/link_spec.rb b/spec/unit/provider/link_spec.rb index 171e21171c..bd3204510b 100644 --- a/spec/unit/provider/link_spec.rb +++ b/spec/unit/provider/link_spec.rb @@ -241,8 +241,8 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do result end it 'create does no work' do - provider.file_class.should_not_receive(:symlink) - provider.file_class.should_not_receive(:link) + provider.file_class.should_not_receive(:symlink) + provider.file_class.should_not_receive(:link) provider.access_controls.should_not_receive(:set_all) provider.run_action(:create) end diff --git a/spec/unit/provider/log_spec.rb b/spec/unit/provider/log_spec.rb index fe3733240a..f6ff526dd4 100644 --- a/spec/unit/provider/log_spec.rb +++ b/spec/unit/provider/log_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,7 +25,7 @@ describe Chef::Provider::Log::ChefLog do @node = Chef::Node.new @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - end + end it "should be registered with the default platform hash" do Chef::Platform.platforms[:default][:log].should_not be_nil @@ -37,7 +37,7 @@ describe Chef::Provider::Log::ChefLog do Chef::Log.should_receive(:info).with(@log_str).and_return(true) @provider.action_write end - + it "should write the string to the Chef::Log object at debug level" do @new_resource = Chef::Resource::Log.new(@log_str) @new_resource.level :debug @@ -53,7 +53,7 @@ describe Chef::Provider::Log::ChefLog do Chef::Log.should_receive(:info).with(@log_str).and_return(true) @provider.action_write end - + it "should write the string to the Chef::Log object at warn level" do @new_resource = Chef::Resource::Log.new(@log_str) @new_resource.level :warn @@ -61,7 +61,7 @@ describe Chef::Provider::Log::ChefLog do Chef::Log.should_receive(:warn).with(@log_str).and_return(true) @provider.action_write end - + it "should write the string to the Chef::Log object at error level" do @new_resource = Chef::Resource::Log.new(@log_str) @new_resource.level :error @@ -69,7 +69,7 @@ describe Chef::Provider::Log::ChefLog do Chef::Log.should_receive(:error).with(@log_str).and_return(true) @provider.action_write end - + it "should write the string to the Chef::Log object at fatal level" do @new_resource = Chef::Resource::Log.new(@log_str) @new_resource.level :fatal @@ -77,5 +77,5 @@ describe Chef::Provider::Log::ChefLog do Chef::Log.should_receive(:fatal).with(@log_str).and_return(true) @provider.action_write end - + end diff --git a/spec/unit/provider/mount/aix_spec.rb b/spec/unit/provider/mount/aix_spec.rb index 92aa8177f2..89de47038a 100644 --- a/spec/unit/provider/mount/aix_spec.rb +++ b/spec/unit/provider/mount/aix_spec.rb @@ -217,7 +217,7 @@ ENABLED mount = true options = rw ETCFILESYSTEMS - + filesystems = StringIO.new ::File.stub!(:open).with("/etc/filesystems", "w").and_yield(filesystems) @@ -234,4 +234,4 @@ ETCFILESYSTEMS @provider.run_action(:disable) end end -end
\ No newline at end of file +end diff --git a/spec/unit/provider/mount/windows_spec.rb b/spec/unit/provider/mount/windows_spec.rb index 74579b14fe..4c9916ae87 100644 --- a/spec/unit/provider/mount/windows_spec.rb +++ b/spec/unit/provider/mount/windows_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/provider/mount_spec.rb b/spec/unit/provider/mount_spec.rb index 1a98f10cb0..a44f9705ee 100644 --- a/spec/unit/provider/mount_spec.rb +++ b/spec/unit/provider/mount_spec.rb @@ -23,13 +23,13 @@ describe Chef::Provider::Mount do @node = Chef::Node.new @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - + @new_resource = Chef::Resource::Mount.new('/tmp/foo') @new_resource.device "/dev/sdz1" @new_resource.name "/tmp/foo" @new_resource.mount_point "/tmp/foo" @new_resource.fstype "ext3" - + @current_resource = Chef::Resource::Mount.new('/tmp/foo') @current_resource.device "/dev/sdz1" @current_resource.name "/tmp/foo" @@ -39,7 +39,7 @@ describe Chef::Provider::Mount do @provider = Chef::Provider::Mount.new(@new_resource, @run_context) @provider.current_resource = @current_resource end - + describe "when the target state is a mounted filesystem" do it "should mount the filesystem if it isn't mounted" do @@ -78,7 +78,7 @@ describe Chef::Provider::Mount do before do @new_resource.supports[:remount] = true end - + it "should remount the filesystem if it is mounted" do @current_resource.stub!(:mounted).and_return(true) @provider.should_receive(:remount_fs).and_return(true) @@ -93,8 +93,8 @@ describe Chef::Provider::Mount do @new_resource.should_not be_updated_by_last_action end end - describe "when the filesystem should be remounted and the resource does not support remounting" do - before do + describe "when the filesystem should be remounted and the resource does not support remounting" do + before do @new_resource.supports[:remount] = false end diff --git a/spec/unit/provider/package/apt_spec.rb b/spec/unit/provider/package/apt_spec.rb index eb11c1e417..32b55163b4 100644 --- a/spec/unit/provider/package/apt_spec.rb +++ b/spec/unit/provider/package/apt_spec.rb @@ -87,18 +87,18 @@ VPKG_STDOUT @provider.should_receive(:shell_out!).with("apt-cache policy libmysqlclient15-dev").and_return(virtual_package) showpkg_out =<<-SHOWPKG_STDOUT Package: libmysqlclient15-dev -Versions: +Versions: -Reverse Depends: +Reverse Depends: libmysqlclient-dev,libmysqlclient15-dev libmysqlclient-dev,libmysqlclient15-dev libmysqlclient-dev,libmysqlclient15-dev libmysqlclient-dev,libmysqlclient15-dev libmysqlclient-dev,libmysqlclient15-dev libmysqlclient-dev,libmysqlclient15-dev -Dependencies: -Provides: -Reverse Provides: +Dependencies: +Provides: +Reverse Provides: libmysqlclient-dev 5.1.41-3ubuntu12.7 libmysqlclient-dev 5.1.41-3ubuntu12.10 libmysqlclient-dev 5.1.41-3ubuntu12 @@ -135,17 +135,17 @@ VPKG_STDOUT @provider.should_receive(:shell_out!).with("apt-cache policy mp3-decoder").and_return(virtual_package) showpkg_out=<<-SHOWPKG_STDOUT Package: mp3-decoder -Versions: +Versions: -Reverse Depends: +Reverse Depends: nautilus,mp3-decoder vux,mp3-decoder plait,mp3-decoder ecasound,mp3-decoder nautilus,mp3-decoder -Dependencies: -Provides: -Reverse Provides: +Dependencies: +Provides: +Reverse Provides: vlc-nox 1.0.6-1ubuntu1.8 vlc 1.0.6-1ubuntu1.8 vlc-nox 1.0.6-1ubuntu1 diff --git a/spec/unit/provider/package/dpkg_spec.rb b/spec/unit/provider/package/dpkg_spec.rb index aa22e0a2a3..30021e31f3 100644 --- a/spec/unit/provider/package/dpkg_spec.rb +++ b/spec/unit/provider/package/dpkg_spec.rb @@ -60,15 +60,15 @@ describe Chef::Provider::Package::Dpkg do @provider.current_resource.package_name.should == "wget" @new_resource.version.should == version end - + it 'if short version provided' do check_version('1.11.4') end - + it 'if extended version provided' do check_version('1.11.4-1ubuntu1') end - + it 'if distro-specific version provided' do check_version('1.11.4-1ubuntu1~lucid') end diff --git a/spec/unit/provider/package/ips_spec.rb b/spec/unit/provider/package/ips_spec.rb index 641a527012..95839dbe89 100644 --- a/spec/unit/provider/package/ips_spec.rb +++ b/spec/unit/provider/package/ips_spec.rb @@ -170,7 +170,7 @@ PKG_STATUS before do @new_resource.stub!(:accept_license).and_return(true) end - + it "should run pkg install with the --accept flag" do @provider.should_receive(:run_command_with_systems_locale).with({ :command => "pkg install -q --accept crypto/gnupg@2.0.17" diff --git a/spec/unit/provider/package/rpm_spec.rb b/spec/unit/provider/package/rpm_spec.rb index 9dd94a7441..86327be42b 100644 --- a/spec/unit/provider/package/rpm_spec.rb +++ b/spec/unit/provider/package/rpm_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,35 +23,35 @@ describe Chef::Provider::Package::Rpm do @node = Chef::Node.new @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - + @new_resource = Chef::Resource::Package.new("emacs") @new_resource.source "/tmp/emacs-21.4-20.el5.i386.rpm" - + @provider = Chef::Provider::Package::Rpm.new(@new_resource, @run_context) - + @status = mock("Status", :exitstatus => 0) ::File.stub!(:exists?).and_return(true) end - + describe "when determining the current state of the package" do - + it "should create a current resource with the name of new_resource" do @provider.stub!(:popen4).and_return(@status) @provider.load_current_resource @provider.current_resource.name.should == "emacs" end - + it "should set the current reource package name to the new resource package name" do @provider.stub!(:popen4).and_return(@status) @provider.load_current_resource @provider.current_resource.package_name.should == 'emacs' end - + it "should raise an exception if a source is supplied but not found" do ::File.stub!(:exists?).and_return(false) lambda { @provider.run_action(:any) }.should raise_error(Chef::Exceptions::Package) end - + it "should get the source package version from rpm if provided" do @stdout = StringIO.new("emacs 21.4-20.el5") @provider.should_receive(:popen4).with("rpm -qp --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' /tmp/emacs-21.4-20.el5.i386.rpm").and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status) @@ -60,7 +60,7 @@ describe Chef::Provider::Package::Rpm do @provider.current_resource.package_name.should == "emacs" @provider.new_resource.version.should == "21.4-20.el5" end - + it "should return the current version installed if found by rpm" do @stdout = StringIO.new("emacs 21.4-20.el5") @provider.should_receive(:popen4).with("rpm -qp --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' /tmp/emacs-21.4-20.el5.i386.rpm").and_return(@status) @@ -68,20 +68,20 @@ describe Chef::Provider::Package::Rpm do @provider.load_current_resource @provider.current_resource.version.should == "21.4-20.el5" end - + it "should raise an exception if the source is not set but we are installing" do new_resource = Chef::Resource::Package.new("emacs") provider = Chef::Provider::Package::Rpm.new(new_resource, @run_context) lambda { provider.run_action(:any) }.should raise_error(Chef::Exceptions::Package) end - + it "should raise an exception if rpm fails to run" do status = mock("Status", :exitstatus => -1) @provider.stub!(:popen4).and_return(status) lambda { @provider.run_action(:any) }.should raise_error(Chef::Exceptions::Package) end end - + describe "after the current resource is loaded" do before do @current_resource = Chef::Resource::Package.new("emacs") @@ -95,7 +95,7 @@ describe Chef::Provider::Package::Rpm do }) @provider.install_package("emacs", "21.4-20.el5") end - + it "should run rpm -U with the package source to upgrade" do @current_resource.version("21.4-19.el5") @provider.should_receive(:run_command_with_systems_locale).with({ diff --git a/spec/unit/provider/package/smartos_spec.rb b/spec/unit/provider/package/smartos_spec.rb index 71ea3fab04..e5092f69d9 100644 --- a/spec/unit/provider/package/smartos_spec.rb +++ b/spec/unit/provider/package/smartos_spec.rb @@ -27,8 +27,8 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do @run_context = Chef::RunContext.new(@node, {}, @events) @new_resource = Chef::Resource::Package.new("varnish") @current_resource = Chef::Resource::Package.new("varnish") - - + + @status = mock("Status", :exitstatus => 0) @provider = Chef::Provider::Package::SmartOS.new(@new_resource, @run_context) Chef::Resource::Package.stub!(:new).and_return(@current_resource) @@ -88,7 +88,7 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do end describe "when manipulating a resource" do - + it "run pkgin and install the package" do out = OpenStruct.new(:stdout => nil) @provider.should_receive(:shell_out!).with("/opt/local/sbin/pkg_info -E \"varnish*\"", {:env => nil, :returns=>[0,1]}).and_return(@shell_out) diff --git a/spec/unit/provider/package_spec.rb b/spec/unit/provider/package_spec.rb index 85aab981e8..f80eed17bd 100644 --- a/spec/unit/provider/package_spec.rb +++ b/spec/unit/provider/package_spec.rb @@ -286,7 +286,7 @@ describe Chef::Provider::Package do @provider.should_not_receive(:reconfig_package) @provider.run_action(:reconfig) @new_resource.should_not be_updated_by_last_action - end + end it "should debug log and not reconfigure the package if no response_file is given" do @current_resource.stub!(:version).and_return('1.0') diff --git a/spec/unit/provider/powershell_spec.rb b/spec/unit/provider/powershell_spec.rb index ac4160080e..33c402836b 100644 --- a/spec/unit/provider/powershell_spec.rb +++ b/spec/unit/provider/powershell_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,7 +24,7 @@ describe Chef::Provider::PowershellScript, "action_run" do @node.default["kernel"] = Hash.new @node.default["kernel"][:machine] = :x86_64.to_s - + @run_context = Chef::RunContext.new(@node, {}, @events) @new_resource = Chef::Resource::PowershellScript.new('run some powershell code', @run_context) diff --git a/spec/unit/provider/remote_directory_spec.rb b/spec/unit/provider/remote_directory_spec.rb index f2bb1b4a3f..d3f1438f0f 100644 --- a/spec/unit/provider/remote_directory_spec.rb +++ b/spec/unit/provider/remote_directory_spec.rb @@ -57,10 +57,10 @@ describe Chef::Provider::RemoteDirectory do @provider_second_run.run_action(:create) end it "identifies that the state has changed the after first run" do - @provider_second_run.new_resource.updated_by_last_action? == true + @provider_second_run.new_resource.updated_by_last_action? == true end it "identifies that the state has not changed after the second run" do - @provider_second_run.new_resource.updated_by_last_action? == false + @provider_second_run.new_resource.updated_by_last_action? == false end end diff --git a/spec/unit/provider/route_spec.rb b/spec/unit/provider/route_spec.rb index 072cb2a698..863f12641c 100644 --- a/spec/unit/provider/route_spec.rb +++ b/spec/unit/provider/route_spec.rb @@ -111,13 +111,13 @@ describe Chef::Provider::Route do it "should not delete config file for :add action (CHEF-3332)" do @node.automatic_attrs[:platform] = 'centos' - + route_file = StringIO.new File.should_receive(:new).and_return(route_file) @resource_add = Chef::Resource::Route.new('192.168.1.0/24 via 192.168.0.1') @run_context.resource_collection << @resource_add @provider.stub!(:run_command).and_return(true) - + @resource_add.action(:add) @provider.run_action(:add) route_file.string.split("\n").should have(1).items diff --git a/spec/unit/provider/ruby_block_spec.rb b/spec/unit/provider/ruby_block_spec.rb index 7fc58c9c70..6e5c9a638b 100644 --- a/spec/unit/provider/ruby_block_spec.rb +++ b/spec/unit/provider/ruby_block_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/provider/service/arch_service_spec.rb b/spec/unit/provider/service/arch_service_spec.rb index 42e7868600..0865fdae86 100644 --- a/spec/unit/provider/service/arch_service_spec.rb +++ b/spec/unit/provider/service/arch_service_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -61,7 +61,7 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do @provider.should_receive(:shell_out).with("/etc/rc.d/chef status").and_return(OpenStruct.new(:exitstatus => 0)) @provider.load_current_resource end - + it "should set running to true if the status command returns 0" do @provider.stub!(:shell_out).with("/etc/rc.d/chef status").and_return(OpenStruct.new(:exitstatus => 0)) @provider.load_current_resource @@ -92,7 +92,7 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do @provider.should_receive(:shell_out).with("/etc/rc.d/chefhasmonkeypants status").and_return(OpenStruct.new(:exitstatus => 0)) @provider.load_current_resource end - + end it "should raise error if the node has a nil ps attribute and no other means to get status" do @@ -129,7 +129,7 @@ aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb DEFAULT_PS @status = mock("Status", :exitstatus => 0, :stdout => @stdout) @provider.stub!(:shell_out!).and_return(@status) - + @node.automatic_attrs[:command] = {:ps => "ps -ef"} end @@ -139,7 +139,7 @@ aj 7842 5057 0 21:26 pts/2 00:00:06 chef aj 7842 5057 0 21:26 pts/2 00:00:06 poos RUNNING_PS @status.stub!(:stdout).and_return(@stdout) - @provider.load_current_resource + @provider.load_current_resource @provider.current_resource.running.should be_true end @@ -162,13 +162,13 @@ RUNNING_PS ::File.stub!(:read).with("/etc/rc.conf").and_return("DAEMONS=(network !apache ssh)") @provider.daemons.should == ['network', '!apache', 'ssh'] end - + context "when the current service status is known" do before do @current_resource = Chef::Resource::Service.new("chef") @provider.current_resource = @current_resource end - + describe Chef::Provider::Service::Arch, "enable_service" do # before(:each) do # @new_resource = mock("Chef::Resource::Service", @@ -178,7 +178,7 @@ RUNNING_PS # :running => false # ) # @new_resource.stub!(:start_command).and_return(false) - # + # # @provider = Chef::Provider::Service::Arch.new(@node, @new_resource) # Chef::Resource::Service.stub!(:new).and_return(@current_resource) # end @@ -199,7 +199,7 @@ RUNNING_PS # :running => false # ) # @new_resource.stub!(:start_command).and_return(false) - # + # # @provider = Chef::Provider::Service::Arch.new(@node, @new_resource) # Chef::Resource::Service.stub!(:new).and_return(@current_resource) # end @@ -221,11 +221,11 @@ RUNNING_PS # :running => false # ) # @new_resource.stub!(:start_command).and_return(false) - # + # # @provider = Chef::Provider::Service::Arch.new(@node, @new_resource) # Chef::Resource::Service.stub!(:new).and_return(@current_resource) # end - + it "should call the start command if one is specified" do @new_resource.stub!(:start_command).and_return("/etc/rc.d/chef startyousillysally") @provider.should_receive(:shell_out!).with("/etc/rc.d/chef startyousillysally") @@ -235,7 +235,7 @@ RUNNING_PS it "should call '/etc/rc.d/service_name start' if no start command is specified" do @provider.should_receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} start") @provider.start_service() - end + end end describe Chef::Provider::Service::Arch, "stop_service" do @@ -247,7 +247,7 @@ RUNNING_PS # :running => false # ) # @new_resource.stub!(:stop_command).and_return(false) - # + # # @provider = Chef::Provider::Service::Arch.new(@node, @new_resource) # Chef::Resource::Service.stub!(:new).and_return(@current_resource) # end @@ -274,7 +274,7 @@ RUNNING_PS # ) # @new_resource.stub!(:restart_command).and_return(false) # @new_resource.stub!(:supports).and_return({:restart => false}) - # + # # @provider = Chef::Provider::Service::Arch.new(@node, @new_resource) # Chef::Resource::Service.stub!(:new).and_return(@current_resource) # end @@ -309,7 +309,7 @@ RUNNING_PS # ) # @new_resource.stub!(:reload_command).and_return(false) # @new_resource.stub!(:supports).and_return({:reload => false}) - # + # # @provider = Chef::Provider::Service::Arch.new(@node, @new_resource) # Chef::Resource::Service.stub!(:new).and_return(@current_resource) # end diff --git a/spec/unit/provider/service/debian_service_spec.rb b/spec/unit/provider/service/debian_service_spec.rb index bea9360561..b1aa193f0e 100644 --- a/spec/unit/provider/service/debian_service_spec.rb +++ b/spec/unit/provider/service/debian_service_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/provider/service/freebsd_service_spec.rb b/spec/unit/provider/service/freebsd_service_spec.rb index 72e896a16b..7861764309 100644 --- a/spec/unit/provider/service/freebsd_service_spec.rb +++ b/spec/unit/provider/service/freebsd_service_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -125,7 +125,7 @@ RC_SAMPLE @provider.define_resource_requirements lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service) end - + describe "when executing assertions" do it "should verify that /etc/rc.conf exists" do ::File.should_receive(:exists?).with("/etc/rc.conf") @@ -138,7 +138,7 @@ RC_SAMPLE it "should raise an exception when the action is #{action}" do ::File.stub!(:exists?).and_return(false) @provider.load_current_resource - @provider.define_resource_requirements + @provider.define_resource_requirements @provider.instance_variable_get("@rcd_script_found").should be_false @provider.action = action lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service) @@ -157,7 +157,7 @@ RC_SAMPLE ::File.should_receive(:exists?).with("/etc/rc.conf").and_return false @provider.load_current_resource @provider.instance_variable_get("@enabled_state_found").should be_false - end + end it "update state when current resource enabled state could be determined" do ::File.stub!(:exist?).with("/usr/local/etc/rc.d/#{@new_resource.service_name}").and_return(true) @@ -165,10 +165,10 @@ RC_SAMPLE @provider.load_current_resource @provider.instance_variable_get("@enabled_state_found").should be_false @provider.instance_variable_get("@rcd_script_found").should be_true - @provider.define_resource_requirements + @provider.define_resource_requirements lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service, "Could not find the service name in /usr/local/etc/rc.d/#{@current_resource.service_name} and rcvar") - end + end it "should throw an exception if service line is missing from rc.d script" do pending "not implemented" do @@ -197,7 +197,7 @@ RC_SAMPLE it "should set running to true if the regex matches the output" do @stdout.stub!(:each_line).and_yield("555 ?? Ss 0:05.16 /usr/sbin/cron -s"). and_yield(" 9881 ?? Ss 0:06.67 /usr/local/sbin/httpd -DNOHTTPACCEPT") - @provider.load_current_resource + @provider.load_current_resource @current_resource.running.should be_true end diff --git a/spec/unit/provider/service/gentoo_service_spec.rb b/spec/unit/provider/service/gentoo_service_spec.rb index 8d4ada043b..b658cab4d8 100644 --- a/spec/unit/provider/service/gentoo_service_spec.rb +++ b/spec/unit/provider/service/gentoo_service_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,10 +24,10 @@ describe Chef::Provider::Service::Gentoo do @node = Chef::Node.new @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - + @new_resource = Chef::Resource::Service.new("chef") @current_resource = Chef::Resource::Service.new("chef") - + @provider = Chef::Provider::Service::Gentoo.new(@new_resource, @run_context) Chef::Resource::Service.stub!(:new).and_return(@current_resource) @status = mock("Status", :exitstatus => 0, :stdout => @stdout) @@ -39,7 +39,7 @@ describe Chef::Provider::Service::Gentoo do end # new test: found_enabled state # - describe "load_current_resource" do + describe "load_current_resource" do it "should raise Chef::Exceptions::Service if /sbin/rc-update does not exist" do File.should_receive(:exists?).with("/sbin/rc-update").and_return(false) @provider.define_resource_requirements @@ -79,7 +79,7 @@ describe Chef::Provider::Service::Gentoo do File.stub!(:exists?).with("/etc/runlevels/default/chef").and_return(true) File.stub!(:readable?).with("/etc/runlevels/default/chef").and_return(false) end - + it "should set enabled to false" do @provider.load_current_resource @current_resource.enabled.should be_false @@ -101,10 +101,10 @@ describe Chef::Provider::Service::Gentoo do end end - + it "should return the current_resource" do @provider.load_current_resource.should == @current_resource - end + end it "should support the status command automatically" do @provider.load_current_resource @@ -122,7 +122,7 @@ describe Chef::Provider::Service::Gentoo do end end - + describe "action_methods" do before(:each) { @provider.stub!(:load_current_resource).and_return(@current_resource) } diff --git a/spec/unit/provider/service/init_service_spec.rb b/spec/unit/provider/service/init_service_spec.rb index 4131ee61a8..c7d47e6281 100644 --- a/spec/unit/provider/service/init_service_spec.rb +++ b/spec/unit/provider/service/init_service_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -40,7 +40,7 @@ PS @status = mock("Status", :exitstatus => 0, :stdout => @stdout) @provider.stub!(:shell_out!).and_return(@status) end - + it "should create a current resource with the name of the new resource" do @provider.load_current_resource @provider.current_resource.should equal(@current_resource) @@ -60,7 +60,7 @@ PS @provider.should_receive(:shell_out).with("/etc/init.d/#{@current_resource.service_name} status").and_return(@status) @provider.load_current_resource end - + it "should set running to true if the status command returns 0" do @provider.stub!(:shell_out).with("/etc/init.d/#{@current_resource.service_name} status").and_return(@status) @provider.load_current_resource @@ -90,9 +90,9 @@ PS @provider.should_receive(:shell_out).with("/etc/init.d/chefhasmonkeypants status").and_return(@status) @provider.load_current_resource end - + end - + describe "when an init command has been specified" do before do @new_resource.stub!(:init_command).and_return("/opt/chef-server/service/erchef") @@ -107,7 +107,7 @@ PS end describe "when the node has not specified a ps command" do - + it "should raise an error if the node has a nil ps attribute" do @node.automatic_attrs[:command] = {:ps => nil} @provider.load_current_resource @@ -123,7 +123,7 @@ PS @provider.define_resource_requirements lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service) end - + end @@ -139,7 +139,7 @@ aj 7842 5057 0 21:26 pts/2 00:00:06 chef aj 7842 5057 0 21:26 pts/2 00:00:06 poos RUNNING_PS @status.stub!(:stdout).and_return(@stdout) - @provider.load_current_resource + @provider.load_current_resource @current_resource.running.should be_true end @@ -172,7 +172,7 @@ RUNNING_PS it "should call '/etc/init.d/service_name start' if no start command is specified" do @provider.should_receive(:shell_out!).with("/etc/init.d/#{@new_resource.service_name} start") @provider.start_service() - end + end end describe Chef::Provider::Service::Init, "stop_service" do diff --git a/spec/unit/provider/service/insserv_service_spec.rb b/spec/unit/provider/service/insserv_service_spec.rb index c823d511b5..8b5f09e78c 100644 --- a/spec/unit/provider/service/insserv_service_spec.rb +++ b/spec/unit/provider/service/insserv_service_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -35,7 +35,7 @@ describe Chef::Provider::Service::Insserv do describe "load_current_resource" do describe "when startup links exist" do - before do + before do Dir.stub!(:glob).with("/etc/rc**/S*initgrediant").and_return(["/etc/rc5.d/S18initgrediant", "/etc/rc2.d/S18initgrediant", "/etc/rc4.d/S18initgrediant", "/etc/rc3.d/S18initgrediant"]) end @@ -46,7 +46,7 @@ describe Chef::Provider::Service::Insserv do end describe "when startup links do not exist" do - before do + before do Dir.stub!(:glob).with("/etc/rc**/S*initgrediant").and_return([]) end @@ -65,7 +65,7 @@ describe Chef::Provider::Service::Insserv do @provider.enable_service end end - + describe "disable_service" do it "should call insserv and remove the links" do @provider.should_receive(:run_command).with({:command=>"/sbin/insserv -r -f #{@new_resource.service_name}"}) diff --git a/spec/unit/provider/service/invokercd_service_spec.rb b/spec/unit/provider/service/invokercd_service_spec.rb index 798b987dd5..ca20657405 100644 --- a/spec/unit/provider/service/invokercd_service_spec.rb +++ b/spec/unit/provider/service/invokercd_service_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -40,7 +40,7 @@ PS @status = mock("Status", :exitstatus => 0, :stdout => @stdout) @provider.stub!(:shell_out!).and_return(@status) end - + it "should create a current resource with the name of the new resource" do @provider.load_current_resource @provider.current_resource.should equal(@current_resource) @@ -60,7 +60,7 @@ PS @provider.should_receive(:shell_out).with("/usr/sbin/invoke-rc.d #{@current_resource.service_name} status").and_return(@status) @provider.load_current_resource end - + it "should set running to true if the status command returns 0" do @provider.stub!(:shell_out).with("/usr/sbin/invoke-rc.d #{@current_resource.service_name} status").and_return(@status) @provider.load_current_resource @@ -90,9 +90,9 @@ PS @provider.should_receive(:shell_out).with("/usr/sbin/invoke-rc.d chefhasmonkeypants status").and_return(@status) @provider.load_current_resource end - + end - + describe "when the node has not specified a ps command" do it "should raise error if the node has a nil ps attribute and no other means to get status" do @node.automatic_attrs[:command] = {:ps => nil} @@ -107,7 +107,7 @@ PS @provider.define_resource_requirements lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service) end - + end @@ -125,7 +125,7 @@ aj 7842 5057 0 21:26 pts/2 00:00:06 poos RUNNING_PS @status = mock("Status", :exitstatus => 0, :stdout => @stdout) @provider.should_receive(:shell_out!).and_return(@status) - @provider.load_current_resource + @provider.load_current_resource @current_resource.running.should be_true end @@ -159,7 +159,7 @@ RUNNING_PS it "should call '/usr/sbin/invoke-rc.d service_name start' if no start command is specified" do @provider.should_receive(:shell_out!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} start") @provider.start_service() - end + end end describe Chef::Provider::Service::Invokercd, "stop_service" do diff --git a/spec/unit/provider/service/redhat_spec.rb b/spec/unit/provider/service/redhat_spec.rb index dd874a4f05..3ce4301026 100644 --- a/spec/unit/provider/service/redhat_spec.rb +++ b/spec/unit/provider/service/redhat_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -47,7 +47,7 @@ describe "Chef::Provider::Service::Redhat" do @node.automatic_attrs[:command] = {:ps => 'foo'} @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - + @new_resource = Chef::Resource::Service.new("chef") @current_resource = Chef::Resource::Service.new("chef") @@ -73,7 +73,7 @@ describe "Chef::Provider::Service::Redhat" do @provider.load_current_resource @current_resource.enabled.should be_true end - + it "sets the current enabled status to false if the regex does not match" do status = mock("Status", :exitstatus => 0, :stdout => "" , :stderr => "") @provider.should_receive(:shell_out).with("/sbin/service chef status").and_return(status) @@ -84,10 +84,10 @@ describe "Chef::Provider::Service::Redhat" do @current_resource.enabled.should be_false end end - + describe "define resource requirements" do it_should_behave_like "define_resource_requirements_common" - + context "when the service does not exist" do before do status = mock("Status", :exitstatus => 1, :stdout => "", :stderr => "chef: unrecognized service") diff --git a/spec/unit/provider/service/simple_service_spec.rb b/spec/unit/provider/service/simple_service_spec.rb index cc0173e246..73cb3766d2 100644 --- a/spec/unit/provider/service/simple_service_spec.rb +++ b/spec/unit/provider/service/simple_service_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -39,7 +39,7 @@ NOMOCKINGSTRINGSPLZ @status = mock("Status", :exitstatus => 0, :stdout => @stdout) @provider.stub!(:shell_out!).and_return(@status) end - + it "should create a current resource with the name of the new resource" do Chef::Resource::Service.should_receive(:new).and_return(@current_resource) @provider.load_current_resource @@ -81,7 +81,7 @@ aj 7842 5057 0 21:26 pts/2 00:00:06 poos NOMOCKINGSTRINGSPLZ @status = mock("Status", :exitstatus => 0, :stdout => @stdout) @provider.stub!(:shell_out!).and_return(@status) - @provider.load_current_resource + @provider.load_current_resource @current_resource.running.should be_true end @@ -117,7 +117,7 @@ NOMOCKINGSTRINGSPLZ @provider.define_resource_requirements @provider.action = :start lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service) - end + end end describe "when stopping a service" do @@ -144,7 +144,7 @@ NOMOCKINGSTRINGSPLZ it "should raise an exception if the resource doesn't support restart, no restart command is provided, and no stop command is provided" do @provider.define_resource_requirements @provider.action = :restart - lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service) + lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service) end it "should just call stop, then start when the resource doesn't support restart and no restart_command is specified" do diff --git a/spec/unit/provider/service/solaris_smf_service_spec.rb b/spec/unit/provider/service/solaris_smf_service_spec.rb index 5cda6ddb77..64afee078c 100644 --- a/spec/unit/provider/service/solaris_smf_service_spec.rb +++ b/spec/unit/provider/service/solaris_smf_service_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -44,7 +44,7 @@ describe Chef::Provider::Service::Solaris do it "should raise an error if /bin/svcs does not exist" do File.should_receive(:exists?).with("/bin/svcs").and_return(false) lambda { @provider.load_current_resource }.should raise_error(Chef::Exceptions::Service) - end + end describe "on a host with /bin/svcs" do @@ -63,7 +63,7 @@ describe Chef::Provider::Service::Solaris do it "should return the current resource" do @provider.stub!(:popen4).with("/bin/svcs -l chef").and_return(@status) @provider.load_current_resource.should eql(@current_resource) - end + end it "should popen4 '/bin/svcs -l service_name'" do @provider.should_receive(:popen4).with("/bin/svcs -l chef").and_return(@status) diff --git a/spec/unit/provider/service/systemd_service_spec.rb b/spec/unit/provider/service/systemd_service_spec.rb index bca28a2d92..a107888b0b 100644 --- a/spec/unit/provider/service/systemd_service_spec.rb +++ b/spec/unit/provider/service/systemd_service_spec.rb @@ -79,19 +79,19 @@ describe Chef::Provider::Service::Systemd do @provider.load_current_resource @provider.instance_variable_get("@status_check_success").should be_true end - + it "should set running to false if it catches a Chef::Exceptions::Exec when using a status command" do @provider.stub!(:run_command_with_systems_locale).and_raise(Chef::Exceptions::Exec) @current_resource.should_receive(:running).with(false) @provider.load_current_resource end - + it "should update state to indicate status check failed when an exception is thrown using a status command" do @provider.stub!(:run_command_with_systems_locale).and_raise(Chef::Exceptions::Exec) @provider.load_current_resource @provider.instance_variable_get("@status_check_success").should be_false end - end + end it "should check if the service is enabled" do @provider.should_receive(:is_enabled?) diff --git a/spec/unit/provider/service/upstart_service_spec.rb b/spec/unit/provider/service/upstart_service_spec.rb index 4224b229e5..8628a4eaf7 100644 --- a/spec/unit/provider/service/upstart_service_spec.rb +++ b/spec/unit/provider/service/upstart_service_spec.rb @@ -73,7 +73,7 @@ describe Chef::Provider::Service::Upstart do @stdout = StringIO.new @stderr = StringIO.new @pid = mock("PID") - + ::File.stub!(:exists?).and_return(true) ::File.stub!(:open).and_return(true) end @@ -172,7 +172,7 @@ describe Chef::Provider::Service::Upstart do @provider.load_current_resource end - it "should track state when the user-provided status command fails" do + it "should track state when the user-provided status command fails" do @provider.stub!(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_raise(Chef::Exceptions::Exec) @provider.load_current_resource @provider.instance_variable_get("@command_success").should == false @@ -190,7 +190,7 @@ describe Chef::Provider::Service::Upstart do @provider.load_current_resource @provider.instance_variable_get("@command_success").should == false end - + it "should return the current resource" do @provider.load_current_resource.should eql(@current_resource) end diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb index a68e798d36..7ec4ccf96a 100644 --- a/spec/unit/provider/service/windows_spec.rb +++ b/spec/unit/provider/service/windows_spec.rb @@ -95,7 +95,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do end describe Chef::Provider::Service::Windows, "stop_service" do - + before(:each) do Win32::Service.stub!(:status).with(@new_resource.service_name).and_return( mock("StatusStruct", :current_state => "running"), @@ -143,9 +143,9 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do it "should stop then start the service if it is running" do Win32::Service.stub!(:status).with(@new_resource.service_name).and_return( - mock("StatusStruct", :current_state => "running"), - mock("StatusStruct", :current_state => "stopped"), - mock("StatusStruct", :current_state => "stopped"), + mock("StatusStruct", :current_state => "running"), + mock("StatusStruct", :current_state => "stopped"), + mock("StatusStruct", :current_state => "stopped"), mock("StatusStruct", :current_state => "running")) Win32::Service.should_receive(:stop).with(@new_resource.service_name) Win32::Service.should_receive(:start).with(@new_resource.service_name) @@ -155,8 +155,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do it "should just start the service if it is stopped" do Win32::Service.stub!(:status).with(@new_resource.service_name).and_return( - mock("StatusStruct", :current_state => "stopped"), - mock("StatusStruct", :current_state => "stopped"), + mock("StatusStruct", :current_state => "stopped"), + mock("StatusStruct", :current_state => "stopped"), mock("StatusStruct", :current_state => "running")) Win32::Service.should_receive(:start).with(@new_resource.service_name) @provider.restart_service @@ -201,7 +201,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @new_resource.updated_by_last_action?.should be_false end end - + describe Chef::Provider::Service::Windows, "disable_service" do before(:each) do diff --git a/spec/unit/provider/subversion_spec.rb b/spec/unit/provider/subversion_spec.rb index 81e5860225..dd020d4597 100644 --- a/spec/unit/provider/subversion_spec.rb +++ b/spec/unit/provider/subversion_spec.rb @@ -247,7 +247,7 @@ describe Chef::Provider::Subversion do ::File.stub!(:directory?).with("/my/deploy").and_return(true) ::File.should_receive(:exist?).with("/my/deploy/dir/.svn").twice.and_return(false) @provider.should_receive(:action_checkout) - @provider.run_action(:sync) + @provider.run_action(:sync) end it "runs the sync_command on action_sync if the deploy dir exists and isn't empty" do diff --git a/spec/unit/provider/user/dscl_spec.rb b/spec/unit/provider/user/dscl_spec.rb index 3894cd61b4..dd98c55bd1 100644 --- a/spec/unit/provider/user/dscl_spec.rb +++ b/spec/unit/provider/user/dscl_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,7 +29,7 @@ describe Chef::Provider::User::Dscl do @new_resource = Chef::Resource::User.new("toor") @provider = Chef::Provider::User::Dscl.new(@new_resource, @run_context) end - + describe "when shelling out to dscl" do it "should run dscl with the supplied cmd /Path args" do shell_return = ShellCmdResult.new('stdout', 'err', 0) @@ -66,7 +66,7 @@ describe Chef::Provider::User::Dscl do before do @provider.stub!(:safe_dscl).and_return("\nwheel 200\nstaff 201\n") end - + it "should run safe_dscl with list /Users uid" do @provider.should_receive(:safe_dscl).with("list /Users uid") @provider.get_free_uid @@ -75,7 +75,7 @@ describe Chef::Provider::User::Dscl do it "should return the first unused uid number on or above 200" do @provider.get_free_uid.should == 202 end - + it "should raise an exception when the search limit is exhausted" do search_limit = 1 lambda { @provider.get_free_uid(search_limit) }.should raise_error(RuntimeError) @@ -91,7 +91,7 @@ describe Chef::Provider::User::Dscl do @provider.should_receive(:safe_dscl).with("list /Users uid") @provider.uid_used?(500) end - + it "should return true for a used uid number" do @provider.uid_used?(500).should be_true end @@ -111,7 +111,7 @@ describe Chef::Provider::User::Dscl do @provider.should_receive(:get_free_uid).and_return(501) lambda { @provider.set_uid }.should raise_error(Chef::Exceptions::RequestedUIDUnavailable) end - + it "finds a valid, unused uid when none is specified" do @provider.should_receive(:safe_dscl).with("list /Users uid").and_return('') @provider.should_receive(:safe_dscl).with("create /Users/toor UniqueID 501") @@ -119,7 +119,7 @@ describe Chef::Provider::User::Dscl do @provider.set_uid @new_resource.uid.should == 501 end - + it "sets the uid specified in the resource" do @new_resource.uid(1000) @provider.should_receive(:safe_dscl).with("create /Users/toor UniqueID 1000").and_return(true) @@ -132,7 +132,7 @@ describe Chef::Provider::User::Dscl do before do @new_resource.supports({ :manage_home => true }) @new_resource.home('/Users/toor') - + @current_resource = @new_resource.dup @provider.current_resource = @current_resource end @@ -142,7 +142,7 @@ describe Chef::Provider::User::Dscl do @provider.should_receive(:safe_dscl).with("delete /Users/toor NFSHomeDirectory").and_return(true) @provider.modify_home end - + it "raises InvalidHomeDirectory when the resource's home directory doesn't look right" do @new_resource.home('epic-fail') @@ -151,20 +151,20 @@ describe Chef::Provider::User::Dscl do it "moves the users home to the new location if it exists and the target location is different" do @new_resource.supports(:manage_home => true) - + current_home = CHEF_SPEC_DATA + '/old_home_dir' current_home_files = [current_home + '/my-dot-emacs', current_home + '/my-dot-vim'] @current_resource.home(current_home) @new_resource.gid(23) ::File.stub!(:exists?).with('/old/home/toor').and_return(true) ::File.stub!(:exists?).with('/Users/toor').and_return(true) - + FileUtils.should_receive(:mkdir_p).with('/Users/toor').and_return(true) FileUtils.should_receive(:rmdir).with(current_home) ::Dir.should_receive(:glob).with("#{CHEF_SPEC_DATA}/old_home_dir/*",::File::FNM_DOTMATCH).and_return(current_home_files) FileUtils.should_receive(:mv).with(current_home_files, "/Users/toor", :force => true) FileUtils.should_receive(:chown_R).with('toor','23','/Users/toor') - + @provider.should_receive(:safe_dscl).with("create /Users/toor NFSHomeDirectory '/Users/toor'") @provider.modify_home end @@ -251,7 +251,7 @@ describe Chef::Provider::User::Dscl do before do @new_resource.password("F"*48) end - + it "should write a shadow hash file with the expected salted sha1" do uuid = "B398449E-CEE0-45E0-80F8-B0B5B1BFDEAA" File.should_receive(:open).with('/var/db/shadow/hash/B398449E-CEE0-45E0-80F8-B0B5B1BFDEAA', "w", 384).and_yield(@output) @@ -262,7 +262,7 @@ describe Chef::Provider::User::Dscl do expected_shadow_hash[168] = expected_salted_sha1 @provider.modify_password @output.string.strip.should == expected_shadow_hash - end + end end describe "when given a shadow hash file for the password" do @@ -292,7 +292,7 @@ describe Chef::Provider::User::Dscl do @provider.should_receive(:safe_dscl).with("read /Users/toor").and_return("\nAuthenticationAuthority: ;ShadowHash;\n") @provider.modify_password @output.string.strip.should match(/^0{168}(FFFFFFFF1C1AA7935D4E1190AFEC92343F31F7671FBF126D)0{1071}$/) - end + end end it "should write the output directly to the shadow hash file at /var/db/shadow/hash/GUID" do @@ -392,7 +392,7 @@ describe Chef::Provider::User::Dscl do before do @current_resource = @new_resource.dup @provider.current_resource = @current_resource - + # These are all different from @current_resource @new_resource.username "mud" @new_resource.uid 2342 @@ -400,7 +400,7 @@ describe Chef::Provider::User::Dscl do @new_resource.home '/Users/death' @new_resource.password 'goaway' end - + it "sets the user, comment field, uid, gid, moves the home directory, sets the shell, and sets the password" do @provider.should_receive :dscl_create_user @provider.should_receive :dscl_create_comment @@ -417,11 +417,11 @@ describe Chef::Provider::User::Dscl do before do @current_resource = @new_resource.dup @provider.current_resource = @current_resource - + # This is different from @current_resource @new_resource.gid 2342 end - + it "sets the gid" do @provider.should_receive :dscl_set_gid @provider.manage_user @@ -436,7 +436,7 @@ describe Chef::Provider::User::Dscl do FileUtils.should_receive(:rm_rf).with("/Users/fuuuuuuuuuuuuu") @provider.remove_user end - + it "removes the user from any group memberships" do Etc.stub(:group).and_yield(OpenStruct.new(:name => 'ragefisters', :mem => 'toor')) @provider.should_receive(:safe_dscl).with("delete /Users/toor") diff --git a/spec/unit/provider/user/pw_spec.rb b/spec/unit/provider/user/pw_spec.rb index b7503ea15f..ea5bcfe740 100644 --- a/spec/unit/provider/user/pw_spec.rb +++ b/spec/unit/provider/user/pw_spec.rb @@ -23,7 +23,7 @@ describe Chef::Provider::User::Pw do @node = Chef::Node.new @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - + @new_resource = Chef::Resource::User.new("adam") @new_resource.comment "Adam Jacob" @new_resource.uid 1000 @@ -31,7 +31,7 @@ describe Chef::Provider::User::Pw do @new_resource.home "/home/adam" @new_resource.shell "/usr/bin/zsh" @new_resource.password "abracadabra" - + @new_resource.supports :manage_home => true @current_resource = Chef::Resource::User.new("adam") diff --git a/spec/unit/provider/user/windows_spec.rb b/spec/unit/provider/user/windows_spec.rb index 6ede11b28c..b11eeaebe5 100644 --- a/spec/unit/provider/user/windows_spec.rb +++ b/spec/unit/provider/user/windows_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -41,7 +41,7 @@ describe Chef::Provider::User::Windows do @provider = Chef::Provider::User::Windows.new(@new_resource, @run_context) @provider.current_resource = @current_resource end - + describe "when comparing the user's current attributes to the desired attributes" do before do @new_resource.comment "Adam Jacob" @@ -79,7 +79,7 @@ describe Chef::Provider::User::Windows do end end - + describe "and the attributes do not match" do before do @current_resource = Chef::Resource::User.new("adam") @@ -130,7 +130,7 @@ describe Chef::Provider::User::Windows do before(:each) do @provider.stub!(:set_options).and_return(:name=> "monkey") end - + it "should call @net_user.update with the return of set_options" do @net_user.should_receive(:update).with(:name=> "monkey") @provider.manage_user diff --git a/spec/unit/provider/user_spec.rb b/spec/unit/provider/user_spec.rb index 8b1e0a54f4..d054fcc440 100644 --- a/spec/unit/provider/user_spec.rb +++ b/spec/unit/provider/user_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -58,7 +58,7 @@ describe Chef::Provider::User do describe "executing load_current_resource" do before(:each) do @node = Chef::Node.new - #@new_resource = mock("Chef::Resource::User", + #@new_resource = mock("Chef::Resource::User", # :null_object => true, # :username => "adam", # :comment => "Adam Jacob", @@ -152,17 +152,17 @@ describe Chef::Provider::User do @new_resource.password "some new password" Etc.stub!(:getpwnam).and_return(user) end - + unless shadow_lib_unavail? context "and we have the ruby-shadow gem" do - pending "and we are not root (rerun this again as root)", :requires_unprivileged_user => true - + pending "and we are not root (rerun this again as root)", :requires_unprivileged_user => true + context "and we are root", :requires_root => true do it "should pass assertions when ruby-shadow can be loaded" do @provider.action = 'create' original_method = @provider.method(:require) @provider.should_receive(:require) { |*args| original_method.call(*args) } - passwd_info = Struct::PasswdEntry.new(:sp_namp => "adm ", :sp_pwdp => "$1$T0N0Q.lc$nyG6pFI3Dpqa5cxUz/57j0", :sp_lstchg => 14861, :sp_min => 0, :sp_max => 99999, + passwd_info = Struct::PasswdEntry.new(:sp_namp => "adm ", :sp_pwdp => "$1$T0N0Q.lc$nyG6pFI3Dpqa5cxUz/57j0", :sp_lstchg => 14861, :sp_min => 0, :sp_max => 99999, :sp_warn => 7, :sp_inact => -1, :sp_expire => -1, :sp_flag => -1) Shadow::Passwd.should_receive(:getspnam).with("adam").and_return(passwd_info) @provider.load_current_resource @@ -177,7 +177,7 @@ describe Chef::Provider::User do @provider.should_receive(:require).with("shadow") { raise LoadError } @provider.load_current_resource @provider.define_resource_requirements - lambda {@provider.process_resource_requirements}.should raise_error Chef::Exceptions::MissingLibrary + lambda {@provider.process_resource_requirements}.should raise_error Chef::Exceptions::MissingLibrary end end @@ -214,13 +214,13 @@ describe Chef::Provider::User do it "should return false if the objects are identical" do @provider.compare_user.should eql(false) - end + end end describe "action_create" do before(:each) do @provider.stub!(:load_current_resource) - # @current_resource = mock("Chef::Resource::User", + # @current_resource = mock("Chef::Resource::User", # :null_object => true, # :username => "adam", # :comment => "Adam Jacob", @@ -270,7 +270,7 @@ describe Chef::Provider::User do it "should not call remove_user if the user does not exist" do @provider.user_exists = false - @provider.should_not_receive(:remove_user) + @provider.should_not_receive(:remove_user) @provider.action_remove end @@ -293,10 +293,10 @@ describe Chef::Provider::User do before(:each) do @provider.stub!(:load_current_resource) # @node = Chef::Node.new - # @new_resource = mock("Chef::Resource::User", + # @new_resource = mock("Chef::Resource::User", # :null_object => true # ) - # @current_resource = mock("Chef::Resource::User", + # @current_resource = mock("Chef::Resource::User", # :null_object => true # ) # @provider = Chef::Provider::User.new(@node, @new_resource) @@ -336,10 +336,10 @@ describe Chef::Provider::User do before(:each) do @provider.stub!(:load_current_resource) # @node = Chef::Node.new - # @new_resource = mock("Chef::Resource::User", + # @new_resource = mock("Chef::Resource::User", # :null_object => true # ) - # @current_resource = mock("Chef::Resource::User", + # @current_resource = mock("Chef::Resource::User", # :null_object => true # ) # @provider = Chef::Provider::User.new(@node, @new_resource) @@ -405,10 +405,10 @@ describe Chef::Provider::User do before(:each) do @provider.stub!(:load_current_resource) # @node = Chef::Node.new - # @new_resource = mock("Chef::Resource::User", + # @new_resource = mock("Chef::Resource::User", # :null_object => true # ) - # @current_resource = mock("Chef::Resource::User", + # @current_resource = mock("Chef::Resource::User", # :null_object => true # ) # @provider = Chef::Provider::User.new(@node, @new_resource) diff --git a/spec/unit/resource/apt_package_spec.rb b/spec/unit/resource/apt_package_spec.rb index 795ffc6fc4..58b007c327 100644 --- a/spec/unit/resource/apt_package_spec.rb +++ b/spec/unit/resource/apt_package_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,19 +19,19 @@ require 'spec_helper' describe Chef::Resource::AptPackage, "initialize" do - + before(:each) do @resource = Chef::Resource::AptPackage.new("foo") end - + it "should return a Chef::Resource::AptPackage" do @resource.should be_a_kind_of(Chef::Resource::AptPackage) end - + it "should set the resource_name to :apt_package" do @resource.resource_name.should eql(:apt_package) end - + it "should set the provider to Chef::Provider::Package::Apt" do @resource.provider.should eql(Chef::Provider::Package::Apt) end diff --git a/spec/unit/resource/bash_spec.rb b/spec/unit/resource/bash_spec.rb index c7f31e1de6..d729db6977 100644 --- a/spec/unit/resource/bash_spec.rb +++ b/spec/unit/resource/bash_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,17 +22,17 @@ describe Chef::Resource::Bash do before(:each) do @resource = Chef::Resource::Bash.new("fakey_fakerton") - end + end it "should create a new Chef::Resource::Bash" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Bash) end - + it "should have a resource name of :bash" do @resource.resource_name.should eql(:bash) end - + it "should have an interpreter of bash" do @resource.interpreter.should eql("bash") end diff --git a/spec/unit/resource/batch_spec.rb b/spec/unit/resource/batch_spec.rb index 91b840908e..b74c7d24a7 100644 --- a/spec/unit/resource/batch_spec.rb +++ b/spec/unit/resource/batch_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,22 +27,22 @@ describe Chef::Resource::Batch do node.default["kernel"][:machine] = :x86_64.to_s run_context = Chef::RunContext.new(node, nil, nil) - + @resource = Chef::Resource::Batch.new("batch_unit_test", run_context) - end + end it "should create a new Chef::Resource::Batch" do @resource.should be_a_kind_of(Chef::Resource::Batch) end - + context "windows script" do let(:resource_instance) { @resource } let(:resource_instance_name ) { @resource.command } let(:resource_name) { :batch } let(:interpreter_file_name) { 'cmd.exe' } - it_should_behave_like "a Windows script resource" + it_should_behave_like "a Windows script resource" end - + end diff --git a/spec/unit/resource/breakpoint_spec.rb b/spec/unit/resource/breakpoint_spec.rb index 8eaabb546d..412211a038 100644 --- a/spec/unit/resource/breakpoint_spec.rb +++ b/spec/unit/resource/breakpoint_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,25 +19,25 @@ require 'spec_helper' describe Chef::Resource::Breakpoint do - + before do @breakpoint = Chef::Resource::Breakpoint.new end - + it "allows the action :break" do @breakpoint.allowed_actions.should include(:break) end - + it "defaults to the break action" do @breakpoint.action.should == "break" end - + it "names itself after the line number of the file where it's created" do @breakpoint.name.should match(/breakpoint_spec\.rb\:[\d]{2}\:in \`new\'$/) end - + it "uses the breakpoint provider" do @breakpoint.provider.should == Chef::Provider::Breakpoint end - + end diff --git a/spec/unit/resource/chef_gem_spec.rb b/spec/unit/resource/chef_gem_spec.rb index 54def9a49d..1d7ca8a81e 100644 --- a/spec/unit/resource/chef_gem_spec.rb +++ b/spec/unit/resource/chef_gem_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,19 +20,19 @@ require 'spec_helper' describe Chef::Resource::ChefGem, "initialize" do - + before(:each) do @resource = Chef::Resource::ChefGem.new("foo") end - + it "should return a Chef::Resource::ChefGem" do @resource.should be_a_kind_of(Chef::Resource::ChefGem) end - + it "should set the resource_name to :chef_gem" do @resource.resource_name.should eql(:chef_gem) end - + it "should set the provider to Chef::Provider::Package::Rubygems" do @resource.provider.should eql(Chef::Provider::Package::Rubygems) end diff --git a/spec/unit/resource/cookbook_file_spec.rb b/spec/unit/resource/cookbook_file_spec.rb index d0408c251a..6c55c8035a 100644 --- a/spec/unit/resource/cookbook_file_spec.rb +++ b/spec/unit/resource/cookbook_file_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,29 +23,29 @@ describe Chef::Resource::CookbookFile do before do @cookbook_file = Chef::Resource::CookbookFile.new('sourcecode_tarball.tgz') end - + it "uses the name parameter for the source parameter" do @cookbook_file.name.should == 'sourcecode_tarball.tgz' end - + it "has a source parameter" do @cookbook_file.name('config_file.conf') @cookbook_file.name.should == 'config_file.conf' end - + it "defaults to a nil cookbook parameter (current cookbook will be used)" do @cookbook_file.cookbook.should be_nil end - + it "has a cookbook parameter" do @cookbook_file.cookbook("munin") @cookbook_file.cookbook.should == 'munin' end - + it "sets the provider to Chef::Provider::CookbookFile" do @cookbook_file.provider.should == Chef::Provider::CookbookFile end - + describe "when it has a backup number, group, mode, owner, source, checksum, and cookbook on nix or path, rights, deny_rights, checksum on windows" do before do if Chef::Platform.windows? @@ -63,21 +63,21 @@ describe Chef::Resource::CookbookFile do @cookbook_file.checksum("1" * 64) end - + it "describes the state" do state = @cookbook_file.state if Chef::Platform.windows? puts state state[:rights].should == [{:permissions => :read, :principals => "Everyone"}] state[:deny_rights].should == [{:permissions => :full_control, :principals => "Clumsy_Sam"}] - else + else state[:group].should == "wheel" state[:mode].should == "0664" state[:owner].should == "root" end state[:checksum].should == "1" * 64 end - + it "returns the path as its identity" do if Chef::Platform.windows? @cookbook_file.identity.should == "C:/temp/origin/file.txt" diff --git a/spec/unit/resource/cron_spec.rb b/spec/unit/resource/cron_spec.rb index 403ffb009b..7f294fae11 100644 --- a/spec/unit/resource/cron_spec.rb +++ b/spec/unit/resource/cron_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,21 +23,21 @@ describe Chef::Resource::Cron do before(:each) do @resource = Chef::Resource::Cron.new("cronify") - end + end it "should create a new Chef::Resource::Cron" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Cron) end - + it "should have a name" do @resource.name.should eql("cronify") end - + it "should have a default action of 'create'" do @resource.action.should eql(:create) end - + it "should accept create or delete for action" do lambda { @resource.action :create }.should_not raise_error(ArgumentError) lambda { @resource.action :delete }.should_not raise_error(ArgumentError) @@ -63,7 +63,7 @@ describe Chef::Resource::Cron do @resource.hour "6" @resource.hour.should eql("6") end - + it "should allow you to specify the day" do @resource.day "10" @resource.day.should eql("10") @@ -110,7 +110,7 @@ describe Chef::Resource::Cron do @resource.send(x, "*").should eql("*") end end - + it "should allow ranges for all time and date values" do [ "minute", "hour", "day", "month", "weekday" ].each do |x| @resource.send(x, "1-2,5").should eql("1-2,5") @@ -130,31 +130,31 @@ describe Chef::Resource::Cron do it "should reject any minute over 59" do lambda { @resource.minute "60" }.should raise_error(RangeError) end - + it "should reject any hour over 23" do lambda { @resource.hour "24" }.should raise_error(RangeError) end - + it "should reject any day over 31" do lambda { @resource.day "32" }.should raise_error(RangeError) end - + it "should reject any month over 12" do lambda { @resource.month "13" }.should raise_error(RangeError) end - + it "should reject any weekday over 7" do lambda { @resource.weekday "8" }.should raise_error(RangeError) end - + it "should convert integer schedule values to a string" do [ "minute", "hour", "day", "month", "weekday" ].each do |x| @resource.send(x, 5).should eql("5") end end - + describe "when it has a time (minute, hour, day, month, weeekend) and user" do - before do + before do @resource.command("tackle") @resource.minute("1") @resource.hour("2") diff --git a/spec/unit/resource/csh_spec.rb b/spec/unit/resource/csh_spec.rb index 291c6ea745..e1534a8f5f 100644 --- a/spec/unit/resource/csh_spec.rb +++ b/spec/unit/resource/csh_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,17 +22,17 @@ describe Chef::Resource::Csh do before(:each) do @resource = Chef::Resource::Csh.new("fakey_fakerton") - end + end it "should create a new Chef::Resource::Csh" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Csh) end - + it "should have a resource name of :csh" do @resource.resource_name.should eql(:csh) end - + it "should have an interpreter of csh" do @resource.interpreter.should eql("csh") end diff --git a/spec/unit/resource/deploy_revision_spec.rb b/spec/unit/resource/deploy_revision_spec.rb index 671ba9a1f6..1f509992aa 100644 --- a/spec/unit/resource/deploy_revision_spec.rb +++ b/spec/unit/resource/deploy_revision_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,7 +19,7 @@ require 'spec_helper' describe Chef::Resource::DeployRevision do - + it "defaults to the revision deploy provider" do @resource = Chef::Resource::DeployRevision.new("deploy _this_!") @resource.provider.should == Chef::Provider::Deploy::Revision @@ -29,11 +29,11 @@ describe Chef::Resource::DeployRevision do @resource = Chef::Resource::DeployRevision.new("deploy _this_!") @resource.resource_name.should == :deploy_revision end - + end describe Chef::Resource::DeployBranch do - + it "defaults to the revision deploy provider" do @resource = Chef::Resource::DeployBranch.new("deploy _this_!") @resource.provider.should == Chef::Provider::Deploy::Revision @@ -43,5 +43,5 @@ describe Chef::Resource::DeployBranch do @resource = Chef::Resource::DeployBranch.new("deploy _this_!") @resource.resource_name.should == :deploy_branch end - + end diff --git a/spec/unit/resource/deploy_spec.rb b/spec/unit/resource/deploy_spec.rb index f2f6893654..7cc25ed41c 100644 --- a/spec/unit/resource/deploy_spec.rb +++ b/spec/unit/resource/deploy_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,7 +19,7 @@ require 'spec_helper' describe Chef::Resource::Deploy do - + class << self def resource_has_a_string_attribute(attr_name) it "has a String attribute for #{attr_name.to_s}" do @@ -28,7 +28,7 @@ describe Chef::Resource::Deploy do lambda {@resource.send(attr_name, 8675309)}.should raise_error(ArgumentError) end end - + def resource_has_a_boolean_attribute(attr_name, opts={:defaults_to=>false}) it "has a Boolean attribute for #{attr_name.to_s}" do @resource.send(attr_name).should eql(opts[:defaults_to]) @@ -36,7 +36,7 @@ describe Chef::Resource::Deploy do @resource.send(attr_name).should eql( !opts[:defaults_to] ) end end - + def resource_has_a_callback_attribute(attr_name) it "has a Callback attribute #{attr_name}" do callback_block = lambda { :noop } @@ -49,11 +49,11 @@ describe Chef::Resource::Deploy do end end end - + before do @resource = Chef::Resource::Deploy.new("/my/deploy/dir") end - + resource_has_a_string_attribute(:repo) resource_has_a_string_attribute(:deploy_to) resource_has_a_string_attribute(:role) @@ -70,15 +70,15 @@ describe Chef::Resource::Deploy do resource_has_a_string_attribute(:svn_password) resource_has_a_string_attribute(:svn_arguments) resource_has_a_string_attribute(:svn_info_args) - + resource_has_a_boolean_attribute(:migrate, :defaults_to=>false) resource_has_a_boolean_attribute(:enable_submodules, :defaults_to=>false) resource_has_a_boolean_attribute(:shallow_clone, :defaults_to=>false) - + it "uses the first argument as the deploy directory" do @resource.deploy_to.should eql("/my/deploy/dir") end - + # For git, any revision, branch, tag, whatever is resolved to a SHA1 ref. # For svn, the branch is included in the repo URL. # Therefore, revision and branch ARE NOT SEPARATE THINGS @@ -86,19 +86,19 @@ describe Chef::Resource::Deploy do @resource.branch "stable" @resource.revision.should eql("stable") end - + it "takes the SCM resource to use as a constant, and defaults to git" do @resource.scm_provider.should eql(Chef::Provider::Git) @resource.scm_provider Chef::Provider::Subversion @resource.scm_provider.should eql(Chef::Provider::Subversion) end - + it "allows scm providers to be set via symbol" do @resource.scm_provider.should == Chef::Provider::Git @resource.scm_provider :subversion @resource.scm_provider.should == Chef::Provider::Subversion end - + it "allows scm providers to be set via string" do @resource.scm_provider.should == Chef::Provider::Git @resource.scm_provider "subversion" @@ -111,105 +111,105 @@ describe Chef::Resource::Deploy do @resource.svn_force_export.should be_true lambda {@resource.svn_force_export(10053)}.should raise_error(ArgumentError) end - + it "takes arbitrary environment variables in a hash" do @resource.environment "RAILS_ENV" => "production" @resource.environment.should == {"RAILS_ENV" => "production"} end - + it "takes string arguments to environment for backwards compat, setting RAILS_ENV, RACK_ENV, and MERB_ENV" do @resource.environment "production" @resource.environment.should == {"RAILS_ENV"=>"production", "RACK_ENV"=>"production","MERB_ENV"=>"production"} end - + it "sets destination to $deploy_to/shared/$repository_cache" do @resource.destination.should eql("/my/deploy/dir/shared/cached-copy") end - + it "sets shared_path to $deploy_to/shared" do @resource.shared_path.should eql("/my/deploy/dir/shared") end - + it "sets current_path to $deploy_to/current" do @resource.current_path.should eql("/my/deploy/dir/current") end - + it "gets the current_path correct even if the shared_path is set (regression test)" do @resource.shared_path @resource.current_path.should eql("/my/deploy/dir/current") end - + it "gives #depth as 5 if shallow clone is true, nil otherwise" do @resource.depth.should be_nil @resource.shallow_clone true @resource.depth.should eql("5") end - + it "aliases repo as repository" do @resource.repository "git@github.com/opcode/cookbooks.git" @resource.repo.should eql("git@github.com/opcode/cookbooks.git") end - + it "aliases git_ssh_wrapper as ssh_wrapper" do @resource.ssh_wrapper "git_my_repo.sh" @resource.git_ssh_wrapper.should eql("git_my_repo.sh") end - + it "has an Array attribute purge_before_symlink, default: log, tmp/pids, public/system" do @resource.purge_before_symlink.should == %w{ log tmp/pids public/system } @resource.purge_before_symlink %w{foo bar baz} @resource.purge_before_symlink.should == %w{foo bar baz} end - + it "has an Array attribute create_dirs_before_symlink, default: tmp, public, config" do @resource.create_dirs_before_symlink.should == %w{tmp public config} @resource.create_dirs_before_symlink %w{foo bar baz} @resource.create_dirs_before_symlink.should == %w{foo bar baz} end - + it 'has a Hash attribute symlinks, default: {"system" => "public/system", "pids" => "tmp/pids", "log" => "log"}' do default = { "system" => "public/system", "pids" => "tmp/pids", "log" => "log"} @resource.symlinks.should == default @resource.symlinks "foo" => "bar/baz" @resource.symlinks.should == {"foo" => "bar/baz"} end - + it 'has a Hash attribute symlink_before_migrate, default "config/database.yml" => "config/database.yml"' do @resource.symlink_before_migrate.should == {"config/database.yml" => "config/database.yml"} @resource.symlink_before_migrate "wtf?" => "wtf is going on" @resource.symlink_before_migrate.should == {"wtf?" => "wtf is going on"} end - + resource_has_a_callback_attribute :before_migrate resource_has_a_callback_attribute :before_symlink resource_has_a_callback_attribute :before_restart resource_has_a_callback_attribute :after_restart - + it "aliases restart_command as restart" do @resource.restart "foobaz" @resource.restart_command.should == "foobaz" end - + it "takes a block for the restart parameter" do restart_like_this = lambda {p :noop} @resource.restart(&restart_like_this) @resource.restart.should == restart_like_this end - + it "defaults to using the Deploy::Timestamped provider" do @resource.provider.should == Chef::Provider::Deploy::Timestamped end - + it "allows providers to be set with a full class name" do @resource.provider Chef::Provider::Deploy::Timestamped @resource.provider.should == Chef::Provider::Deploy::Timestamped end - + it "allows deploy providers to be set via symbol" do @resource.provider :revision @resource.provider.should == Chef::Provider::Deploy::Revision end - + it "allows deploy providers to be set via string" do @resource.provider "revision" @resource.provider.should == Chef::Provider::Deploy::Revision @@ -245,7 +245,7 @@ describe Chef::Resource::Deploy do describe "when it has meta application root, revision, user, group, scm provider, repository cache, environment, simlinks and migrate" do - before do + before do @resource.repository("http://uri.org") @resource.deploy_to("/") @resource.revision("1.2.3") @@ -256,7 +256,7 @@ describe Chef::Resource::Deploy do @resource.environment({"SUDO" => "TRUE"}) @resource.symlinks({"system" => "public/system"}) @resource.migrate(false) - + end it "describes its state" do @@ -269,5 +269,5 @@ describe Chef::Resource::Deploy do @resource.identity.should == "http://uri.org" end end - + end diff --git a/spec/unit/resource/directory_spec.rb b/spec/unit/resource/directory_spec.rb index 9b0c8242e6..dc042c5a77 100644 --- a/spec/unit/resource/directory_spec.rb +++ b/spec/unit/resource/directory_spec.rb @@ -61,7 +61,7 @@ describe Chef::Resource::Directory do end describe "when it has group, mode, and owner" do - before do + before do @resource.path("/tmp/foo/bar/") @resource.group("wheel") @resource.mode("0664") diff --git a/spec/unit/resource/dpkg_package_spec.rb b/spec/unit/resource/dpkg_package_spec.rb index 000908712f..9ef498a577 100644 --- a/spec/unit/resource/dpkg_package_spec.rb +++ b/spec/unit/resource/dpkg_package_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,19 +19,19 @@ require 'spec_helper' describe Chef::Resource::DpkgPackage, "initialize" do - + before(:each) do @resource = Chef::Resource::DpkgPackage.new("foo") end - + it "should return a Chef::Resource::DpkgPackage" do @resource.should be_a_kind_of(Chef::Resource::DpkgPackage) end - + it "should set the resource_name to :dpkg_package" do @resource.resource_name.should eql(:dpkg_package) end - + it "should set the provider to Chef::Provider::Package::Dpkg" do @resource.provider.should eql(Chef::Provider::Package::Dpkg) end diff --git a/spec/unit/resource/env_spec.rb b/spec/unit/resource/env_spec.rb index 6862c669b2..b53cbe478f 100644 --- a/spec/unit/resource/env_spec.rb +++ b/spec/unit/resource/env_spec.rb @@ -66,7 +66,7 @@ describe Chef::Resource::Env do end describe "when it has key name and value" do - before do + before do @resource.key_name("charmander") @resource.value("level7") @resource.delim("hi") diff --git a/spec/unit/resource/erl_call_spec.rb b/spec/unit/resource/erl_call_spec.rb index ccad371723..49df9639d1 100644 --- a/spec/unit/resource/erl_call_spec.rb +++ b/spec/unit/resource/erl_call_spec.rb @@ -68,7 +68,7 @@ describe Chef::Resource::ErlCall do end describe "when it has cookie and node_name" do - before do + before do @resource.code("erl-call:function()") @resource.cookie("cookie") @resource.node_name("raster") diff --git a/spec/unit/resource/freebsd_package_spec.rb b/spec/unit/resource/freebsd_package_spec.rb index 697f5fff06..b80a94f98d 100644 --- a/spec/unit/resource/freebsd_package_spec.rb +++ b/spec/unit/resource/freebsd_package_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,19 +19,19 @@ require 'spec_helper' describe Chef::Resource::FreebsdPackage, "initialize" do - + before(:each) do @resource = Chef::Resource::FreebsdPackage.new("foo") end - + it "should return a Chef::Resource::FreebsdPackage" do @resource.should be_a_kind_of(Chef::Resource::FreebsdPackage) end - + it "should set the resource_name to :freebsd_package" do @resource.resource_name.should eql(:freebsd_package) end - + it "should set the provider to Chef::Provider::Package::freebsd" do @resource.provider.should eql(Chef::Provider::Package::Freebsd) end diff --git a/spec/unit/resource/gem_package_spec.rb b/spec/unit/resource/gem_package_spec.rb index 2404afa03a..98703455de 100644 --- a/spec/unit/resource/gem_package_spec.rb +++ b/spec/unit/resource/gem_package_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,19 +19,19 @@ require 'spec_helper' describe Chef::Resource::GemPackage, "initialize" do - + before(:each) do @resource = Chef::Resource::GemPackage.new("foo") end - + it "should return a Chef::Resource::GemPackage" do @resource.should be_a_kind_of(Chef::Resource::GemPackage) end - + it "should set the resource_name to :gem_package" do @resource.resource_name.should eql(:gem_package) end - + it "should set the provider to Chef::Provider::Package::Rubygems" do @resource.provider.should eql(Chef::Provider::Package::Rubygems) end diff --git a/spec/unit/resource/git_spec.rb b/spec/unit/resource/git_spec.rb index 69b40ffd42..95a30c28a4 100644 --- a/spec/unit/resource/git_spec.rb +++ b/spec/unit/resource/git_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,28 +19,28 @@ require 'spec_helper' describe Chef::Resource::Git do - + before(:each) do @git = Chef::Resource::Git.new("my awesome webapp") end - + it "is a kind of Scm Resource" do @git.should be_a_kind_of(Chef::Resource::Scm) @git.should be_an_instance_of(Chef::Resource::Git) end - + it "uses the git provider" do @git.provider.should eql(Chef::Provider::Git) end - + it "uses aliases revision as branch" do @git.branch "HEAD" @git.revision.should eql("HEAD") end - + it "aliases revision as reference" do @git.reference "v1.0 tag" @git.revision.should eql("v1.0 tag") end - + end diff --git a/spec/unit/resource/group_spec.rb b/spec/unit/resource/group_spec.rb index 4e6828ca30..df68c5691f 100644 --- a/spec/unit/resource/group_spec.rb +++ b/spec/unit/resource/group_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,7 +22,7 @@ require 'spec_helper' describe Chef::Resource::Group, "initialize" do before(:each) do @resource = Chef::Resource::Group.new("admin") - end + end it "should create a new Chef::Resource::Group" do @resource.should be_a_kind_of(Chef::Resource) @@ -32,7 +32,7 @@ describe Chef::Resource::Group, "initialize" do it "should set the resource_name to :group" do @resource.resource_name.should eql(:group) end - + it "should set the group_name equal to the argument to initialize" do @resource.group_name.should eql("admin") end @@ -40,7 +40,7 @@ describe Chef::Resource::Group, "initialize" do it "should default gid to nil" do @resource.gid.should eql(nil) end - + it "should default members to an empty array" do @resource.members.should eql([]) end @@ -48,11 +48,11 @@ describe Chef::Resource::Group, "initialize" do it "should alias users to members, also an empty array" do @resource.users.should eql([]) end - + it "should set action to :create" do @resource.action.should eql(:create) end - + %w{create remove modify manage}.each do |action| it "should allow action #{action}" do @resource.allowed_actions.detect { |a| a == action.to_sym }.should eql(action.to_sym) @@ -125,11 +125,11 @@ describe Chef::Resource::Group, "append" do before(:each) do @resource = Chef::Resource::Group.new("admin") end - + it "should default to false" do @resource.append.should eql(false) end - + it "should allow a boolean" do @resource.append true @resource.append.should eql(true) @@ -138,9 +138,9 @@ describe Chef::Resource::Group, "append" do it "should not allow a hash" do lambda { @resource.send(:gid, { :aj => "is freakin awesome" }) }.should raise_error(ArgumentError) end - + describe "when it has members" do - before do + before do @resource.group_name("pokemon") @resource.members(["blastoise", "pikachu"]) end diff --git a/spec/unit/resource/http_request_spec.rb b/spec/unit/resource/http_request_spec.rb index 924cf66fc2..b636ca9994 100644 --- a/spec/unit/resource/http_request_spec.rb +++ b/spec/unit/resource/http_request_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,7 +23,7 @@ describe Chef::Resource::HttpRequest do before(:each) do @resource = Chef::Resource::HttpRequest.new("fakey_fakerton") - end + end it "should create a new Chef::Resource::HttpRequest" do @resource.should be_a_kind_of(Chef::Resource) @@ -34,18 +34,18 @@ describe Chef::Resource::HttpRequest do @resource.url "http://slashdot.org" @resource.url.should eql("http://slashdot.org") end - + it "should set the message to the name by default" do @resource.message.should eql("fakey_fakerton") end - + it "should set message to a string" do @resource.message "monkeybars" @resource.message.should eql("monkeybars") end describe "when it has a message and headers" do - before do + before do @resource.url("http://www.trololol.net") @resource.message("Get sum post brah.") @resource.headers({"head" => "tail"}) @@ -55,5 +55,5 @@ describe Chef::Resource::HttpRequest do @resource.identity.should == "http://www.trololol.net" end end - + end diff --git a/spec/unit/resource/ifconfig_spec.rb b/spec/unit/resource/ifconfig_spec.rb index 58869d5107..10a4d09982 100644 --- a/spec/unit/resource/ifconfig_spec.rb +++ b/spec/unit/resource/ifconfig_spec.rb @@ -28,7 +28,7 @@ describe Chef::Resource::Ifconfig do end describe "when it has target, hardware address, inet address, and a mask" do - before do + before do @resource.device("charmander") @resource.target("team_rocket") @resource.hwaddr("11.2223.223") diff --git a/spec/unit/resource/ips_package_spec.rb b/spec/unit/resource/ips_package_spec.rb index 92e62606de..61661922fa 100644 --- a/spec/unit/resource/ips_package_spec.rb +++ b/spec/unit/resource/ips_package_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,19 +19,19 @@ require 'spec_helper' describe Chef::Resource::IpsPackage, "initialize" do - + before(:each) do @resource = Chef::Resource::IpsPackage.new("crypto/gnupg") end - + it "should return a Chef::Resource::IpsPackage" do @resource.should be_a_kind_of(Chef::Resource::IpsPackage) end - + it "should set the resource_name to :ips_package" do @resource.resource_name.should eql(:ips_package) end - + it "should set the provider to Chef::Provider::Package::Ips" do @resource.provider.should eql(Chef::Provider::Package::Ips) end diff --git a/spec/unit/resource/link_spec.rb b/spec/unit/resource/link_spec.rb index bf01bce766..fc3f7ff41c 100644 --- a/spec/unit/resource/link_spec.rb +++ b/spec/unit/resource/link_spec.rb @@ -97,7 +97,7 @@ describe Chef::Resource::Link do end describe "when it has to, link_type, owner, and group" do - before do + before do @resource.target_file("/var/target.tar") @resource.to("/to/dir/file.tar") @resource.link_type(:symbolic) diff --git a/spec/unit/resource/log_spec.rb b/spec/unit/resource/log_spec.rb index 4c6b2c122d..4e439f5c5f 100644 --- a/spec/unit/resource/log_spec.rb +++ b/spec/unit/resource/log_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,8 +24,8 @@ describe Chef::Resource::Log do before(:each) do @log_str = "this is my string to log" @resource = Chef::Resource::Log.new(@log_str) - end - + end + it "should create a new Chef::Resource::Log" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Log) @@ -47,7 +47,7 @@ describe Chef::Resource::Log do @resource.message "this is different" @resource.message.should == "this is different" end - + it "should accept a vaild level option" do @resource.level :debug @resource.level :info @@ -58,7 +58,7 @@ describe Chef::Resource::Log do end describe "when the identity is defined" do - before do + before do @resource = Chef::Resource::Log.new("ery day I'm loggin-in") end @@ -67,4 +67,3 @@ describe Chef::Resource::Log do end end end - diff --git a/spec/unit/resource/macports_package_spec.rb b/spec/unit/resource/macports_package_spec.rb index 7420fafeb5..7e2e200487 100644 --- a/spec/unit/resource/macports_package_spec.rb +++ b/spec/unit/resource/macports_package_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/resource/mdadm_spec.rb b/spec/unit/resource/mdadm_spec.rb index c4e6704ceb..310f420659 100644 --- a/spec/unit/resource/mdadm_spec.rb +++ b/spec/unit/resource/mdadm_spec.rb @@ -80,13 +80,13 @@ describe Chef::Resource::Mdadm do end describe "when it has devices, level, and chunk" do - before do + before do @resource.raid_device("raider") @resource.devices(["device1", "device2"]) @resource.level(1) @resource.chunk(42) end - + it "describes its state" do state = @resource.state state[:devices].should eql(["device1", "device2"]) @@ -98,5 +98,5 @@ describe Chef::Resource::Mdadm do @resource.identity.should == "raider" end end - + end diff --git a/spec/unit/resource/mount_spec.rb b/spec/unit/resource/mount_spec.rb index 9f9a534a4e..fb414018ba 100644 --- a/spec/unit/resource/mount_spec.rb +++ b/spec/unit/resource/mount_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,7 +23,7 @@ describe Chef::Resource::Mount do before(:each) do @resource = Chef::Resource::Mount.new("filesystem") end - + it "should create a new Chef::Resource::Mount" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Mount) @@ -36,18 +36,18 @@ describe Chef::Resource::Mount do it "should set mount_point to the name" do @resource.mount_point.should eql("filesystem") end - + it "should have a default action of mount" do @resource.action.should eql(:mount) end - + it "should accept mount, umount and remount as actions" do lambda { @resource.action :mount }.should_not raise_error(ArgumentError) lambda { @resource.action :umount }.should_not raise_error(ArgumentError) lambda { @resource.action :remount }.should_not raise_error(ArgumentError) lambda { @resource.action :brooklyn }.should raise_error(ArgumentError) end - + it "should allow you to set the device attribute" do @resource.device "/dev/sdb3" @resource.device.should eql("/dev/sdb3") @@ -76,19 +76,19 @@ describe Chef::Resource::Mount do @resource.options "rw,noexec" @resource.options.should be_a_kind_of(Array) end - + it "should allow options attribute as an array" do @resource.options ["ro", "nosuid"] @resource.options.should be_a_kind_of(Array) end it "should accept true for mounted" do - @resource.mounted(true) + @resource.mounted(true) @resource.mounted.should eql(true) end it "should accept false for mounted" do - @resource.mounted(false) + @resource.mounted(false) @resource.mounted.should eql(false) end @@ -101,12 +101,12 @@ describe Chef::Resource::Mount do end it "should accept true for enabled" do - @resource.enabled(true) + @resource.enabled(true) @resource.enabled.should eql(true) end it "should accept false for enabled" do - @resource.enabled(false) + @resource.enabled(false) @resource.enabled.should eql(false) end @@ -152,7 +152,7 @@ describe Chef::Resource::Mount do end describe "when it has mount point, device type, and fstype" do - before do + before do @resource.device("charmander") @resource.mount_point("123.456") @resource.device_type(:device) @@ -172,7 +172,7 @@ describe Chef::Resource::Mount do end describe "when it has username, password and domain" do - before do + before do @resource.mount_point("T:") @resource.device("charmander") @resource.username("Administrator") diff --git a/spec/unit/resource/ohai_spec.rb b/spec/unit/resource/ohai_spec.rb index 82df61e509..b8d062b4c9 100644 --- a/spec/unit/resource/ohai_spec.rb +++ b/spec/unit/resource/ohai_spec.rb @@ -43,7 +43,7 @@ describe Chef::Resource::Ohai do end describe "when it has a plugin value" do - before do + before do @resource.name("test") @resource.plugin("passwd") end diff --git a/spec/unit/resource/package_spec.rb b/spec/unit/resource/package_spec.rb index 3f9cc7a408..0f175dda12 100644 --- a/spec/unit/resource/package_spec.rb +++ b/spec/unit/resource/package_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,7 +23,7 @@ describe Chef::Resource::Package do before(:each) do @resource = Chef::Resource::Package.new("emacs") - end + end it "should create a new Chef::Resource::Package" do @resource.should be_a_kind_of(Chef::Resource) @@ -38,12 +38,12 @@ describe Chef::Resource::Package do @resource.package_name "something" @resource.package_name.should eql("something") end - + it "should accept a string for the version" do @resource.version "something" @resource.version.should eql("something") end - + it "should accept a string for the response file" do @resource.response_file "something" @resource.response_file.should eql("something") @@ -71,7 +71,7 @@ describe Chef::Resource::Package do state[:version].should == "10.9.8" state[:options].should == "-al" end - + it "returns the file path as its identity" do @resource.identity.should == "tomcat" end diff --git a/spec/unit/resource/pacman_package_spec.rb b/spec/unit/resource/pacman_package_spec.rb index 53ecd296c9..ec5feeb82c 100644 --- a/spec/unit/resource/pacman_package_spec.rb +++ b/spec/unit/resource/pacman_package_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,19 +19,19 @@ require 'spec_helper' describe Chef::Resource::PacmanPackage, "initialize" do - + before(:each) do @resource = Chef::Resource::PacmanPackage.new("foo") end - + it "should return a Chef::Resource::PacmanPackage" do @resource.should be_a_kind_of(Chef::Resource::PacmanPackage) end - + it "should set the resource_name to :pacman_package" do @resource.resource_name.should eql(:pacman_package) end - + it "should set the provider to Chef::Provider::Package::Pacman" do @resource.provider.should eql(Chef::Provider::Package::Pacman) end diff --git a/spec/unit/resource/perl_spec.rb b/spec/unit/resource/perl_spec.rb index f0313e6fb9..d25dc98563 100644 --- a/spec/unit/resource/perl_spec.rb +++ b/spec/unit/resource/perl_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,17 +22,17 @@ describe Chef::Resource::Perl do before(:each) do @resource = Chef::Resource::Perl.new("fakey_fakerton") - end + end it "should create a new Chef::Resource::Perl" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Perl) end - + it "should have a resource name of :perl" do @resource.resource_name.should eql(:perl) end - + it "should have an interpreter of perl" do @resource.interpreter.should eql("perl") end diff --git a/spec/unit/resource/portage_package_spec.rb b/spec/unit/resource/portage_package_spec.rb index da086d95ba..510f3b5864 100644 --- a/spec/unit/resource/portage_package_spec.rb +++ b/spec/unit/resource/portage_package_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,19 +19,19 @@ require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper")) describe Chef::Resource::PortagePackage, "initialize" do - + before(:each) do @resource = Chef::Resource::PortagePackage.new("foo") end - + it "should return a Chef::Resource::PortagePackage" do @resource.should be_a_kind_of(Chef::Resource::PortagePackage) end - + it "should set the resource_name to :portage_package" do @resource.resource_name.should eql(:portage_package) end - + it "should set the provider to Chef::Provider::Package::Portage" do @resource.provider.should eql(Chef::Provider::Package::Portage) end diff --git a/spec/unit/resource/powershell_spec.rb b/spec/unit/resource/powershell_spec.rb index 6ec37583e6..a35e37c696 100644 --- a/spec/unit/resource/powershell_spec.rb +++ b/spec/unit/resource/powershell_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -30,19 +30,19 @@ describe Chef::Resource::PowershellScript do @resource = Chef::Resource::PowershellScript.new("powershell_unit_test", run_context) - end + end it "should create a new Chef::Resource::PowershellScript" do @resource.should be_a_kind_of(Chef::Resource::PowershellScript) end - + context "windowsscript" do let(:resource_instance) { @resource } let(:resource_instance_name ) { @resource.command } let(:resource_name) { :powershell_script } let(:interpreter_file_name) { 'powershell.exe' } - it_should_behave_like "a Windows script resource" + it_should_behave_like "a Windows script resource" end end diff --git a/spec/unit/resource/python_spec.rb b/spec/unit/resource/python_spec.rb index ff9547db9a..3362b68c62 100644 --- a/spec/unit/resource/python_spec.rb +++ b/spec/unit/resource/python_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,17 +22,17 @@ describe Chef::Resource::Python do before(:each) do @resource = Chef::Resource::Python.new("fakey_fakerton") - end + end it "should create a new Chef::Resource::Python" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Python) end - + it "should have a resource name of :python" do @resource.resource_name.should eql(:python) end - + it "should have an interpreter of python" do @resource.interpreter.should eql("python") end diff --git a/spec/unit/resource/registry_key_spec.rb b/spec/unit/resource/registry_key_spec.rb index 9d7680de0c..3f227e26b6 100644 --- a/spec/unit/resource/registry_key_spec.rb +++ b/spec/unit/resource/registry_key_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/resource/remote_directory_spec.rb b/spec/unit/resource/remote_directory_spec.rb index e4fa8fc4e3..d3800062ae 100644 --- a/spec/unit/resource/remote_directory_spec.rb +++ b/spec/unit/resource/remote_directory_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,7 +22,7 @@ describe Chef::Resource::RemoteDirectory do before(:each) do @resource = Chef::Resource::RemoteDirectory.new("/etc/dunk") - end + end it "should create a new Chef::Resource::RemoteDirectory" do @resource.should be_a_kind_of(Chef::Resource) @@ -46,35 +46,35 @@ describe Chef::Resource::RemoteDirectory do @resource.files_backup 1 @resource.files_backup.should eql(1) end - + it "should accept false for the remote files backup" do @resource.files_backup false @resource.files_backup.should eql(false) end - + it "should accept 3 or 4 digets for the files_mode" do @resource.files_mode 100 @resource.files_mode.should eql(100) @resource.files_mode 1000 @resource.files_mode.should eql(1000) end - + it "should accept a string or number for the files group" do @resource.files_group "heart" @resource.files_group.should eql("heart") @resource.files_group 1000 @resource.files_group.should eql(1000) end - + it "should accept a string or number for the files owner" do @resource.files_owner "heart" @resource.files_owner.should eql("heart") @resource.files_owner 1000 @resource.files_owner.should eql(1000) end - + describe "when it has cookbook, files owner, files mode, and source" do - before do + before do @resource.path("/var/path/") @resource.cookbook("pokemon.rb") @resource.files_owner("root") diff --git a/spec/unit/resource/remote_file_spec.rb b/spec/unit/resource/remote_file_spec.rb index 93fb3c0c36..643bc8ba21 100644 --- a/spec/unit/resource/remote_file_spec.rb +++ b/spec/unit/resource/remote_file_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -123,7 +123,7 @@ describe Chef::Resource::RemoteFile do end describe "when it has group, mode, owner, source, and checksum" do - before do + before do if Chef::Platform.windows? @resource.path("C:/temp/origin/file.txt") @resource.rights(:read, "Everyone") @@ -144,7 +144,7 @@ describe Chef::Resource::RemoteFile do puts state state[:rights].should == [{:permissions => :read, :principals => "Everyone"}] state[:deny_rights].should == [{:permissions => :full_control, :principals => "Clumsy_Sam"}] - else + else state[:group].should == "pokemon" state[:mode].should == "0664" state[:owner].should == "root" diff --git a/spec/unit/resource/route_spec.rb b/spec/unit/resource/route_spec.rb index 966b3aed34..bca42f1101 100644 --- a/spec/unit/resource/route_spec.rb +++ b/spec/unit/resource/route_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,31 +23,31 @@ describe Chef::Resource::Route do before(:each) do @resource = Chef::Resource::Route.new("10.0.0.10") - end + end it "should create a new Chef::Resource::Route" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Route) end - + it "should have a name" do @resource.name.should eql("10.0.0.10") end - + it "should have a default action of 'add'" do @resource.action.should eql([:add]) end - + it "should accept add or delete for action" do lambda { @resource.action :add }.should_not raise_error(ArgumentError) lambda { @resource.action :delete }.should_not raise_error(ArgumentError) lambda { @resource.action :lolcat }.should raise_error(ArgumentError) end - + it "should use the object name as the target by default" do @resource.target.should eql("10.0.0.10") end - + it "should allow you to specify the netmask" do @resource.netmask "255.255.255.0" @resource.netmask.should eql("255.255.255.0") @@ -72,22 +72,22 @@ describe Chef::Resource::Route do @resource.route_type "host" @resource.route_type.should eql(:host) end - + it "should default to a host route type" do @resource.route_type.should eql(:host) end - + it "should accept a net route type" do @resource.route_type :net @resource.route_type.should eql(:net) end - + it "should reject any other route_type but :host and :net" do lambda { @resource.route_type "lolcat" }.should raise_error(ArgumentError) end - + describe "when it has netmask, gateway, and device" do - before do + before do @resource.target("charmander") @resource.netmask("lemask") @resource.gateway("111.111.111") diff --git a/spec/unit/resource/rpm_package_spec.rb b/spec/unit/resource/rpm_package_spec.rb index d59dc6b29c..25930a5484 100644 --- a/spec/unit/resource/rpm_package_spec.rb +++ b/spec/unit/resource/rpm_package_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/resource/ruby_block_spec.rb b/spec/unit/resource/ruby_block_spec.rb index 637d4fe34d..82bbd1ffc7 100644 --- a/spec/unit/resource/ruby_block_spec.rb +++ b/spec/unit/resource/ruby_block_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ describe Chef::Resource::RubyBlock do it "should have a default action of 'create'" do @resource.action.should eql("run") end - + it "should have a resource name of :ruby_block" do @resource.resource_name.should eql(:ruby_block) end @@ -50,7 +50,7 @@ describe Chef::Resource::RubyBlock do end describe "when it has been initialized with block code" do - before do + before do @resource.block_name("puts 'harrrr'") end diff --git a/spec/unit/resource/ruby_spec.rb b/spec/unit/resource/ruby_spec.rb index 48dfd90898..9bf7316e6d 100644 --- a/spec/unit/resource/ruby_spec.rb +++ b/spec/unit/resource/ruby_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,17 +22,17 @@ describe Chef::Resource::Ruby do before(:each) do @resource = Chef::Resource::Ruby.new("fakey_fakerton") - end + end it "should create a new Chef::Resource::Ruby" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Ruby) end - + it "should have a resource name of :ruby" do @resource.resource_name.should eql(:ruby) end - + it "should have an interpreter of ruby" do @resource.interpreter.should eql("ruby") end diff --git a/spec/unit/resource/scm_spec.rb b/spec/unit/resource/scm_spec.rb index d88a4160e7..8f6593a931 100644 --- a/spec/unit/resource/scm_spec.rb +++ b/spec/unit/resource/scm_spec.rb @@ -151,7 +151,7 @@ describe Chef::Resource::Scm do end describe "when it has repository, revision, user, and group" do - before do + before do @resource.destination("hell") @resource.repository("apt") @resource.revision("1.2.3") diff --git a/spec/unit/resource/script_spec.rb b/spec/unit/resource/script_spec.rb index 53735daf01..f100b0dc85 100644 --- a/spec/unit/resource/script_spec.rb +++ b/spec/unit/resource/script_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,7 @@ require 'spec_helper' describe Chef::Resource::Script do - let(:resource_instance_name) { "fakey_fakerton" } + let(:resource_instance_name) { "fakey_fakerton" } let(:script_resource) { Chef::Resource::Script.new(resource_instance_name) } let(:resource_name) { :script } @@ -30,7 +30,7 @@ describe Chef::Resource::Script do end describe "when it has interpreter and flags" do - before do + before do script_resource.command("grep") script_resource.interpreter("gcc") script_resource.flags("-al") @@ -40,7 +40,7 @@ describe Chef::Resource::Script do script_resource.identity.should == "grep" end end - + it_behaves_like "a script resource" end diff --git a/spec/unit/resource/service_spec.rb b/spec/unit/resource/service_spec.rb index c06eb9dd77..067fa7d0d3 100644 --- a/spec/unit/resource/service_spec.rb +++ b/spec/unit/resource/service_spec.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,7 +23,7 @@ describe Chef::Resource::Service do before(:each) do @resource = Chef::Resource::Service.new("chef") - end + end it "should create a new Chef::Resource::Service" do @resource.should be_a_kind_of(Chef::Resource) @@ -42,7 +42,7 @@ describe Chef::Resource::Service do @resource.service_name "something" @resource.service_name.should eql("something") end - + it "should accept a string for the service pattern" do @resource.pattern ".*" @resource.pattern.should eql(".*") @@ -53,7 +53,7 @@ describe Chef::Resource::Service do @resource.pattern /.*/ }.should raise_error(ArgumentError) end - + it "should accept a string for the service start command" do @resource.start_command "/etc/init.d/chef start" @resource.start_command.should eql("/etc/init.d/chef start") @@ -64,7 +64,7 @@ describe Chef::Resource::Service do @resource.start_command /.*/ }.should raise_error(ArgumentError) end - + it "should accept a string for the service stop command" do @resource.stop_command "/etc/init.d/chef stop" @resource.stop_command.should eql("/etc/init.d/chef stop") @@ -75,23 +75,23 @@ describe Chef::Resource::Service do @resource.stop_command /.*/ }.should raise_error(ArgumentError) end - + it "should accept a string for the service status command" do @resource.status_command "/etc/init.d/chef status" @resource.status_command.should eql("/etc/init.d/chef status") end - + it "should not accept a regexp for the service status command" do lambda { @resource.status_command /.*/ }.should raise_error(ArgumentError) end - + it "should accept a string for the service restart command" do @resource.restart_command "/etc/init.d/chef restart" @resource.restart_command.should eql("/etc/init.d/chef restart") end - + it "should not accept a regexp for the service restart command" do lambda { @resource.restart_command /.*/ @@ -102,13 +102,13 @@ describe Chef::Resource::Service do @resource.reload_command "/etc/init.d/chef reload" @resource.reload_command.should eql("/etc/init.d/chef reload") end - + it "should not accept a regexp for the service reload command" do lambda { @resource.reload_command /.*/ }.should raise_error(ArgumentError) end - + it "should accept a string for the service init command" do @resource.init_command "/etc/init.d/chef" @resource.init_command.should eql("/etc/init.d/chef") @@ -122,15 +122,15 @@ describe Chef::Resource::Service do %w{enabled running}.each do |attrib| it "should accept true for #{attrib}" do - @resource.send(attrib, true) + @resource.send(attrib, true) @resource.send(attrib).should eql(true) end - + it "should accept false for #{attrib}" do @resource.send(attrib, false) @resource.send(attrib).should eql(false) end - + it "should not accept a string for #{attrib}" do lambda { @resource.send(attrib, "poop") }.should raise_error(ArgumentError) end @@ -138,7 +138,7 @@ describe Chef::Resource::Service do it "should default all the feature support to false" do support_hash = { :status => false, :restart => false, :reload=> false } @resource.supports.should == support_hash - end + end it "should allow you to set what features this resource supports as a array" do support_array = [ :status, :restart ] @@ -155,7 +155,7 @@ describe Chef::Resource::Service do end describe "when it has pattern and supports" do - before do + before do @resource.service_name("superfriend") @resource.enabled(true) @resource.running(false) @@ -172,5 +172,5 @@ describe Chef::Resource::Service do end end - + end diff --git a/spec/unit/resource/smartos_package_spec.rb b/spec/unit/resource/smartos_package_spec.rb index ca815320ad..4898311bf0 100644 --- a/spec/unit/resource/smartos_package_spec.rb +++ b/spec/unit/resource/smartos_package_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/resource/subversion_spec.rb b/spec/unit/resource/subversion_spec.rb index 650eb010a6..67593c5a7c 100644 --- a/spec/unit/resource/subversion_spec.rb +++ b/spec/unit/resource/subversion_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,20 +19,20 @@ require 'spec_helper' describe Chef::Resource::Subversion do - + before do @svn = Chef::Resource::Subversion.new("ohai, svn project!") end - + it "is a subclass of Resource::Scm" do @svn.should be_an_instance_of(Chef::Resource::Subversion) @svn.should be_a_kind_of(Chef::Resource::Scm) end - + it "uses the subversion provider" do @svn.provider.should eql(Chef::Provider::Subversion) end - + it "allows the force_export action" do @svn.allowed_actions.should include(:force_export) end diff --git a/spec/unit/resource/timestamped_deploy_spec.rb b/spec/unit/resource/timestamped_deploy_spec.rb index 89b881830a..f380ffca87 100644 --- a/spec/unit/resource/timestamped_deploy_spec.rb +++ b/spec/unit/resource/timestamped_deploy_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,10 +19,10 @@ require 'spec_helper' describe Chef::Resource::TimestampedDeploy do - + it "defaults to the TimestampedDeploy provider" do @resource = Chef::Resource::TimestampedDeploy.new("stuff") @resource.provider.should == Chef::Provider::Deploy::Timestamped end - + end diff --git a/spec/unit/resource/user_spec.rb b/spec/unit/resource/user_spec.rb index 3454152367..caf12aa416 100644 --- a/spec/unit/resource/user_spec.rb +++ b/spec/unit/resource/user_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,7 +21,7 @@ require 'spec_helper' describe Chef::Resource::User, "initialize" do before(:each) do @resource = Chef::Resource::User.new("adam") - end + end it "should create a new Chef::Resource::User" do @resource.should be_a_kind_of(Chef::Resource) @@ -31,29 +31,29 @@ describe Chef::Resource::User, "initialize" do it "should set the resource_name to :user" do @resource.resource_name.should eql(:user) end - + it "should set the username equal to the argument to initialize" do @resource.username.should eql("adam") end - + %w{comment uid gid home shell password}.each do |attrib| it "should set #{attrib} to nil" do @resource.send(attrib).should eql(nil) end end - + it "should set action to :create" do @resource.action.should eql(:create) end - + it "should set supports[:manage_home] to false" do @resource.supports[:manage_home].should eql(false) end - + it "should set supports[:non_unique] to false" do @resource.supports[:non_unique].should eql(false) end - + %w{create remove modify manage lock unlock}.each do |action| it "should allow action #{action}" do @resource.allowed_actions.detect { |a| a == action.to_sym }.should eql(action.to_sym) @@ -72,7 +72,7 @@ end describe Chef::Resource::User, attrib do before(:each) do @resource = Chef::Resource::User.new("adam") - end + end it "should allow a string" do @resource.send(attrib, "adam") @@ -89,13 +89,13 @@ end describe Chef::Resource::User, attrib do before(:each) do @resource = Chef::Resource::User.new("adam") - end + end it "should allow a string" do @resource.send(attrib, "100") @resource.send(attrib).should eql("100") end - + it "should allow an integer" do @resource.send(attrib, 100) @resource.send(attrib).should eql(100) @@ -105,7 +105,7 @@ end lambda { @resource.send(attrib, { :woot => "i found it" }) }.should raise_error(ArgumentError) end end - + describe "when it has uid, gid, and home" do before do @resource = Chef::Resource::User.new("root") diff --git a/spec/unit/resource/yum_package_spec.rb b/spec/unit/resource/yum_package_spec.rb index a0f4aaee55..783a539eb2 100644 --- a/spec/unit/resource/yum_package_spec.rb +++ b/spec/unit/resource/yum_package_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,19 +19,19 @@ require 'spec_helper' describe Chef::Resource::YumPackage, "initialize" do - + before(:each) do @resource = Chef::Resource::YumPackage.new("foo") end - + it "should return a Chef::Resource::YumPackage" do @resource.should be_a_kind_of(Chef::Resource::YumPackage) end - + it "should set the resource_name to :yum_package" do @resource.resource_name.should eql(:yum_package) end - + it "should set the provider to Chef::Provider::Package::Yum" do @resource.provider.should eql(Chef::Provider::Package::Yum) end @@ -56,7 +56,7 @@ describe Chef::Resource::YumPackage, "flush_cache" do it "should default the flush timing to false" do flush_hash = { :before => false, :after => false } @resource.flush_cache.should == flush_hash - end + end it "should allow you to set the flush timing with an array" do flush_array = [ :before, :after ] diff --git a/spec/unit/resource_collection/stepable_iterator_spec.rb b/spec/unit/resource_collection/stepable_iterator_spec.rb index 1da9de20cc..b649f8be6e 100644 --- a/spec/unit/resource_collection/stepable_iterator_spec.rb +++ b/spec/unit/resource_collection/stepable_iterator_spec.rb @@ -5,9 +5,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,17 +19,17 @@ require 'spec_helper' describe Chef::ResourceCollection::StepableIterator do CRSI = Chef::ResourceCollection::StepableIterator - + it "has an empty array for its collection by default" do CRSI.new.collection.should == [] end - + describe "doing basic iteration" do before do @simple_collection = [1,2,3,4] @iterator = CRSI.for_collection(@simple_collection) end - + it "re-initializes the instance with a collection" do @iterator.collection.should equal(@simple_collection) @iterator.size.should == 4 @@ -51,7 +51,7 @@ describe Chef::ResourceCollection::StepableIterator do collected_by_index.should == @simple_collection collected_by_index.should_not equal(@simple_collection) end - + it "iterates over the collection with index and element" do collected = {} @iterator.each_with_index do |element, index| @@ -59,32 +59,32 @@ describe Chef::ResourceCollection::StepableIterator do end collected.should == {0=>1, 1=>2, 2=>3, 3=>4} end - + end - + describe "pausing and resuming iteration" do - + before do @collection = [] @snitch_var = nil @collection << lambda { @snitch_var = 23 } @collection << lambda { @iterator.pause } @collection << lambda { @snitch_var = 42 } - + @iterator = CRSI.for_collection(@collection) @iterator.each { |proc| proc.call } end - + it "allows the iteration to be paused" do @snitch_var.should == 23 end - + it "allows the iteration to be resumed" do @snitch_var.should == 23 @iterator.resume @snitch_var.should == 42 end - + it "allows iteration to be rewound" do @iterator.skip_back(2) @iterator.resume @@ -92,13 +92,13 @@ describe Chef::ResourceCollection::StepableIterator do @iterator.resume @snitch_var.should == 42 end - + it "allows iteration to be fast forwarded" do @iterator.skip_forward @iterator.resume @snitch_var.should == 23 end - + it "allows iteration to be rewound" do @snitch_var = nil @iterator.rewind @@ -106,7 +106,7 @@ describe Chef::ResourceCollection::StepableIterator do @iterator.resume @snitch_var.should == 23 end - + it "allows iteration to be stepped" do @snitch_var = nil @iterator.rewind @@ -114,13 +114,13 @@ describe Chef::ResourceCollection::StepableIterator do @iterator.position.should == 1 @snitch_var.should == 23 end - + it "doesn't step if there are no more steps" do @iterator.step.should == 3 lambda {@iterator.step}.should_not raise_error @iterator.step.should be_nil end - + it "allows the iteration to start by being stepped" do @snitch_var = nil @iterator = CRSI.for_collection(@collection) @@ -129,7 +129,7 @@ describe Chef::ResourceCollection::StepableIterator do @iterator.position.should == 1 @snitch_var.should == 23 end - + it "should work correctly when elements are added to the collection during iteration" do @collection.insert(2, lambda { @snitch_var = 815}) @collection.insert(3, lambda { @iterator.pause }) @@ -138,7 +138,7 @@ describe Chef::ResourceCollection::StepableIterator do @iterator.resume @snitch_var.should == 42 end - + end - + end diff --git a/spec/unit/resource_definition_spec.rb b/spec/unit/resource_definition_spec.rb index a29c15a1e3..abac4c1163 100644 --- a/spec/unit/resource_definition_spec.rb +++ b/spec/unit/resource_definition_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,16 +22,16 @@ describe Chef::ResourceDefinition do before(:each) do @def = Chef::ResourceDefinition.new() end - + describe "initialize" do it "should be a Chef::ResourceDefinition" do @def.should be_a_kind_of(Chef::ResourceDefinition) end - + it "should not initialize a new node if one is not provided" do @def.node.should eql(nil) end - + it "should accept a node as an argument" do node = Chef::Node.new node.name("bobo") @@ -39,7 +39,7 @@ describe Chef::ResourceDefinition do @def.node.name.should == "bobo" end end - + describe "node" do it "should set the node with node=" do node = Chef::Node.new @@ -47,32 +47,32 @@ describe Chef::ResourceDefinition do @def.node = node @def.node.name.should == "bobo" end - + it "should return the node" do @def.node = Chef::Node.new @def.node.should be_a_kind_of(Chef::Node) end end - + it "should accept a new definition with a symbol for a name" do - lambda { - @def.define :smoke do + lambda { + @def.define :smoke do end }.should_not raise_error(ArgumentError) - lambda { + lambda { @def.define "george washington" do - end + end }.should raise_error(ArgumentError) @def.name.should eql(:smoke) end - + it "should accept a new definition with a hash" do - lambda { + lambda { @def.define :smoke, :cigar => "cuban", :cigarette => "marlboro" do end }.should_not raise_error(ArgumentError) end - + it "should expose the prototype hash params in the params hash" do @def.define :smoke, :cigar => "cuban", :cigarette => "marlboro" do; end @def.params[:cigar].should eql("cuban") @@ -86,34 +86,34 @@ describe Chef::ResourceDefinition do @def.recipe.should be_a_kind_of(Proc) @def.recipe.call.should eql("I am what I am") end - + it "should set paramaters based on method_missing" do @def.mind "to fly" @def.params[:mind].should eql("to fly") end - + it "should raise an exception if prototype_params is not a hash" do lambda { @def.define :monkey, Array.new do end }.should raise_error(ArgumentError) end - + it "should raise an exception if define is called without a block" do - lambda { + lambda { @def.define :monkey }.should raise_error(ArgumentError) end - + it "should load a description from a file" do @def.from_file(File.join(CHEF_SPEC_DATA, "definitions", "test.rb")) @def.name.should eql(:rico_suave) @def.params[:rich].should eql("smooth") - end - + end + it "should turn itself into a string based on the name with to_s" do @def.name = :woot @def.to_s.should eql("woot") end - + end diff --git a/spec/unit/run_context/cookbook_compiler_spec.rb b/spec/unit/run_context/cookbook_compiler_spec.rb index fe6bef5618..52f4772206 100644 --- a/spec/unit/run_context/cookbook_compiler_spec.rb +++ b/spec/unit/run_context/cookbook_compiler_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -162,7 +162,7 @@ describe Chef::RunContext::CookbookCompiler do # Tests for this behavior are in RunContext's tests end - describe "listing cookbook order" do + describe "listing cookbook order" do it "should return an array of cookbook names as symbols without duplicates" do node.run_list("test-with-circular-deps::default", "circular-dep1::default", "circular-dep2::default") diff --git a/spec/unit/run_context_spec.rb b/spec/unit/run_context_spec.rb index d75d6628bb..8063dffc77 100644 --- a/spec/unit/run_context_spec.rb +++ b/spec/unit/run_context_spec.rb @@ -8,9 +8,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spec/unit/run_list/run_list_item_spec.rb b/spec/unit/run_list/run_list_item_spec.rb index 62a17aa761..6b9de713da 100644 --- a/spec/unit/run_list/run_list_item_spec.rb +++ b/spec/unit/run_list/run_list_item_spec.rb @@ -101,7 +101,7 @@ describe Chef::RunList::RunListItem do item2 = Chef::RunList::RunListItem.new('recipe[lobsterragefist]') item1.should_not == item2 end - + it "is not equal to another run list item with the same name and type but different version" do item1 = Chef::RunList::RunListItem.new('recipe[lrf,0.1.0]') item2 = Chef::RunList::RunListItem.new('recipe[lrf,0.2.0]') diff --git a/spec/unit/scan_access_control_spec.rb b/spec/unit/scan_access_control_spec.rb index c83a552626..3cfecfaa35 100644 --- a/spec/unit/scan_access_control_spec.rb +++ b/spec/unit/scan_access_control_spec.rb @@ -69,7 +69,7 @@ describe Chef::ScanAccessControl do it "sets the group of the current resource to the current group as a String" do @current_resource.group.should == Etc.getgrgid(0).name end - + it "sets the owner of the current resource to the current owner as a String" do @current_resource.user.should == "root" end @@ -79,7 +79,7 @@ describe Chef::ScanAccessControl do it "sets the group of the current resource to the current group as a String" do @current_resource.group.should == 0 end - + it "sets the owner of the current resource to the current owner as a String" do @current_resource.user.should == 0 end diff --git a/spec/unit/search/query_spec.rb b/spec/unit/search/query_spec.rb index e32bed697c..3f41c142ee 100644 --- a/spec/unit/search/query_spec.rb +++ b/spec/unit/search/query_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,7 +19,7 @@ require 'spec_helper' require 'chef/search/query' -describe Chef::Search::Query do +describe Chef::Search::Query do before(:each) do @rest = mock("Chef::REST") Chef::REST.stub!(:new).and_return(@rest) diff --git a/spec/unit/version/platform_spec.rb b/spec/unit/version/platform_spec.rb index 6245800f9d..8b5b3503dc 100644 --- a/spec/unit/version/platform_spec.rb +++ b/spec/unit/version/platform_spec.rb @@ -5,9 +5,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,7 +28,7 @@ describe Chef::Version::Platform do it "should transform 1 to 1.0.0" do Chef::Version::Platform.new("1").to_s.should == "1.0.0" end - + describe "when creating valid Versions" do good_versions = %w(1 1.2 1.2.3 1000.80.50000 0.300.25 001.02.00003) good_versions.each do |v| diff --git a/spec/unit/version_class_spec.rb b/spec/unit/version_class_spec.rb index 285588b031..b0fcfbb3fb 100644 --- a/spec/unit/version_class_spec.rb +++ b/spec/unit/version_class_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,12 +28,12 @@ describe Chef::Version do @v0.to_s.should == "0.0.0" @v123.to_s.should == "1.2.3" end - + it "should make a round trip with its string representation" do a = Chef::Version.new(@v123.to_s) a.should == @v123 end - + it "should transform 1.2 to 1.2.0" do Chef::Version.new("1.2").to_s.should == "1.2.0" end @@ -118,7 +118,7 @@ describe Chef::Version do end describe "comparison examples" do - [ + [ [ "0.0.0", :>, "0.0.0", false ], [ "0.0.0", :>=, "0.0.0", true ], [ "0.0.0", :==, "0.0.0", true ], diff --git a/spec/unit/version_constraint/platform_spec.rb b/spec/unit/version_constraint/platform_spec.rb index a7749102f0..a3599aeb96 100644 --- a/spec/unit/version_constraint/platform_spec.rb +++ b/spec/unit/version_constraint/platform_spec.rb @@ -5,9 +5,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |