summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-07-19 12:37:05 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2016-07-19 12:37:05 -0700
commitdc5aa2759006f7cdb58bd085d64e3a6051b3158e (patch)
treeaf0bc24e8e4e51169593c4e62fdb105b102674d9 /spec/support
parent99c7bbf32fb3dbc1d9e80370a68b256b7e939e0d (diff)
downloadchef-dc5aa2759006f7cdb58bd085d64e3a6051b3158e.tar.gz
replace glibc resolver with ruby resolver
also wires up file providers to reload /etc/reoslv.conf when it changes.
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared/unit/provider/file.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/support/shared/unit/provider/file.rb b/spec/support/shared/unit/provider/file.rb
index cb539ffbc3..0959406583 100644
--- a/spec/support/shared/unit/provider/file.rb
+++ b/spec/support/shared/unit/provider/file.rb
@@ -683,6 +683,24 @@ shared_examples_for Chef::Provider::File do
end
end
+ context "do_resolv_conf_fixup" do
+ %w{/resolv.conf /etc/resolv.con /etc/foo/resolv.conf /c/resolv.conf}.each do |path|
+ context "when managing #{path}" do
+ let(:resource_path) { path }
+ it "does not reload the nameservers" do
+ expect(Resolv::DefaultResolver).not_to receive(:replace_resolvers)
+ provider.send(:do_resolv_conf_fixup)
+ end
+ end
+ end
+ context "when managing /etc/resolv.conf" do
+ let(:resource_path) { "/etc/resolv.conf" }
+ it "reloads the nameservers" do
+ expect(Resolv::DefaultResolver).to receive(:replace_resolvers)
+ provider.send(:do_resolv_conf_fixup)
+ end
+ end
+ end
end
context "action delete" do