Module: ReqresRspec::Uploaders

Extended by:
Uploaders
Included in:
Uploaders
Defined in:
lib/reqres_rspec/uploaders.rb,
lib/reqres_rspec/uploaders/amazon_s3.rb

Defined Under Namespace

Classes: AmazonS3

Instance Method Summary collapse

Instance Method Details

#uploadObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/reqres_rspec/uploaders.rb', line 5

def upload
  if defined?(WebMock)
    WebMock.allow_net_connect!
  end

  if defined?(VCR)
    VCR.configure do |c|
      c.ignore_request do |request|
        URI(request.uri).host == 's3.amazonaws.com'
      end
    end
  end

  klass = Object.const_get("ReqresRspec::Uploaders::#{ENV['REQRES_UPLOAD']}")
  klass.upload if klass.respond_to?(:upload)
end