Class: TempoIQ::StubbedRemoter
- Inherits:
-
Object
- Object
- TempoIQ::StubbedRemoter
- Defined in:
- lib/tempoiq/remoter/stubbed_remoter.rb
Instance Method Summary collapse
- #delete(route, body = nil, headers = {}) ⇒ Object
- #get(route, body = nil, headers = {}) ⇒ Object
-
#initialize(pop_stubs = false) ⇒ StubbedRemoter
constructor
A new instance of StubbedRemoter.
- #post(route, body = nil, headers = {}) ⇒ Object
- #put(route, body = nil, headers = {}) ⇒ Object
- #stub(http_verb, route, code, body = nil, headers = {}) ⇒ Object
Constructor Details
#initialize(pop_stubs = false) ⇒ StubbedRemoter
Returns a new instance of StubbedRemoter.
7 8 9 10 11 12 |
# File 'lib/tempoiq/remoter/stubbed_remoter.rb', line 7 def initialize(pop_stubs = false) @active_stubs = Hash.new do |stubs, key| stubs[key] = [] end @pop_stubs = pop_stubs end |
Instance Method Details
#delete(route, body = nil, headers = {}) ⇒ Object
30 31 32 |
# File 'lib/tempoiq/remoter/stubbed_remoter.rb', line 30 def delete(route, body = nil, headers = {}) return_stub(:delete, route, body, headers) end |
#get(route, body = nil, headers = {}) ⇒ Object
22 23 24 |
# File 'lib/tempoiq/remoter/stubbed_remoter.rb', line 22 def get(route, body = nil, headers = {}) return_stub(:get, route, body, headers) end |
#post(route, body = nil, headers = {}) ⇒ Object
26 27 28 |
# File 'lib/tempoiq/remoter/stubbed_remoter.rb', line 26 def post(route, body = nil, headers = {}) return_stub(:post, route, body, headers) end |
#put(route, body = nil, headers = {}) ⇒ Object
34 35 36 |
# File 'lib/tempoiq/remoter/stubbed_remoter.rb', line 34 def put(route, body = nil, headers = {}) return_stub(:put, route, body, headers) end |
#stub(http_verb, route, code, body = nil, headers = {}) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/tempoiq/remoter/stubbed_remoter.rb', line 14 def stub(http_verb, route, code, body = nil, headers = {}) @active_stubs[key_for(http_verb, route)] << { :body => body, :code => code, :headers =>headers } end |