Aws-sdk gem causing error only on CI

aws

#1

My tests around uploading an image to s3 fail only on when they run on circle.

I’m using webmock to mock the request for the upload itself but I am getting this exception when the tests run on circle

WebMock::NetConnectNotAllowedError: Real HTTP connections are disabled. Unregistered request: GET http://169.254.169.254/latest/meta-data/iam/security-credentials/ with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}

You can stub this request with the following snippet:

stub_request(:get, "http://169.254.169.254/latest/meta-data/iam/security-credentials/").
  with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
  to_return(:status => 200, :body => "", :headers => {})

#2