Class: WebStub::Registry
- Inherits:
-
Object
- Object
- WebStub::Registry
- Defined in:
- lib/webstub/registry.rb
Instance Method Summary collapse
- #add_stub(method, path) ⇒ Object
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
- #reset ⇒ Object
- #size ⇒ Object
- #stub_matching(method, url, options = {}) ⇒ Object
Constructor Details
#initialize ⇒ Registry
Returns a new instance of Registry.
3 4 5 |
# File 'lib/webstub/registry.rb', line 3 def initialize() @stubs = [] end |
Instance Method Details
#add_stub(method, path) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/webstub/registry.rb', line 7 def add_stub(method, path) stub = Stub.new(method, path) @stubs << stub stub end |
#reset ⇒ Object
14 15 16 |
# File 'lib/webstub/registry.rb', line 14 def reset @stubs = [] end |
#size ⇒ Object
18 19 20 |
# File 'lib/webstub/registry.rb', line 18 def size @stubs.size end |
#stub_matching(method, url, options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/webstub/registry.rb', line 22 def stub_matching(method, url, ={}) @stubs.each do |stub| if stub.matches?(method, url, ) return stub end end nil end |