Sha256: dcb377323c9c2c615632b50ace8daca49ae9b21deb99092ab3bca6d81727ec88

Contents?: true

Size: 469 Bytes

Versions: 4

Compression:

Stored size: 469 Bytes

Contents

module WebMock
  module RSpec
    module Helper

      VERSION = '0.0.1'

      def webmock(method, mocks = {})
        mocks.each do |regex, filename|
          status = filename[/\.(\d+)\./)] || 200
          body = File.read Rails.root.join('spec', 'support', filename)
          WebMock.stub_request(method, regex).to_return status: status, body: body
        end
      end

    end
  end
end

RSpec.configure do |config|
  config.include WebMock::RSpec::Helper
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
webmock-rspec-helper-0.0.5 helper.rb
webmock-rspec-helper-0.0.4 helper.rb
webmock-rspec-helper-0.0.3 helper.rb
webmock-rspec-helper-0.0.1 helper.rb