Sha256: 2ce1f0c2c096b6d9c9430766ae9d455700f92a69898b89477be896791efa6bad
Contents?: true
Size: 713 Bytes
Versions: 1
Compression:
Stored size: 713 Bytes
Contents
require 'webmock' require 'rspec' module WebMock module RSpec module Helper def webmock(method, mocks = {}, with: false, headers: nil) mocks.each do |regex, result| if result.to_s =~ /\A\d+\z/ status = result body = '' else status = result[/\.(\d+)\./, 1] || 200 body = File.read Rails.root.join('spec', 'support', 'stubs', result) end stub = WebMock.stub_request(method, regex) stub.with(with) if with stub.to_return status: status.to_i, body: body, headers: headers end end end end end RSpec.configure do |config| config.include WebMock::RSpec::Helper end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
webmock-rspec-helper-0.0.5 | lib/webmock-rspec-helper.rb |