summaryrefslogtreecommitdiff
path: root/spec/functional/win32
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2014-10-29 15:14:22 -0700
committerClaire McQuin <claire@getchef.com>2014-10-29 15:59:04 -0700
commit5fed7a65a2f024d964ecf2de1bcf2911cf8a600c (patch)
tree14cc6968e4fe4fd2485c0211088b25c645a80a4b /spec/functional/win32
parentb92c309b0f1aa0837f76ab89d6c81c36076ceca9 (diff)
downloadchef-5fed7a65a2f024d964ecf2de1bcf2911cf8a600c.tar.gz
Update to RSpec 3.
Diffstat (limited to 'spec/functional/win32')
-rw-r--r--spec/functional/win32/registry_helper_spec.rb250
-rw-r--r--spec/functional/win32/security_spec.rb2
-rw-r--r--spec/functional/win32/service_manager_spec.rb56
-rw-r--r--spec/functional/win32/versions_spec.rb12
4 files changed, 160 insertions, 160 deletions
diff --git a/spec/functional/win32/registry_helper_spec.rb b/spec/functional/win32/registry_helper_spec.rb
index 830d6f4777..7b070e6fe1 100644
--- a/spec/functional/win32/registry_helper_spec.rb
+++ b/spec/functional/win32/registry_helper_spec.rb
@@ -34,7 +34,7 @@ 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
@@ -84,197 +84,197 @@ describe 'Chef::Win32::Registry', :windows_only do
describe "hive_exists?" do
it "returns true if the hive exists" do
- @registry.hive_exists?("HKCU\\Software\\Root").should == true
+ expect(@registry.hive_exists?("HKCU\\Software\\Root")).to eq(true)
end
it "returns false if the hive does not exist" do
- hive = @registry.hive_exists?("LYRU\\Software\\Root").should == false
+ hive = expect(@registry.hive_exists?("LYRU\\Software\\Root")).to eq(false)
end
end
describe "key_exists?" do
it "returns true if the key path exists" do
- @registry.key_exists?("HKCU\\Software\\Root\\Branch\\Flower").should == true
+ expect(@registry.key_exists?("HKCU\\Software\\Root\\Branch\\Flower")).to eq(true)
end
it "returns false if the key path does not exist" do
- @registry.key_exists?("HKCU\\Software\\Branch\\Flower").should == false
+ expect(@registry.key_exists?("HKCU\\Software\\Branch\\Flower")).to eq(false)
end
it "throws an exception if the hive does not exist" do
- lambda {@registry.key_exists?("JKLM\\Software\\Branch\\Flower")}.should raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect {@registry.key_exists?("JKLM\\Software\\Branch\\Flower")}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
end
describe "key_exists!" do
it "returns true if the key path exists" do
- @registry.key_exists!("HKCU\\Software\\Root\\Branch\\Flower").should == true
+ expect(@registry.key_exists!("HKCU\\Software\\Root\\Branch\\Flower")).to eq(true)
end
it "throws an exception if the key path does not exist" do
- lambda {@registry.key_exists!("HKCU\\Software\\Branch\\Flower")}.should raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect {@registry.key_exists!("HKCU\\Software\\Branch\\Flower")}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "throws an exception if the hive does not exist" do
- lambda {@registry.key_exists!("JKLM\\Software\\Branch\\Flower")}.should raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect {@registry.key_exists!("JKLM\\Software\\Branch\\Flower")}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
end
describe "value_exists?" do
it "throws an exception if the hive does not exist" do
- lambda {@registry.value_exists?("JKLM\\Software\\Branch\\Flower", {:name=>"Petals"})}.should raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect {@registry.value_exists?("JKLM\\Software\\Branch\\Flower", {:name=>"Petals"})}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
it "throws an exception if the key does not exist" do
- lambda {@registry.value_exists?("HKCU\\Software\\Branch\\Flower", {:name=>"Petals"})}.should raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect {@registry.value_exists?("HKCU\\Software\\Branch\\Flower", {:name=>"Petals"})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "returns true if the value exists" do
- @registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals"}).should == true
+ expect(@registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals"})).to eq(true)
end
it "returns false if the value does not exist" do
- @registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"FOOBAR"}).should == false
+ expect(@registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"FOOBAR"})).to eq(false)
end
end
describe "value_exists!" do
it "throws an exception if the hive does not exist" do
- lambda {@registry.value_exists!("JKLM\\Software\\Branch\\Flower", {:name=>"Petals"})}.should raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect {@registry.value_exists!("JKLM\\Software\\Branch\\Flower", {:name=>"Petals"})}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
it "throws an exception if the key does not exist" do
- lambda {@registry.value_exists!("HKCU\\Software\\Branch\\Flower", {:name=>"Petals"})}.should raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect {@registry.value_exists!("HKCU\\Software\\Branch\\Flower", {:name=>"Petals"})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "returns true if the value exists" do
- @registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals"}).should == true
+ expect(@registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals"})).to eq(true)
end
it "throws an exception if the value does not exist" do
- lambda {@registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"FOOBAR"})}.should raise_error(Chef::Exceptions::Win32RegValueMissing)
+ expect {@registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"FOOBAR"})}.to raise_error(Chef::Exceptions::Win32RegValueMissing)
end
end
describe "data_exists?" do
it "throws an exception if the hive does not exist" do
- lambda {@registry.data_exists?("JKLM\\Software\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Pink", "Delicate"]})}.should raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect {@registry.data_exists?("JKLM\\Software\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Pink", "Delicate"]})}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
it "throws an exception if the key does not exist" do
- lambda {@registry.data_exists?("HKCU\\Software\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Pink", "Delicate"]})}.should raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect {@registry.data_exists?("HKCU\\Software\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Pink", "Delicate"]})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "returns true if all the data matches" do
- @registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Pink", "Delicate"]}).should == true
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Pink", "Delicate"]})).to eq(true)
end
it "returns false if the name does not exist" do
- @registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"slateP", :type=>:multi_string, :data=>["Pink", "Delicate"]}).should == false
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"slateP", :type=>:multi_string, :data=>["Pink", "Delicate"]})).to eq(false)
end
it "returns false if the types do not match" do
- @registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:string, :data=>"Pink"}).should == false
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:string, :data=>"Pink"})).to eq(false)
end
it "returns false if the data does not match" do
- @registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Mauve", "Delicate"]}).should == false
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Mauve", "Delicate"]})).to eq(false)
end
end
describe "data_exists!" do
it "throws an exception if the hive does not exist" do
- lambda {@registry.data_exists!("JKLM\\Software\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Pink", "Delicate"]})}.should raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect {@registry.data_exists!("JKLM\\Software\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Pink", "Delicate"]})}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
it "throws an exception if the key does not exist" do
- lambda {@registry.data_exists!("HKCU\\Software\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Pink", "Delicate"]})}.should raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect {@registry.data_exists!("HKCU\\Software\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Pink", "Delicate"]})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "returns true if all the data matches" do
- @registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Pink", "Delicate"]}).should == true
+ expect(@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Pink", "Delicate"]})).to eq(true)
end
it "throws an exception if the name does not exist" do
- lambda {@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"slateP", :type=>:multi_string, :data=>["Pink", "Delicate"]})}.should raise_error(Chef::Exceptions::Win32RegDataMissing)
+ expect {@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"slateP", :type=>:multi_string, :data=>["Pink", "Delicate"]})}.to raise_error(Chef::Exceptions::Win32RegDataMissing)
end
it "throws an exception if the types do not match" do
- lambda {@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:string, :data=>"Pink"})}.should raise_error(Chef::Exceptions::Win32RegDataMissing)
+ expect {@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:string, :data=>"Pink"})}.to raise_error(Chef::Exceptions::Win32RegDataMissing)
end
it "throws an exception if the data does not match" do
- lambda {@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Mauve", "Delicate"]})}.should raise_error(Chef::Exceptions::Win32RegDataMissing)
+ expect {@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Mauve", "Delicate"]})}.to raise_error(Chef::Exceptions::Win32RegDataMissing)
end
end
describe "get_values" do
it "returns all values for a key if it exists" do
values = @registry.get_values("HKCU\\Software\\Root")
- values.should be_an_instance_of Array
- values.should == [{:name=>"RootType1", :type=>:string, :data=>"fibrous"},
- {:name=>"Roots", :type=>:multi_string, :data=>["strong roots", "healthy tree"]}]
+ expect(values).to be_an_instance_of Array
+ expect(values).to eq([{:name=>"RootType1", :type=>:string, :data=>"fibrous"},
+ {:name=>"Roots", :type=>:multi_string, :data=>["strong roots", "healthy tree"]}])
end
it "throws an exception if the key does not exist" do
- lambda {@registry.get_values("HKCU\\Software\\Branch\\Flower")}.should raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect {@registry.get_values("HKCU\\Software\\Branch\\Flower")}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "throws an exception if the hive does not exist" do
- lambda {@registry.get_values("JKLM\\Software\\Branch\\Flower")}.should raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect {@registry.get_values("JKLM\\Software\\Branch\\Flower")}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
end
describe "set_value" do
it "updates a value if the key, value exist and type matches and value different" do
- @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Yellow", "Changed Color"]}).should == true
- @registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Yellow", "Changed Color"]}).should == true
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})).to eq(true)
end
it "updates a value if the type does match and the values are different" do
- @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:string, :data=>"Yellow"}).should == true
- @registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:string, :data=>"Yellow"}).should == true
- @registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Yellow", "Changed Color"]}).should == false
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:string, :data=>"Yellow"})).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:string, :data=>"Yellow"})).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})).to eq(false)
end
it "creates a value if key exists and value does not" do
- @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Stamen", :type=>:multi_string, :data=>["Yellow", "Changed Color"]}).should == true
- @registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Stamen", :type=>:multi_string, :data=>["Yellow", "Changed Color"]}).should == true
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Stamen", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Stamen", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})).to eq(true)
end
it "does nothing if data,type and name parameters for the value are same" do
- @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Stamen", :type=>:multi_string, :data=>["Yellow", "Changed Color"]}).should == false
- @registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Stamen", :type=>:multi_string, :data=>["Yellow", "Changed Color"]}).should == true
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Stamen", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})).to eq(false)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"Stamen", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})).to eq(true)
end
it "throws an exception if the key does not exist" do
- lambda {@registry.set_value("HKCU\\Software\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})}.should raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect {@registry.set_value("HKCU\\Software\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "throws an exception if the hive does not exist" do
- lambda {@registry.set_value("JKLM\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})}.should raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect {@registry.set_value("JKLM\\Software\\Root\\Branch\\Flower", {:name=>"Petals", :type=>:multi_string, :data=>["Yellow", "Changed Color"]})}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
# we are validating that the data gets .to_i called on it when type is a :dword
it "casts an integer string given as a dword into an integer" do
- @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBe32767", :type=>:dword, :data=>"32767"}).should == true
- @registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBe32767", :type=>:dword, :data=>32767}).should == true
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBe32767", :type=>:dword, :data=>"32767"})).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBe32767", :type=>:dword, :data=>32767})).to eq(true)
end
it "casts a nonsense string given as a dword into zero" do
- @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBeZero", :type=>:dword, :data=>"whatdoesthisdo"}).should == true
- @registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBeZero", :type=>:dword, :data=>0}).should == true
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBeZero", :type=>:dword, :data=>"whatdoesthisdo"})).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBeZero", :type=>:dword, :data=>0})).to eq(true)
end
it "throws an exception when trying to cast an array to an int for a dword" do
- lambda {@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldThrow", :type=>:dword, :data=>["one","two"]})}.should raise_error
+ expect {@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldThrow", :type=>:dword, :data=>["one","two"]})}.to raise_error
end
# we are validating that the data gets .to_s called on it when type is a :string
it "stores the string representation of an array into a string if you pass it an array" do
- @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBePainful", :type=>:string, :data=>["one","two"]}).should == true
- @registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBePainful", :type=>:string, :data=>'["one", "two"]'}).should == true
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBePainful", :type=>:string, :data=>["one","two"]})).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBePainful", :type=>:string, :data=>'["one", "two"]'})).to eq(true)
end
it "stores the string representation of a number into a string if you pass it an number" do
- @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBe65535", :type=>:string, :data=>65535}).should == true
- @registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBe65535", :type=>:string, :data=>"65535"}).should == true
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBe65535", :type=>:string, :data=>65535})).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBe65535", :type=>:string, :data=>"65535"})).to eq(true)
end
# we are validating that the data gets .to_a called on it when type is a :multi_string
it "throws an exception when a multi-string is passed a number" do
- lambda {@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldThrow", :type=>:multi_string, :data=>65535})}.should raise_error
+ expect {@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldThrow", :type=>:multi_string, :data=>65535})}.to raise_error
end
it "throws an exception when a multi-string is passed a string" do
- lambda {@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBeWat", :type=>:multi_string, :data=>"foo"})}.should raise_error
+ expect {@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", {:name=>"ShouldBeWat", :type=>:multi_string, :data=>"foo"})}.to raise_error
end
end
@@ -289,22 +289,22 @@ describe 'Chef::Win32::Registry', :windows_only do
end
it "throws an exception if the path has missing keys but recursive set to false" do
- lambda {@registry.create_key("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", false)}.should raise_error(Chef::Exceptions::Win32RegNoRecursive)
- @registry.key_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker").should == false
+ expect {@registry.create_key("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", false)}.to raise_error(Chef::Exceptions::Win32RegNoRecursive)
+ expect(@registry.key_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker")).to eq(false)
end
it "creates the key_path if the keys were missing but recursive was set to true" do
- @registry.create_key("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", true).should == true
- @registry.key_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker").should == true
+ expect(@registry.create_key("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", true)).to eq(true)
+ expect(@registry.key_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker")).to eq(true)
end
it "does nothing if the key already exists" do
- @registry.create_key("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", false).should == true
- @registry.key_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker").should == true
+ expect(@registry.create_key("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", false)).to eq(true)
+ expect(@registry.key_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker")).to eq(true)
end
it "throws an exception of the hive does not exist" do
- lambda {@registry.create_key("JKLM\\Software\\Root\\Trunk\\Peck\\Woodpecker", false)}.should raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect {@registry.create_key("JKLM\\Software\\Root\\Trunk\\Peck\\Woodpecker", false)}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
end
@@ -317,21 +317,21 @@ describe 'Chef::Win32::Registry', :windows_only do
end
it "deletes values if the value exists" do
- @registry.delete_value("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"}).should == true
- @registry.value_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"}).should == false
+ expect(@registry.delete_value("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"})).to eq(true)
+ expect(@registry.value_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"})).to eq(false)
end
it "does nothing if value does not exist" do
- @registry.delete_value("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"}).should == true
- @registry.value_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"}).should == false
+ expect(@registry.delete_value("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"})).to eq(true)
+ expect(@registry.value_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"})).to eq(false)
end
it "throws an exception if the key does not exist?" do
- lambda {@registry.delete_value("HKCU\\Software\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"})}.should raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect {@registry.delete_value("HKCU\\Software\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "throws an exception if the hive does not exist" do
- lambda {@registry.delete_value("JKLM\\Software\\Root\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"})}.should raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect {@registry.delete_value("JKLM\\Software\\Root\\Trunk\\Peck\\Woodpecker", {:name=>"Peter", :type=>:string, :data=>"Tiny"})}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
end
@@ -348,27 +348,27 @@ describe 'Chef::Win32::Registry', :windows_only do
end
it "deletes a key if it has no subkeys" do
- @registry.delete_key("HKCU\\Software\\Root\\Branch\\Fruit", false).should == true
- @registry.key_exists?("HKCU\\Software\\Root\\Branch\\Fruit").should == false
+ expect(@registry.delete_key("HKCU\\Software\\Root\\Branch\\Fruit", false)).to eq(true)
+ expect(@registry.key_exists?("HKCU\\Software\\Root\\Branch\\Fruit")).to eq(false)
end
it "throws an exception if key to delete has subkeys and recursive is false" do
- lambda { @registry.delete_key("HKCU\\Software\\Root\\Trunk", false) }.should raise_error(Chef::Exceptions::Win32RegNoRecursive)
- @registry.key_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker").should == true
+ expect { @registry.delete_key("HKCU\\Software\\Root\\Trunk", false) }.to raise_error(Chef::Exceptions::Win32RegNoRecursive)
+ expect(@registry.key_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker")).to eq(true)
end
it "deletes a key if it has subkeys and recursive true" do
- @registry.delete_key("HKCU\\Software\\Root\\Trunk", true).should == true
- @registry.key_exists?("HKCU\\Software\\Root\\Trunk").should == false
+ expect(@registry.delete_key("HKCU\\Software\\Root\\Trunk", true)).to eq(true)
+ expect(@registry.key_exists?("HKCU\\Software\\Root\\Trunk")).to eq(false)
end
it "does nothing if the key does not exist" do
- @registry.delete_key("HKCU\\Software\\Root\\Trunk", true).should == true
- @registry.key_exists?("HKCU\\Software\\Root\\Trunk").should == false
+ expect(@registry.delete_key("HKCU\\Software\\Root\\Trunk", true)).to eq(true)
+ expect(@registry.key_exists?("HKCU\\Software\\Root\\Trunk")).to eq(false)
end
it "throws an exception if the hive does not exist" do
- lambda {@registry.delete_key("JKLM\\Software\\Root\\Branch\\Flower", false)}.should raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect {@registry.delete_key("JKLM\\Software\\Root\\Branch\\Flower", false)}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
end
@@ -384,29 +384,29 @@ describe 'Chef::Win32::Registry', :windows_only do
end
it "throws an exception if the hive was missing" do
- lambda {@registry.has_subkeys?("LMNO\\Software\\Root")}.should raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect {@registry.has_subkeys?("LMNO\\Software\\Root")}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
it "throws an exception if the key is missing" do
- lambda {@registry.has_subkeys?("HKCU\\Software\\Root\\Trunk\\Red")}.should raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect {@registry.has_subkeys?("HKCU\\Software\\Root\\Trunk\\Red")}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "returns true if the key has subkeys" do
- @registry.has_subkeys?("HKCU\\Software\\Root").should == true
+ expect(@registry.has_subkeys?("HKCU\\Software\\Root")).to eq(true)
end
it "returns false if the key has no subkeys" do
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Trunk\\Red"
- @registry.has_subkeys?("HKCU\\Software\\Root\\Trunk\\Red").should == false
+ expect(@registry.has_subkeys?("HKCU\\Software\\Root\\Trunk\\Red")).to eq(false)
end
end
describe "get_subkeys" do
it "throws an exception if the key is missing" do
- lambda {@registry.get_subkeys("HKCU\\Software\\Trunk\\Red")}.should raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect {@registry.get_subkeys("HKCU\\Software\\Trunk\\Red")}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "throws an exception if the hive does not exist" do
- lambda {@registry.get_subkeys("JKLM\\Software\\Root")}.should raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect {@registry.get_subkeys("JKLM\\Software\\Root")}.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
it "returns the array of subkeys for a given key" do
subkeys = @registry.get_subkeys("HKCU\\Software\\Root")
@@ -414,7 +414,7 @@ describe 'Chef::Win32::Registry', :windows_only do
::Win32::Registry::HKEY_CURRENT_USER.open("Software\\Root", Win32::Registry::KEY_ALL_ACCESS) do |reg|
reg.each_key{|name| reg_subkeys << name}
end
- reg_subkeys.should == subkeys
+ expect(reg_subkeys).to eq(subkeys)
end
end
@@ -431,37 +431,37 @@ describe 'Chef::Win32::Registry', :windows_only do
context "registry constructor" do
it "throws an exception if requested architecture is 64bit but running on 32bit" do
- lambda {Chef::Win32::Registry.new(@run_context, :x86_64)}.should raise_error(Chef::Exceptions::Win32RegArchitectureIncorrect)
+ expect {Chef::Win32::Registry.new(@run_context, :x86_64)}.to raise_error(Chef::Exceptions::Win32RegArchitectureIncorrect)
end
it "can correctly set the requested architecture to 32-bit" do
@r = Chef::Win32::Registry.new(@run_context, :i386)
- @r.architecture.should == :i386
- @r.registry_system_architecture.should == 0x0200
+ expect(@r.architecture).to eq(:i386)
+ expect(@r.registry_system_architecture).to eq(0x0200)
end
it "can correctly set the requested architecture to :machine" do
@r = Chef::Win32::Registry.new(@run_context, :machine)
- @r.architecture.should == :machine
- @r.registry_system_architecture.should == 0x0200
+ expect(@r.architecture).to eq(:machine)
+ expect(@r.registry_system_architecture).to eq(0x0200)
end
end
context "architecture setter" do
it "throws an exception if requested architecture is 64bit but running on 32bit" do
- lambda {@registry.architecture = :x86_64}.should raise_error(Chef::Exceptions::Win32RegArchitectureIncorrect)
+ expect {@registry.architecture = :x86_64}.to raise_error(Chef::Exceptions::Win32RegArchitectureIncorrect)
end
it "sets the requested architecture to :machine if passed :machine" do
@registry.architecture = :machine
- @registry.architecture.should == :machine
- @registry.registry_system_architecture.should == 0x0200
+ expect(@registry.architecture).to eq(:machine)
+ expect(@registry.registry_system_architecture).to eq(0x0200)
end
it "sets the requested architecture to 32-bit if passed i386 as a string" do
@registry.architecture = :i386
- @registry.architecture.should == :i386
- @registry.registry_system_architecture.should == 0x0200
+ expect(@registry.architecture).to eq(:i386)
+ expect(@registry.registry_system_architecture).to eq(0x0200)
end
end
end
@@ -479,40 +479,40 @@ describe 'Chef::Win32::Registry', :windows_only do
context "registry constructor" do
it "can correctly set the requested architecture to 32-bit" do
@r = Chef::Win32::Registry.new(@run_context, :i386)
- @r.architecture.should == :i386
- @r.registry_system_architecture.should == 0x0200
+ expect(@r.architecture).to eq(:i386)
+ expect(@r.registry_system_architecture).to eq(0x0200)
end
it "can correctly set the requested architecture to 64-bit" do
@r = Chef::Win32::Registry.new(@run_context, :x86_64)
- @r.architecture.should == :x86_64
- @r.registry_system_architecture.should == 0x0100
+ expect(@r.architecture).to eq(:x86_64)
+ expect(@r.registry_system_architecture).to eq(0x0100)
end
it "can correctly set the requested architecture to :machine" do
@r = Chef::Win32::Registry.new(@run_context, :machine)
- @r.architecture.should == :machine
- @r.registry_system_architecture.should == 0x0100
+ expect(@r.architecture).to eq(:machine)
+ expect(@r.registry_system_architecture).to eq(0x0100)
end
end
context "architecture setter" do
it "sets the requested architecture to 64-bit if passed 64-bit" do
@registry.architecture = :x86_64
- @registry.architecture.should == :x86_64
- @registry.registry_system_architecture.should == 0x0100
+ expect(@registry.architecture).to eq(:x86_64)
+ expect(@registry.registry_system_architecture).to eq(0x0100)
end
it "sets the requested architecture to :machine if passed :machine" do
@registry.architecture = :machine
- @registry.architecture.should == :machine
- @registry.registry_system_architecture.should == 0x0100
+ expect(@registry.architecture).to eq(:machine)
+ expect(@registry.registry_system_architecture).to eq(0x0100)
end
it "sets the requested architecture to 32-bit if passed 32-bit" do
@registry.architecture = :i386
- @registry.architecture.should == :i386
- @registry.registry_system_architecture.should == 0x0200
+ expect(@registry.architecture).to eq(:i386)
+ expect(@registry.registry_system_architecture).to eq(0x0200)
end
end
end
@@ -555,75 +555,75 @@ describe 'Chef::Win32::Registry', :windows_only do
describe "key_exists?" do
it "does not find 64-bit keys in the 32-bit registry" do
@registry.architecture=:i386
- @registry.key_exists?("HKLM\\Software\\Root\\Mauve").should == false
+ expect(@registry.key_exists?("HKLM\\Software\\Root\\Mauve")).to eq(false)
end
it "finds 32-bit keys in the 32-bit registry" do
@registry.architecture=:i386
- @registry.key_exists?("HKLM\\Software\\Root\\Poosh").should == true
+ expect(@registry.key_exists?("HKLM\\Software\\Root\\Poosh")).to eq(true)
end
it "does not find 32-bit keys in the 64-bit registry" do
@registry.architecture=:x86_64
- @registry.key_exists?("HKLM\\Software\\Root\\Mauve").should == true
+ expect(@registry.key_exists?("HKLM\\Software\\Root\\Mauve")).to eq(true)
end
it "finds 64-bit keys in the 64-bit registry" do
@registry.architecture=:x86_64
- @registry.key_exists?("HKLM\\Software\\Root\\Poosh").should == false
+ expect(@registry.key_exists?("HKLM\\Software\\Root\\Poosh")).to eq(false)
end
end
describe "value_exists?" do
it "does not find 64-bit values in the 32-bit registry" do
@registry.architecture=:i386
- lambda{@registry.value_exists?("HKLM\\Software\\Root\\Mauve", {:name=>"Alert"})}.should raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect{@registry.value_exists?("HKLM\\Software\\Root\\Mauve", {:name=>"Alert"})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "finds 32-bit values in the 32-bit registry" do
@registry.architecture=:i386
- @registry.value_exists?("HKLM\\Software\\Root\\Poosh", {:name=>"Status"}).should == true
+ expect(@registry.value_exists?("HKLM\\Software\\Root\\Poosh", {:name=>"Status"})).to eq(true)
end
it "does not find 32-bit values in the 64-bit registry" do
@registry.architecture=:x86_64
- @registry.value_exists?("HKLM\\Software\\Root\\Mauve", {:name=>"Alert"}).should == true
+ expect(@registry.value_exists?("HKLM\\Software\\Root\\Mauve", {:name=>"Alert"})).to eq(true)
end
it "finds 64-bit values in the 64-bit registry" do
@registry.architecture=:x86_64
- lambda{@registry.value_exists?("HKLM\\Software\\Root\\Poosh", {:name=>"Status"})}.should raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect{@registry.value_exists?("HKLM\\Software\\Root\\Poosh", {:name=>"Status"})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
end
describe "data_exists?" do
it "does not find 64-bit keys in the 32-bit registry" do
@registry.architecture=:i386
- lambda{@registry.data_exists?("HKLM\\Software\\Root\\Mauve", {:name=>"Alert", :type=>:string, :data=>"Universal"})}.should raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect{@registry.data_exists?("HKLM\\Software\\Root\\Mauve", {:name=>"Alert", :type=>:string, :data=>"Universal"})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "finds 32-bit keys in the 32-bit registry" do
@registry.architecture=:i386
- @registry.data_exists?("HKLM\\Software\\Root\\Poosh", {:name=>"Status", :type=>:string, :data=>"Lost"}).should == true
+ expect(@registry.data_exists?("HKLM\\Software\\Root\\Poosh", {:name=>"Status", :type=>:string, :data=>"Lost"})).to eq(true)
end
it "does not find 32-bit keys in the 64-bit registry" do
@registry.architecture=:x86_64
- @registry.data_exists?("HKLM\\Software\\Root\\Mauve", {:name=>"Alert", :type=>:string, :data=>"Universal"}).should == true
+ expect(@registry.data_exists?("HKLM\\Software\\Root\\Mauve", {:name=>"Alert", :type=>:string, :data=>"Universal"})).to eq(true)
end
it "finds 64-bit keys in the 64-bit registry" do
@registry.architecture=:x86_64
- lambda{@registry.data_exists?("HKLM\\Software\\Root\\Poosh", {:name=>"Status", :type=>:string, :data=>"Lost"})}.should raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect{@registry.data_exists?("HKLM\\Software\\Root\\Poosh", {:name=>"Status", :type=>:string, :data=>"Lost"})}.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
end
describe "create_key" do
it "can create a 32-bit only registry key" do
@registry.architecture = :i386
- @registry.create_key("HKLM\\Software\\Root\\Trunk\\Red", true).should == true
- @registry.key_exists?("HKLM\\Software\\Root\\Trunk\\Red").should == true
+ expect(@registry.create_key("HKLM\\Software\\Root\\Trunk\\Red", true)).to eq(true)
+ expect(@registry.key_exists?("HKLM\\Software\\Root\\Trunk\\Red")).to eq(true)
@registry.architecture = :x86_64
- @registry.key_exists?("HKLM\\Software\\Root\\Trunk\\Red").should == false
+ expect(@registry.key_exists?("HKLM\\Software\\Root\\Trunk\\Red")).to eq(false)
end
it "can create a 64-bit only registry key" do
@registry.architecture = :x86_64
- @registry.create_key("HKLM\\Software\\Root\\Trunk\\Blue", true).should == true
- @registry.key_exists?("HKLM\\Software\\Root\\Trunk\\Blue").should == true
+ expect(@registry.create_key("HKLM\\Software\\Root\\Trunk\\Blue", true)).to eq(true)
+ expect(@registry.key_exists?("HKLM\\Software\\Root\\Trunk\\Blue")).to eq(true)
@registry.architecture = :i386
- @registry.key_exists?("HKLM\\Software\\Root\\Trunk\\Blue").should == false
+ expect(@registry.key_exists?("HKLM\\Software\\Root\\Trunk\\Blue")).to eq(false)
end
end
diff --git a/spec/functional/win32/security_spec.rb b/spec/functional/win32/security_spec.rb
index 4ad9b07b74..a6b5d57748 100644
--- a/spec/functional/win32/security_spec.rb
+++ b/spec/functional/win32/security_spec.rb
@@ -23,7 +23,7 @@ end
describe 'Chef::Win32::Security', :windows_only do
it "has_admin_privileges? returns true when running as admin" do
- Chef::ReservedNames::Win32::Security.has_admin_privileges?.should == true
+ expect(Chef::ReservedNames::Win32::Security.has_admin_privileges?).to eq(true)
end
# We've done some investigation adding a negative test and it turned
diff --git a/spec/functional/win32/service_manager_spec.rb b/spec/functional/win32/service_manager_spec.rb
index b5b2e20825..fd21e7d82e 100644
--- a/spec/functional/win32/service_manager_spec.rb
+++ b/spec/functional/win32/service_manager_spec.rb
@@ -93,7 +93,7 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
context "with invalid service definition" do
it "throws an error when initialized with no service definition" do
- lambda { Chef::Application::WindowsServiceManager.new(nil) }.should raise_error(ArgumentError)
+ expect { Chef::Application::WindowsServiceManager.new(nil) }.to raise_error(ArgumentError)
end
it "throws an error with required missing options" do
@@ -101,7 +101,7 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
service_def = test_service.dup
service_def.delete(key)
- lambda { Chef::Application::WindowsServiceManager.new(service_def) }.should raise_error(ArgumentError)
+ expect { Chef::Application::WindowsServiceManager.new(service_def) }.to raise_error(ArgumentError)
end
end
end
@@ -111,7 +111,7 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
@service_manager_output = [ ]
# Uncomment below lines to debug this test
# original_puts = $stdout.method(:puts)
- $stdout.stub(:puts) do |message|
+ allow($stdout).to receive(:puts) do |message|
@service_manager_output << message
# original_puts.call(message)
end
@@ -125,19 +125,19 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
it "default => should say service don't exist" do
service_manager.run
- @service_manager_output.grep(/doesn't exist on the system/).length.should > 0
+ expect(@service_manager_output.grep(/doesn't exist on the system/).length).to be > 0
end
it "install => should install the service" do
service_manager.run(["-a", "install"])
- test_service_exists?.should be_true
+ expect(test_service_exists?).to be_truthy
end
it "other actions => should say service doesn't exist" do
["delete", "start", "stop", "pause", "resume", "uninstall"].each do |action|
service_manager.run(["-a", action])
- @service_manager_output.grep(/doesn't exist on the system/).length.should > 0
+ expect(@service_manager_output.grep(/doesn't exist on the system/).length).to be > 0
@service_manager_output = [ ]
end
end
@@ -150,47 +150,47 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
it "should have an own-process, non-interactive type" do
status = ::Win32::Service.status("spec-service")
- status[:service_type].should == "own process"
- status[:interactive].should be_false
+ expect(status[:service_type]).to eq("own process")
+ expect(status[:interactive]).to be_falsey
end
it "install => should say service already exists" do
service_manager.run(["-a", "install"])
- @service_manager_output.grep(/already exists/).length.should > 0
+ expect(@service_manager_output.grep(/already exists/).length).to be > 0
end
context "and service is stopped" do
["delete", "uninstall"].each do |action|
it "#{action} => should remove the service", :volatile do
service_manager.run(["-a", action])
- test_service_exists?.should be_false
+ expect(test_service_exists?).to be_falsey
end
end
it "default, status => should say service is stopped" do
service_manager.run([ ])
- @service_manager_output.grep(/stopped/).length.should > 0
+ expect(@service_manager_output.grep(/stopped/).length).to be > 0
@service_manager_output = [ ]
service_manager.run(["-a", "status"])
- @service_manager_output.grep(/stopped/).length.should > 0
+ expect(@service_manager_output.grep(/stopped/).length).to be > 0
end
it "start should start the service", :volatile do
service_manager.run(["-a", "start"])
- test_service_state.should == "running"
- File.exists?(test_service_file).should be_true
+ expect(test_service_state).to eq("running")
+ expect(File.exists?(test_service_file)).to be_truthy
end
it "stop should not affect the service" do
service_manager.run(["-a", "stop"])
- test_service_state.should == "stopped"
+ expect(test_service_state).to eq("stopped")
end
["pause", "resume"].each do |action|
it "#{action} => should raise error" do
- lambda {service_manager.run(["-a", action])}.should raise_error(::Win32::Service::Error)
+ expect {service_manager.run(["-a", action])}.to raise_error(::Win32::Service::Error)
end
end
@@ -202,32 +202,32 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
["delete", "uninstall"].each do |action|
it "#{action} => should remove the service", :volatile do
service_manager.run(["-a", action])
- test_service_exists?.should be_false
+ expect(test_service_exists?).to be_falsey
end
end
it "default, status => should say service is running" do
service_manager.run([ ])
- @service_manager_output.grep(/running/).length.should > 0
+ expect(@service_manager_output.grep(/running/).length).to be > 0
@service_manager_output = [ ]
service_manager.run(["-a", "status"])
- @service_manager_output.grep(/running/).length.should > 0
+ expect(@service_manager_output.grep(/running/).length).to be > 0
end
it "stop should stop the service" do
service_manager.run(["-a", "stop"])
- test_service_state.should == "stopped"
+ expect(test_service_state).to eq("stopped")
end
it "pause should pause the service" do
service_manager.run(["-a", "pause"])
- test_service_state.should == "paused"
+ expect(test_service_state).to eq("paused")
end
it "resume should have no affect" do
service_manager.run(["-a", "resume"])
- test_service_state.should == "running"
+ expect(test_service_state).to eq("running")
end
end
@@ -241,31 +241,31 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
actions.each do |action|
it "#{action} => should remove the service" do
service_manager.run(["-a", action])
- test_service_exists?.should be_false
+ expect(test_service_exists?).to be_falsey
end
end
it "default, status => should say service is paused" do
service_manager.run([ ])
- @service_manager_output.grep(/paused/).length.should > 0
+ expect(@service_manager_output.grep(/paused/).length).to be > 0
@service_manager_output = [ ]
service_manager.run(["-a", "status"])
- @service_manager_output.grep(/paused/).length.should > 0
+ expect(@service_manager_output.grep(/paused/).length).to be > 0
end
it "stop should stop the service" do
service_manager.run(["-a", "stop"])
- test_service_state.should == "stopped"
+ expect(test_service_state).to eq("stopped")
end
it "pause should not affect the service" do
service_manager.run(["-a", "pause"])
- test_service_state.should == "paused"
+ expect(test_service_state).to eq("paused")
end
it "start should raise an error" do
- lambda {service_manager.run(["-a", "start"])}.should raise_error(::Win32::Service::Error)
+ expect {service_manager.run(["-a", "start"])}.to raise_error(::Win32::Service::Error)
end
end
diff --git a/spec/functional/win32/versions_spec.rb b/spec/functional/win32/versions_spec.rb
index 6c8f6b2aaa..38af47b0c9 100644
--- a/spec/functional/win32/versions_spec.rb
+++ b/spec/functional/win32/versions_spec.rb
@@ -62,8 +62,8 @@ describe "Chef::ReservedNames::Win32::Version", :windows_only, :not_supported_on
it "should have have one method for each marketing version" do
versions = 0
for_each_windows_version { versions += 1 }
- versions.should > 0
- versions.should == Chef::ReservedNames::Win32::Version::WIN_VERSIONS.length
+ expect(versions).to be > 0
+ expect(versions).to eq(Chef::ReservedNames::Win32::Version::WIN_VERSIONS.length)
end
it "should only contain version methods with legal method names" do
@@ -71,8 +71,8 @@ describe "Chef::ReservedNames::Win32::Version", :windows_only, :not_supported_on
for_each_windows_version do |method_name|
method_match = method_name_pattern.match(method_name.to_s)
- method_match.should_not be_nil
- method_name.to_s.should == method_match[0]
+ expect(method_match).not_to be_nil
+ expect(method_name.to_s).to eq(method_match[0])
end
end
@@ -81,7 +81,7 @@ describe "Chef::ReservedNames::Win32::Version", :windows_only, :not_supported_on
for_each_windows_version do |method_name|
true_versions += 1 if @version.send(method_name)
end
- true_versions.should == 1
+ expect(true_versions).to eq(1)
end
it "should successfully execute all version methods" do
@@ -91,7 +91,7 @@ describe "Chef::ReservedNames::Win32::Version", :windows_only, :not_supported_on
context "Windows Operating System version" do
it "should match the version from WMI" do
- @current_os_version.should include(@version.marketing_name)
+ expect(@current_os_version).to include(@version.marketing_name)
end
end