diff --git a/src/bosh_azure_cpi/lib/cloud/azure.rb b/src/bosh_azure_cpi/lib/cloud/azure.rb index cdf4540c1..784edbbd1 100644 --- a/src/bosh_azure_cpi/lib/cloud/azure.rb +++ b/src/bosh_azure_cpi/lib/cloud/azure.rb @@ -103,6 +103,9 @@ module AzureCloud; end require 'cloud/azure/telemetry/telemetry_event_handler' require 'cloud/azure/telemetry/wire_client' +require 'monkey_patches/uri_monkey_patch' +Bosh::AzureCloud::URIMonkeyPatch.apply_patch + module Bosh module Clouds Azure = Bosh::AzureCloud::Cloud diff --git a/src/bosh_azure_cpi/spec/unit/monkey_patches/uri_monkey_patch_spec.rb b/src/bosh_azure_cpi/spec/unit/monkey_patches/uri_monkey_patch_spec.rb index ab16b5d3c..8c1f2a66b 100644 --- a/src/bosh_azure_cpi/spec/unit/monkey_patches/uri_monkey_patch_spec.rb +++ b/src/bosh_azure_cpi/spec/unit/monkey_patches/uri_monkey_patch_spec.rb @@ -5,6 +5,8 @@ describe Bosh::AzureCloud::URIMonkeyPatch do describe '.apply_patch' do context 'when URI does not have an escape method' do + before { URI.instance_eval { undef :escape } } + it 'should add the escape function' do expect { URI.method(:escape) }.to raise_error(NameError) expect { Bosh::AzureCloud::URIMonkeyPatch.apply_patch }.not_to raise_error