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/unit/platform_spec.rb | |
parent | 61e98b94fb387353841d5b4575816a1d716cfbc9 (diff) | |
download | chef-6315871ae7deeead95d84d2487c54a03c47e318f.tar.gz |
Normalize whitespace on all files
Diffstat (limited to 'spec/unit/platform_spec.rb')
-rw-r--r-- | spec/unit/platform_spec.rb | 70 |
1 files changed, 35 insertions, 35 deletions
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 |