Module: Poisol::Stubs

Extended by:
Stubs
Included in:
Stubs
Defined in:
lib/poisol/stub_mapper/stubs.rb

Instance Method Summary collapse

Instance Method Details

#add(stub) ⇒ Object



10
11
12
13
# File 'lib/poisol/stub_mapper/stubs.rb', line 10

def add stub 
  @stubs = [] if @stubs.blank?
  @stubs << stub 
end

#allObject



6
7
8
# File 'lib/poisol/stub_mapper/stubs.rb', line 6

def all
  @stubs
end

#get_match(actual_request) ⇒ Object



19
20
21
22
23
# File 'lib/poisol/stub_mapper/stubs.rb', line 19

def get_match actual_request
  return nil if @stubs.blank?
  matches = @stubs.select{|stub| Poisol::RequestMatcher.matches? actual_request,stub.request}
  return matches.present? ? matches[0] : nil 
end

#resetObject



15
16
17
# File 'lib/poisol/stub_mapper/stubs.rb', line 15

def reset
  @stubs = []
end