Module: Mocktra
- Defined in:
- lib/mocktra.rb,
lib/mocktra/version.rb
Constant Summary collapse
- VERSION =
"1.0.2"
Class Method Summary collapse
Class Method Details
.mocktra(pattern, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/mocktra.rb', line 9 def mocktra(pattern, &block) 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 |