summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-04-25 09:40:18 -0700
committerGitHub <noreply@github.com>2020-04-25 09:40:18 -0700
commitf66f7ee2f9778302db55594cef50ed7c0db25445 (patch)
treea31a376b03b6dec6af1eff1f35dacea1df309199 /spec
parent62b64d0d9f27cc138091503069b9b07f5097ae62 (diff)
parentbe1191b72d72887713048538e72a11b3940c6eb8 (diff)
downloadchef-f66f7ee2f9778302db55594cef50ed7c0db25445.tar.gz
Merge pull request #9648 from chef/Kapil/GitHub-9450_Update_the_locale_resource_to_support_Windows
locale: Support setting locale on Windows
Diffstat (limited to 'spec')
-rw-r--r--spec/functional/resource/locale_spec.rb14
-rw-r--r--spec/unit/resource/locale_spec.rb34
2 files changed, 12 insertions, 36 deletions
diff --git a/spec/functional/resource/locale_spec.rb b/spec/functional/resource/locale_spec.rb
index 29cd01ad78..24a43ef0ba 100644
--- a/spec/functional/resource/locale_spec.rb
+++ b/spec/functional/resource/locale_spec.rb
@@ -74,8 +74,7 @@ describe Chef::Resource::Locale, :requires_root do
resource.lang
resource.lc_env
resource.run_action(:update)
- unsets_system_locale("LANG=en_US", "LC_TIME=en_IN")
- sets_system_locale("")
+ expect(resource).not_to be_updated_by_last_action
end
end
end
@@ -94,4 +93,15 @@ describe Chef::Resource::Locale, :requires_root do
expect { resource.run_action(:update) }.to raise_error(Chef::Exceptions::ProviderNotFound)
end
end
+
+ context "on windows", :windows_only, requires_root: false do
+ describe "action: update" do
+ context "Sets system locale" do
+ it "when lang is given" do
+ resource.lang("en-US")
+ resource.run_action(:update)
+ end
+ end
+ end
+ end
end
diff --git a/spec/unit/resource/locale_spec.rb b/spec/unit/resource/locale_spec.rb
index 7f70905ff0..e1275a6830 100644
--- a/spec/unit/resource/locale_spec.rb
+++ b/spec/unit/resource/locale_spec.rb
@@ -186,38 +186,4 @@ describe Chef::Resource::Locale do
end
end
end
-
- describe "#up_to_date?" do
- context "when file does not exists" do
- it "returns false" do
- allow(File).to receive(:read).and_raise(Errno::ENOENT, "No such file or directory")
- expect(provider.up_to_date?).to be_falsy
- end
- end
-
- context "when file exists" do
- let(:content) { "LANG=en_US\nLC_MESSAGES=en_AG.utf8\nLC_TIME=en_AG.utf8\n" }
- before do
- allow(provider).to receive(:new_content).and_return(content)
- end
- context "but is empty" do
- it "returns false" do
- allow(File).to receive(:read).and_return("")
- expect(provider.up_to_date?).to be_falsy
- end
- end
- context "and contains old key-vals" do
- it "returns false" do
- allow(File).to receive(:read).and_return("LC_MESSAGES=en_AG.utf8\n")
- expect(provider.up_to_date?).to be_falsy
- end
- end
- context "and contains new key-vals" do
- it "returns true" do
- allow(File).to receive(:read).and_return(content)
- expect(provider.up_to_date?).to be_truthy
- end
- end
- end
- end
end