summaryrefslogtreecommitdiff
path: root/spec/functional/resource/registry_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/functional/resource/registry_spec.rb')
-rw-r--r--spec/functional/resource/registry_spec.rb182
1 files changed, 91 insertions, 91 deletions
diff --git a/spec/functional/resource/registry_spec.rb b/spec/functional/resource/registry_spec.rb
index 2d24eee6a3..d3120ac77c 100644
--- a/spec/functional/resource/registry_spec.rb
+++ b/spec/functional/resource/registry_spec.rb
@@ -35,12 +35,12 @@ describe Chef::Resource::RegistryKey, :unix_only do
it "throws an exception because you don't have a windows registry (derp)" do
@resource.key("HKCU\\Software\\Opscode")
@resource.values([{:name=>"Color", :type=>:string, :data=>"Orange"}])
- lambda{@resource.run_action(:create)}.should raise_error(Chef::Exceptions::Win32NotWindows)
+ expect{@resource.run_action(:create)}.to raise_error(Chef::Exceptions::Win32NotWindows)
end
end
end
-describe Chef::Resource::RegistryKey, :windows_only do
+describe Chef::Resource::RegistryKey, :windows_only, :pending => "Refactor helper methods" do
# parent and key must be single keys, not paths
let(:parent) { 'Opscode' }
@@ -112,9 +112,9 @@ describe Chef::Resource::RegistryKey, :windows_only do
@node.name("windowsbox")
@rest_client = double("Chef::REST (mock)")
- @rest_client.stub(:create_url).and_return("reports/nodes/windowsbox/runs/#{@run_id}");
- @rest_client.stub(:raw_http_request).and_return({"result"=>"ok"});
- @rest_client.stub(:post_rest).and_return({"uri"=>"https://example.com/reports/nodes/windowsbox/runs/#{@run_id}"});
+ allow(@rest_client).to receive(:create_url).and_return("reports/nodes/windowsbox/runs/#{@run_id}");
+ allow(@rest_client).to receive(:raw_http_request).and_return({"result"=>"ok"});
+ allow(@rest_client).to receive(:post_rest).and_return({"uri"=>"https://example.com/reports/nodes/windowsbox/runs/#{@run_id}"});
@resource_reporter = Chef::ResourceReporter.new(@rest_client)
@events.register(@resource_reporter)
@@ -125,7 +125,7 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.cookbook_name = "monkey"
@cookbook_version = double("Cookbook::Version", :version => "1.2.3")
- @new_resource.stub(:cookbook_version).and_return(@cookbook_version)
+ allow(@new_resource).to receive(:cookbook_version).and_return(@cookbook_version)
end
after (:all) do
@@ -141,8 +141,8 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.values([{:name=>"Color", :type=>:string, :data=>"Orange"}])
@new_resource.run_action(:create)
- @registry.key_exists?(reg_child).should == true
- @registry.data_exists?(reg_child, {:name=>"Color", :type=>:string, :data=>"Orange"}).should == true
+ expect(@registry.key_exists?(reg_child)).to eq(true)
+ expect(@registry.data_exists?(reg_child, {:name=>"Color", :type=>:string, :data=>"Orange"})).to eq(true)
end
it "does not create the key if it already exists with same value, type and data" do
@@ -150,8 +150,8 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.values([{:name=>"Color", :type=>:string, :data=>"Orange"}])
@new_resource.run_action(:create)
- @registry.key_exists?(reg_child).should == true
- @registry.data_exists?(reg_child, {:name=>"Color", :type=>:string, :data=>"Orange"}).should == true
+ expect(@registry.key_exists?(reg_child)).to eq(true)
+ expect(@registry.data_exists?(reg_child, {:name=>"Color", :type=>:string, :data=>"Orange"})).to eq(true)
end
it "creates a value if it does not exist" do
@@ -159,7 +159,7 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.values([{:name=>"Mango", :type=>:string, :data=>"Yellow"}])
@new_resource.run_action(:create)
- @registry.data_exists?(reg_child, {:name=>"Mango", :type=>:string, :data=>"Yellow"}).should == true
+ expect(@registry.data_exists?(reg_child, {:name=>"Mango", :type=>:string, :data=>"Yellow"})).to eq(true)
end
it "modifies the data if the key and value exist and type matches" do
@@ -167,7 +167,7 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.values([{:name=>"Color", :type=>:string, :data=>"Not just Orange - OpscodeOrange!"}])
@new_resource.run_action(:create)
- @registry.data_exists?(reg_child, {:name=>"Color", :type=>:string, :data=>"Not just Orange - OpscodeOrange!"}).should == true
+ expect(@registry.data_exists?(reg_child, {:name=>"Color", :type=>:string, :data=>"Not just Orange - OpscodeOrange!"})).to eq(true)
end
it "modifys the type if the key and value exist and the type does not match" do
@@ -175,7 +175,7 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.values([{:name=>"Color", :type=>:multi_string, :data=>["Not just Orange - OpscodeOrange!"]}])
@new_resource.run_action(:create)
- @registry.data_exists?(reg_child, {:name=>"Color", :type=>:multi_string, :data=>["Not just Orange - OpscodeOrange!"]}).should == true
+ expect(@registry.data_exists?(reg_child, {:name=>"Color", :type=>:multi_string, :data=>["Not just Orange - OpscodeOrange!"]})).to eq(true)
end
it "creates subkey if parent exists" do
@@ -184,15 +184,15 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.recursive(false)
@new_resource.run_action(:create)
- @registry.key_exists?(reg_child + '\OpscodeTest').should == true
- @registry.value_exists?(reg_child + '\OpscodeTest', {:name=>"Chef", :type=>:multi_string, :data=>["OpscodeOrange", "Rules"]}).should == true
+ expect(@registry.key_exists?(reg_child + '\OpscodeTest')).to eq(true)
+ expect(@registry.value_exists?(reg_child + '\OpscodeTest', {:name=>"Chef", :type=>:multi_string, :data=>["OpscodeOrange", "Rules"]})).to eq(true)
end
it "gives error if action create and parent does not exist and recursive is set to false" do
@new_resource.key(reg_child + '\Missing1\Missing2')
@new_resource.values([{:name=>"OC", :type=>:string, :data=>"MissingData"}])
@new_resource.recursive(false)
- lambda{@new_resource.run_action(:create)}.should raise_error(Chef::Exceptions::Win32RegNoRecursive)
+ expect{@new_resource.run_action(:create)}.to raise_error(Chef::Exceptions::Win32RegNoRecursive)
end
it "creates missing keys if action create and parent does not exist and recursive is set to true" do
@@ -201,8 +201,8 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.recursive(true)
@new_resource.run_action(:create)
- @registry.key_exists?(reg_child + '\Missing1\Missing2').should == true
- @registry.value_exists?(reg_child + '\Missing1\Missing2', {:name=>"OC", :type=>:string, :data=>"MissingData"}).should == true
+ expect(@registry.key_exists?(reg_child + '\Missing1\Missing2')).to eq(true)
+ expect(@registry.value_exists?(reg_child + '\Missing1\Missing2', {:name=>"OC", :type=>:string, :data=>"MissingData"})).to eq(true)
end
it "creates key with multiple value as specified" do
@@ -212,7 +212,7 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.run_action(:create)
@new_resource.values.each do |value|
- @registry.value_exists?(reg_child, value).should == true
+ expect(@registry.value_exists?(reg_child, value)).to eq(true)
end
end
@@ -231,9 +231,9 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.architecture(:i386)
@new_resource.run_action(:create)
@registry.architecture = :i386
- @registry.data_exists?(reg_child + '\Atraxi', {:name=>"OC", :type=>:string, :data=>"Data"}).should == true
+ expect(@registry.data_exists?(reg_child + '\Atraxi', {:name=>"OC", :type=>:string, :data=>"Data"})).to eq(true)
@registry.architecture = :x86_64
- @registry.key_exists?(reg_child + '\Atraxi').should == false
+ expect(@registry.key_exists?(reg_child + '\Atraxi')).to eq(false)
end
end
@@ -244,16 +244,16 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.run_action(:create)
@report = @resource_reporter.prepare_run_data
- @report["action"].should == "end"
- @report["resources"][0]["type"].should == "registry_key"
- @report["resources"][0]["name"].should == resource_name
- @report["resources"][0]["id"].should == reg_child + '\Ood'
- @report["resources"][0]["after"][:values].should == [{:name=>"ReportingVal1", :type=>:string, :data=>"report1"},
- {:name=>"ReportingVal2", :type=>:string, :data=>"report2"}]
- @report["resources"][0]["before"][:values].should == []
- @report["resources"][0]["result"].should == "create"
- @report["status"].should == "success"
- @report["total_res_count"].should == "1"
+ expect(@report["action"]).to eq("end")
+ expect(@report["resources"][0]["type"]).to eq("registry_key")
+ expect(@report["resources"][0]["name"]).to eq(resource_name)
+ expect(@report["resources"][0]["id"]).to eq(reg_child + '\Ood')
+ expect(@report["resources"][0]["after"][:values]).to eq([{:name=>"ReportingVal1", :type=>:string, :data=>"report1"},
+ {:name=>"ReportingVal2", :type=>:string, :data=>"report2"}])
+ expect(@report["resources"][0]["before"][:values]).to eq([])
+ expect(@report["resources"][0]["result"]).to eq("create")
+ expect(@report["status"]).to eq("success")
+ expect(@report["total_res_count"]).to eq("1")
end
context "while running in whyrun mode" do
@@ -266,15 +266,15 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.values([{:name=>"BriskWalk",:type=>:string,:data=>"is good for health"}])
@new_resource.recursive(false)
@new_resource.run_action(:create) # should not raise_error
- @registry.key_exists?(reg_child + '\Slitheen').should == false
- @registry.key_exists?(reg_child + '\Slitheen\Raxicoricofallapatorius').should == false
+ expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false)
+ expect(@registry.key_exists?(reg_child + '\Slitheen\Raxicoricofallapatorius')).to eq(false)
end
it "does not create key if the action is create" do
@new_resource.key(reg_child + '\Slitheen')
@new_resource.values([{:name=>"BriskWalk",:type=>:string,:data=>"is good for health"}])
@new_resource.recursive(false)
@new_resource.run_action(:create)
- @registry.key_exists?(reg_child + '\Slitheen').should == false
+ expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false)
end
end
end
@@ -289,9 +289,9 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.values([{:name=>"Color", :type=>:string, :data=>"Orange"}])
@new_resource.run_action(:create_if_missing)
- @registry.key_exists?(reg_parent).should == true
- @registry.key_exists?(reg_child).should == true
- @registry.data_exists?(reg_child, {:name=>"Color", :type=>:string, :data=>"Orange"}).should == true
+ expect(@registry.key_exists?(reg_parent)).to eq(true)
+ expect(@registry.key_exists?(reg_child)).to eq(true)
+ expect(@registry.data_exists?(reg_child, {:name=>"Color", :type=>:string, :data=>"Orange"})).to eq(true)
end
it "does not create the key if it already exists with same value, type and data" do
@@ -299,8 +299,8 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.values([{:name=>"Color", :type=>:string, :data=>"Orange"}])
@new_resource.run_action(:create_if_missing)
- @registry.key_exists?(reg_child).should == true
- @registry.data_exists?(reg_child, {:name=>"Color", :type=>:string, :data=>"Orange"}).should == true
+ expect(@registry.key_exists?(reg_child)).to eq(true)
+ expect(@registry.data_exists?(reg_child, {:name=>"Color", :type=>:string, :data=>"Orange"})).to eq(true)
end
it "creates a value if it does not exist" do
@@ -308,7 +308,7 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.values([{:name=>"Mango", :type=>:string, :data=>"Yellow"}])
@new_resource.run_action(:create_if_missing)
- @registry.data_exists?(reg_child, {:name=>"Mango", :type=>:string, :data=>"Yellow"}).should == true
+ expect(@registry.data_exists?(reg_child, {:name=>"Mango", :type=>:string, :data=>"Yellow"})).to eq(true)
end
it "creates subkey if parent exists" do
@@ -317,15 +317,15 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.recursive(false)
@new_resource.run_action(:create_if_missing)
- @registry.key_exists?(reg_child + '\Pyrovile').should == true
- @registry.value_exists?(reg_child + '\Pyrovile', {:name=>"Chef", :type=>:multi_string, :data=>["OpscodeOrange", "Rules"]}).should == true
+ expect(@registry.key_exists?(reg_child + '\Pyrovile')).to eq(true)
+ expect(@registry.value_exists?(reg_child + '\Pyrovile', {:name=>"Chef", :type=>:multi_string, :data=>["OpscodeOrange", "Rules"]})).to eq(true)
end
it "gives error if action create and parent does not exist and recursive is set to false" do
@new_resource.key(reg_child + '\Sontaran\Sontar')
@new_resource.values([{:name=>"OC", :type=>:string, :data=>"MissingData"}])
@new_resource.recursive(false)
- lambda{@new_resource.run_action(:create_if_missing)}.should raise_error(Chef::Exceptions::Win32RegNoRecursive)
+ expect{@new_resource.run_action(:create_if_missing)}.to raise_error(Chef::Exceptions::Win32RegNoRecursive)
end
it "creates missing keys if action create and parent does not exist and recursive is set to true" do
@@ -334,8 +334,8 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.recursive(true)
@new_resource.run_action(:create_if_missing)
- @registry.key_exists?(reg_child + '\Sontaran\Sontar').should == true
- @registry.value_exists?(reg_child + '\Sontaran\Sontar', {:name=>"OC", :type=>:string, :data=>"MissingData"}).should == true
+ expect(@registry.key_exists?(reg_child + '\Sontaran\Sontar')).to eq(true)
+ expect(@registry.value_exists?(reg_child + '\Sontaran\Sontar', {:name=>"OC", :type=>:string, :data=>"MissingData"})).to eq(true)
end
it "creates key with multiple value as specified" do
@@ -345,7 +345,7 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.run_action(:create_if_missing)
@new_resource.values.each do |value|
- @registry.value_exists?(reg_child + '\Adipose', value).should == true
+ expect(@registry.value_exists?(reg_child + '\Adipose', value)).to eq(true)
end
end
@@ -356,15 +356,15 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.run_action(:create_if_missing)
@report = @resource_reporter.prepare_run_data
- @report["action"].should == "end"
- @report["resources"][0]["type"].should == "registry_key"
- @report["resources"][0]["name"].should == resource_name
- @report["resources"][0]["id"].should == reg_child + '\Judoon'
- @report["resources"][0]["after"][:values].should == [{:name=>"ReportingVal3", :type=>:string, :data=>"report3"}]
- @report["resources"][0]["before"][:values].should == []
- @report["resources"][0]["result"].should == "create_if_missing"
- @report["status"].should == "success"
- @report["total_res_count"].should == "1"
+ expect(@report["action"]).to eq("end")
+ expect(@report["resources"][0]["type"]).to eq("registry_key")
+ expect(@report["resources"][0]["name"]).to eq(resource_name)
+ expect(@report["resources"][0]["id"]).to eq(reg_child + '\Judoon')
+ expect(@report["resources"][0]["after"][:values]).to eq([{:name=>"ReportingVal3", :type=>:string, :data=>"report3"}])
+ expect(@report["resources"][0]["before"][:values]).to eq([])
+ expect(@report["resources"][0]["result"]).to eq("create_if_missing")
+ expect(@report["status"]).to eq("success")
+ expect(@report["total_res_count"]).to eq("1")
end
context "while running in whyrun mode" do
@@ -377,15 +377,15 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.values([{:name=>"BriskWalk",:type=>:string,:data=>"is good for health"}])
@new_resource.recursive(false)
@new_resource.run_action(:create_if_missing) # should not raise_error
- @registry.key_exists?(reg_child + '\Zygons').should == false
- @registry.key_exists?(reg_child + '\Zygons\Zygor').should == false
+ expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false)
+ expect(@registry.key_exists?(reg_child + '\Zygons\Zygor')).to eq(false)
end
it "does nothing if the action is create_if_missing" do
@new_resource.key(reg_child + '\Zygons')
@new_resource.values([{:name=>"BriskWalk",:type=>:string,:data=>"is good for health"}])
@new_resource.recursive(false)
@new_resource.run_action(:create_if_missing)
- @registry.key_exists?(reg_child + '\Zygons').should == false
+ expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false)
end
end
end
@@ -397,24 +397,24 @@ describe Chef::Resource::RegistryKey, :windows_only do
end
it "takes no action if the specified key path does not exist in the system" do
- @registry.key_exists?(reg_parent + '\Osirian').should == false
+ expect(@registry.key_exists?(reg_parent + '\Osirian')).to eq(false)
@new_resource.key(reg_parent+ '\Osirian')
@new_resource.recursive(false)
@new_resource.run_action(:delete)
- @registry.key_exists?(reg_parent + '\Osirian').should == false
+ expect(@registry.key_exists?(reg_parent + '\Osirian')).to eq(false)
end
it "takes no action if the key exists but the value does not" do
- @registry.data_exists?(reg_parent + '\Opscode', {:name=>"Color", :type=>:string, :data=>"Orange"}).should == true
+ expect(@registry.data_exists?(reg_parent + '\Opscode', {:name=>"Color", :type=>:string, :data=>"Orange"})).to eq(true)
@new_resource.key(reg_parent + '\Opscode')
@new_resource.values([{:name=>"LooksLike", :type=>:multi_string, :data=>["SeattleGrey", "OCOrange"]}])
@new_resource.recursive(false)
@new_resource.run_action(:delete)
- @registry.data_exists?(reg_parent + '\Opscode', {:name=>"Color", :type=>:string, :data=>"Orange"}).should == true
+ expect(@registry.data_exists?(reg_parent + '\Opscode', {:name=>"Color", :type=>:string, :data=>"Orange"})).to eq(true)
end
it "deletes only specified values under a key path" do
@@ -423,9 +423,9 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.recursive(false)
@new_resource.run_action(:delete)
- @registry.data_exists?(reg_parent + '\Opscode', {:name=>"Color", :type=>:string, :data=>"Orange"}).should == true
- @registry.value_exists?(reg_parent + '\Opscode', {:name=>"AKA", :type=>:string, :data=>"OC"}).should == false
- @registry.value_exists?(reg_parent + '\Opscode', {:name=>"Opscode", :type=>:multi_string, :data=>["Seattle", "Washington"]}).should == false
+ expect(@registry.data_exists?(reg_parent + '\Opscode', {:name=>"Color", :type=>:string, :data=>"Orange"})).to eq(true)
+ expect(@registry.value_exists?(reg_parent + '\Opscode', {:name=>"AKA", :type=>:string, :data=>"OC"})).to eq(false)
+ expect(@registry.value_exists?(reg_parent + '\Opscode', {:name=>"Opscode", :type=>:multi_string, :data=>["Seattle", "Washington"]})).to eq(false)
end
it "it deletes the values with the same name irrespective of it type and data" do
@@ -434,7 +434,7 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.recursive(false)
@new_resource.run_action(:delete)
- @registry.value_exists?(reg_parent + '\Opscode', {:name=>"Color", :type=>:string, :data=>"Orange"}).should == false
+ expect(@registry.value_exists?(reg_parent + '\Opscode', {:name=>"Color", :type=>:string, :data=>"Orange"})).to eq(false)
end
it "prepares the reporting data for action :delete" do
@@ -445,19 +445,19 @@ describe Chef::Resource::RegistryKey, :windows_only do
@report = @resource_reporter.prepare_run_data
- @registry.value_exists?(reg_parent + '\ReportKey', [{:name=>"ReportVal4", :type=>:string, :data=>"report4"},{:name=>"ReportVal5", :type=>:string, :data=>"report5"}]).should == false
+ expect(@registry.value_exists?(reg_parent + '\ReportKey', [{:name=>"ReportVal4", :type=>:string, :data=>"report4"},{:name=>"ReportVal5", :type=>:string, :data=>"report5"}])).to eq(false)
- @report["action"].should == "end"
- @report["resources"].count.should == 1
- @report["resources"][0]["type"].should == "registry_key"
- @report["resources"][0]["name"].should == resource_name
- @report["resources"][0]["id"].should == reg_parent + '\ReportKey'
- @report["resources"][0]["before"][:values].should == [{:name=>"ReportVal4", :type=>:string, :data=>"report4"},
- {:name=>"ReportVal5", :type=>:string, :data=>"report5"}]
+ expect(@report["action"]).to eq("end")
+ expect(@report["resources"].count).to eq(1)
+ expect(@report["resources"][0]["type"]).to eq("registry_key")
+ expect(@report["resources"][0]["name"]).to eq(resource_name)
+ expect(@report["resources"][0]["id"]).to eq(reg_parent + '\ReportKey')
+ expect(@report["resources"][0]["before"][:values]).to eq([{:name=>"ReportVal4", :type=>:string, :data=>"report4"},
+ {:name=>"ReportVal5", :type=>:string, :data=>"report5"}])
#Not testing for after values to match since after -> new_resource values.
- @report["resources"][0]["result"].should == "delete"
- @report["status"].should == "success"
- @report["total_res_count"].should == "1"
+ expect(@report["resources"][0]["result"]).to eq("delete")
+ expect(@report["status"]).to eq("success")
+ expect(@report["total_res_count"]).to eq("1")
end
context "while running in whyrun mode" do
@@ -470,7 +470,7 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.recursive(false)
@new_resource.run_action(:delete)
- @registry.key_exists?(reg_parent + '\OpscodeWhyRun').should == true
+ expect(@registry.key_exists?(reg_parent + '\OpscodeWhyRun')).to eq(true)
end
end
end
@@ -482,13 +482,13 @@ describe Chef::Resource::RegistryKey, :windows_only do
end
it "takes no action if the specified key path does not exist in the system" do
- @registry.key_exists?(reg_parent + '\Osirian').should == false
+ expect(@registry.key_exists?(reg_parent + '\Osirian')).to eq(false)
@new_resource.key(reg_parent + '\Osirian')
@new_resource.recursive(false)
@new_resource.run_action(:delete_key)
- @registry.key_exists?(reg_parent + '\Osirian').should == false
+ expect(@registry.key_exists?(reg_parent + '\Osirian')).to eq(false)
end
it "deletes key if it has no subkeys and recursive == false" do
@@ -496,13 +496,13 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.recursive(false)
@new_resource.run_action(:delete_key)
- @registry.key_exists?(reg_parent + '\OpscodeTest').should == false
+ expect(@registry.key_exists?(reg_parent + '\OpscodeTest')).to eq(false)
end
it "raises an exception if the key has subkeys and recursive == false" do
@new_resource.key(reg_parent)
@new_resource.recursive(false)
- lambda{@new_resource.run_action(:delete_key)}.should raise_error(Chef::Exceptions::Win32RegNoRecursive)
+ expect{@new_resource.run_action(:delete_key)}.to raise_error(Chef::Exceptions::Win32RegNoRecursive)
end
it "ignores the values under a key" do
@@ -517,7 +517,7 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.recursive(true)
@new_resource.run_action(:delete_key)
- @registry.key_exists?(reg_parent + '\Opscode').should == false
+ expect(@registry.key_exists?(reg_parent + '\Opscode')).to eq(false)
end
it "prepares the reporting data for action :delete_key" do
@@ -526,16 +526,16 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.run_action(:delete_key)
@report = @resource_reporter.prepare_run_data
- @report["action"].should == "end"
- @report["resources"][0]["type"].should == "registry_key"
- @report["resources"][0]["name"].should == resource_name
- @report["resources"][0]["id"].should == reg_parent + '\ReportKey'
+ expect(@report["action"]).to eq("end")
+ expect(@report["resources"][0]["type"]).to eq("registry_key")
+ expect(@report["resources"][0]["name"]).to eq(resource_name)
+ expect(@report["resources"][0]["id"]).to eq(reg_parent + '\ReportKey')
#Not testing for before or after values to match since
#after -> new_resource.values and
#before -> current_resource.values
- @report["resources"][0]["result"].should == "delete_key"
- @report["status"].should == "success"
- @report["total_res_count"].should == "1"
+ expect(@report["resources"][0]["result"]).to eq("delete_key")
+ expect(@report["status"]).to eq("success")
+ expect(@report["total_res_count"]).to eq("1")
end
context "while running in whyrun mode" do
before (:each) do
@@ -554,7 +554,7 @@ describe Chef::Resource::RegistryKey, :windows_only do
@new_resource.recursive(false)
@new_resource.run_action(:delete_key)
- @registry.key_exists?(reg_parent + '\OpscodeWhyRun').should == true
+ expect(@registry.key_exists?(reg_parent + '\OpscodeWhyRun')).to eq(true)
end
end
end