Sha256: 7e092014fea6667b0a50276b0a226147f9806f01130ead36c522b346feb4441d
Contents?: true
Size: 582 Bytes
Versions: 1
Compression:
Stored size: 582 Bytes
Contents
require "mocktra/version" require 'webmock' require 'sinatra/base' WebMock.allow_net_connect! module Mocktra class << self def mocktra(pattern, &block) # TODO pattern = case pattern when Regexp pattern when /^http/ /^#{Regexp.quote(pattern)}/ else /#{Regexp.quote(pattern)}/ end rack_app = Class.new(Sinatra::Base, &block) WebMock::API.stub_request(:any, pattern).to_rack(rack_app) end end end module Kernel def Mocktra(*args, &block) Mocktra.mocktra(*args, &block) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mocktra-1.0.0 | lib/mocktra.rb |