Module: HTTPAdapter::MockAdapter
- Defined in:
- lib/httpadapter/adapters/mock.rb
Overview
A simple module for mocking the transmit method on an adapter.
Class Method Summary collapse
Class Method Details
.create(&block) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/httpadapter/adapters/mock.rb', line 29 def self.create(&block) adapter = Class.new do include HTTPAdapter define_method('fetch_resource') do |*params| response = block.call(*params) if response.respond_to?(:each) return response else return [200, [], ['']] end end end return adapter.new end |