diff options
Diffstat (limited to 'spec/unit/dsl/platform_introspection_spec.rb')
-rw-r--r-- | spec/unit/dsl/platform_introspection_spec.rb | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/spec/unit/dsl/platform_introspection_spec.rb b/spec/unit/dsl/platform_introspection_spec.rb index fd1f9b23b5..51123ba930 100644 --- a/spec/unit/dsl/platform_introspection_spec.rb +++ b/spec/unit/dsl/platform_introspection_spec.rb @@ -39,8 +39,8 @@ end describe Chef::DSL::PlatformIntrospection::PlatformDependentValue do before do platform_hash = { - :openbsd => { :default => "free, functional, secure" }, - [:redhat, :centos, :fedora, :scientific] => { :default => '"stable"' }, + :openbsd => { default: "free, functional, secure" }, + [:redhat, :centos, :fedora, :scientific] => { default: '"stable"' }, :ubuntu => { "10.04" => "using upstart more", :default => "using init more" }, :default => "bork da bork", } @@ -48,24 +48,24 @@ describe Chef::DSL::PlatformIntrospection::PlatformDependentValue do end it "returns the default value when the platform doesn't match" do - expect(@platform_specific_value.value_for_node(:platform => :dos)).to eq("bork da bork") + expect(@platform_specific_value.value_for_node(platform: :dos)).to eq("bork da bork") end it "returns a value for a platform set as a group" do - expect(@platform_specific_value.value_for_node(:platform => :centos)).to eq('"stable"') + expect(@platform_specific_value.value_for_node(platform: :centos)).to eq('"stable"') end it "returns a value for the platform when it was set as a symbol but fetched as a string" do - expect(@platform_specific_value.value_for_node(:platform => "centos")).to eq('"stable"') + expect(@platform_specific_value.value_for_node(platform: "centos")).to eq('"stable"') end it "returns a value for a specific platform version" do - node = { :platform => "ubuntu", :platform_version => "10.04" } + node = { platform: "ubuntu", platform_version: "10.04" } expect(@platform_specific_value.value_for_node(node)).to eq("using upstart more") end it "returns a platform-default value if the platform version doesn't match an explicit one" do - node = { :platform => "ubuntu", :platform_version => "9.10" } + node = { platform: "ubuntu", platform_version: "9.10" } expect(@platform_specific_value.value_for_node(node)).to eq("using init more") end @@ -73,11 +73,11 @@ describe Chef::DSL::PlatformIntrospection::PlatformDependentValue do # this matches the behavior in the original implementation. # whether or not it's correct is another matter. platform_specific_value = Chef::DSL::PlatformIntrospection::PlatformDependentValue.new({}) - expect(platform_specific_value.value_for_node(:platform => "foo")).to be_nil + expect(platform_specific_value.value_for_node(platform: "foo")).to be_nil end it "raises an argument error if the platform hash is not correctly structured" do - bad_hash = { :ubuntu => :foo } # should be :ubuntu => {:default => 'foo'} + bad_hash = { ubuntu: :foo } # should be :ubuntu => {:default => 'foo'} expect { Chef::DSL::PlatformIntrospection::PlatformDependentValue.new(bad_hash) }.to raise_error(ArgumentError) end @@ -98,32 +98,32 @@ describe Chef::DSL::PlatformIntrospection::PlatformFamilyDependentValue do end it "returns the default value when the platform family doesn't match" do - expect(@platform_family_value.value_for_node(:platform_family => :os2)).to eq("default value") + expect(@platform_family_value.value_for_node(platform_family: :os2)).to eq("default value") end it "returns a value for the platform family when it was set as a string but fetched as a symbol" do - expect(@platform_family_value.value_for_node(:platform_family => :debian)).to eq("debian value") + expect(@platform_family_value.value_for_node(platform_family: :debian)).to eq("debian value") end it "returns a value for the platform family when it was set as a symbol but fetched as a string" do - expect(@platform_family_value.value_for_node(:platform_family => "gentoo")).to eq("gentoo value") + expect(@platform_family_value.value_for_node(platform_family: "gentoo")).to eq("gentoo value") end it "returns an array value stored for a platform family" do - expect(@platform_family_value.value_for_node(:platform_family => "suse")).to eq(@array_values) + expect(@platform_family_value.value_for_node(platform_family: "suse")).to eq(@array_values) end it "returns a value for the platform family when it was set within an array hash key as a symbol" do - expect(@platform_family_value.value_for_node(:platform_family => :rhel)).to eq("redhatty value") + expect(@platform_family_value.value_for_node(platform_family: :rhel)).to eq("redhatty value") end it "returns a value for the platform family when it was set within an array hash key as a string" do - expect(@platform_family_value.value_for_node(:platform_family => "fedora")).to eq("redhatty value") + expect(@platform_family_value.value_for_node(platform_family: "fedora")).to eq("redhatty value") end it "returns nil if there is no default and no platforms match" do platform_specific_value = Chef::DSL::PlatformIntrospection::PlatformFamilyDependentValue.new({}) - expect(platform_specific_value.value_for_node(:platform_family => "foo")).to be_nil + expect(platform_specific_value.value_for_node(platform_family: "foo")).to be_nil end end |