summaryrefslogtreecommitdiff
path: root/spec/unit/mixin/azure_metadata_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/mixin/azure_metadata_spec.rb')
-rw-r--r--spec/unit/mixin/azure_metadata_spec.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/spec/unit/mixin/azure_metadata_spec.rb b/spec/unit/mixin/azure_metadata_spec.rb
index 8d0f9443..5889b6b0 100644
--- a/spec/unit/mixin/azure_metadata_spec.rb
+++ b/spec/unit/mixin/azure_metadata_spec.rb
@@ -25,6 +25,11 @@ describe Ohai::Mixin::AzureMetadata do
mixin
end
+ before do
+ logger = instance_double("Mixlib::Log::Child", trace: nil, debug: nil, warn: nil)
+ allow(mixin).to receive(:logger).and_return(logger)
+ end
+
describe "#http_get" do
it "gets the passed URI" do
http_mock = double("http")
@@ -41,7 +46,7 @@ describe Ohai::Mixin::AzureMetadata do
http_mock = double("http", { :code => "500" })
allow(mixin).to receive(:http_get).and_return(http_mock)
- expect(Ohai::Log).to receive(:warn)
+ expect(mixin.logger).to receive(:warn)
vals = mixin.fetch_metadata
expect(vals).to eq(nil)
end
@@ -50,7 +55,7 @@ describe Ohai::Mixin::AzureMetadata do
http_mock = double("http", { :code => "200", :body => '{ "foo" "bar"}' })
allow(mixin).to receive(:http_get).and_return(http_mock)
- expect(Ohai::Log).to receive(:warn)
+ expect(mixin.logger).to receive(:warn)
vals = mixin.fetch_metadata
expect(vals).to eq(nil)
end
@@ -59,7 +64,7 @@ describe Ohai::Mixin::AzureMetadata do
http_mock = double("http", { :code => "200", :body => '{ "foo": "bar"}' })
allow(mixin).to receive(:http_get).and_return(http_mock)
- expect(Ohai::Log).not_to receive(:warn)
+ expect(mixin.logger).not_to receive(:warn)
vals = mixin.fetch_metadata
expect(vals).to eq({ "foo" => "bar" })
end