diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2014-10-21 10:39:48 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2014-10-23 18:06:05 -0700 |
commit | ac1e1dca7133b359315610f98c0375e6351b9e3a (patch) | |
tree | bc23708cd75e5b27f6e2b2d1abd2754d77db45fd /spec/unit | |
parent | ba9474e68dadea5099c935d2d56025b6df0ec54f (diff) | |
download | chef-ac1e1dca7133b359315610f98c0375e6351b9e3a.tar.gz |
Renamed compare_value in env provider
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/provider/env/windows_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/provider/env_spec.rb | 26 |
2 files changed, 15 insertions, 15 deletions
diff --git a/spec/unit/provider/env/windows_spec.rb b/spec/unit/provider/env/windows_spec.rb index 2ea137c1d9..84582d8b4d 100644 --- a/spec/unit/provider/env/windows_spec.rb +++ b/spec/unit/provider/env/windows_spec.rb @@ -53,7 +53,7 @@ describe Chef::Provider::Env::Windows, :windows_only do end it "should update the ruby ENV object when it updates the value" do - provider.should_receive(:compare_value).and_return(true) + provider.should_receive(:requires_modify_or_create?).and_return(true) new_resource.value("foobar") provider.action_modify expect(ENV['CHEF_WINDOWS_ENV_TEST']).to eql('foobar') @@ -92,7 +92,7 @@ describe Chef::Provider::Env::Windows, :windows_only do end it "replaces Windows system variables" do - provider.should_receive(:compare_value).and_return(true) + provider.should_receive(:requires_modify_or_create?).and_return(true) provider.should_receive(:expand_path).with(system_root).and_return(system_root_value) provider.action_modify expect(ENV['PATH']).to eql(system_root_value) diff --git a/spec/unit/provider/env_spec.rb b/spec/unit/provider/env_spec.rb index f5e19fc5fb..f8803f9bb6 100644 --- a/spec/unit/provider/env_spec.rb +++ b/spec/unit/provider/env_spec.rb @@ -88,20 +88,20 @@ describe Chef::Provider::Env do it "should check to see if the values are the same if the key exists" do @provider.key_exists = true - @provider.should_receive(:compare_value).and_return(false) + @provider.should_receive(:requires_modify_or_create?).and_return(false) @provider.action_create end it "should call modify_env if the key exists and values are not equal" do @provider.key_exists = true - @provider.stub(:compare_value).and_return(true) + @provider.stub(:requires_modify_or_create?).and_return(true) @provider.should_receive(:modify_env).and_return(true) @provider.action_create end it "should set the new_resources updated flag when it updates an existing value" do @provider.key_exists = true - @provider.stub(:compare_value).and_return(true) + @provider.stub(:requires_modify_or_create?).and_return(true) @provider.stub(:modify_env).and_return(true) @provider.action_create @new_resource.should be_updated @@ -147,20 +147,20 @@ describe Chef::Provider::Env do end it "should call modify_group if the key exists and values are not equal" do - @provider.should_receive(:compare_value).and_return(true) + @provider.should_receive(:requires_modify_or_create?).and_return(true) @provider.should_receive(:modify_env).and_return(true) @provider.action_modify end it "should set the new resources updated flag to true if modify_env is called" do - @provider.stub(:compare_value).and_return(true) + @provider.stub(:requires_modify_or_create?).and_return(true) @provider.stub(:modify_env).and_return(true) @provider.action_modify @new_resource.should be_updated end it "should not call modify_env if the key exists but the values are equal" do - @provider.should_receive(:compare_value).and_return(false) + @provider.should_receive(:requires_modify_or_create?).and_return(false) @provider.should_not_receive(:modify_env) @provider.action_modify end @@ -222,7 +222,7 @@ describe Chef::Provider::Env do end end - describe "compare_value" do + describe "requires_modify_or_create?" do before(:each) do @new_resource.value("C:/bar") @current_resource = @new_resource.clone @@ -230,25 +230,25 @@ describe Chef::Provider::Env do end it "should return false if the values are equal" do - @provider.compare_value.should be_false + @provider.requires_modify_or_create?.should be_false end it "should return true if the values not are equal" do @new_resource.value("C:/elsewhere") - @provider.compare_value.should be_true + @provider.requires_modify_or_create?.should be_true end it "should return false if the current value contains the element" do @new_resource.delim(";") @current_resource.value("C:/bar;C:/foo;C:/baz") - @provider.compare_value.should be_false + @provider.requires_modify_or_create?.should be_false end it "should return true if the current value does not contain the element" do @new_resource.delim(";") @current_resource.value("C:/biz;C:/foo/bin;C:/baz") - @provider.compare_value.should be_true + @provider.requires_modify_or_create?.should be_true end context "when new_resource's value contains the delimiter" do @@ -256,14 +256,14 @@ describe Chef::Provider::Env do @new_resource.value("C:/biz;C:/baz") @new_resource.delim(";") @current_resource.value("C:/biz;C:/foo/bin;C:/baz") - @provider.compare_value.should be_false + @provider.requires_modify_or_create?.should be_false end it "should return true if any of the new values are not contained" do @new_resource.value("C:/biz;C:/baz;C:/bin") @new_resource.delim(";") @current_resource.value("C:/biz;C:/foo/bin;C:/baz") - @provider.compare_value.should be_true + @provider.requires_modify_or_create?.should be_true end end end |