Class: Matchers::HTTP::ResponseBodyContains

Inherits:
Object
  • Object
show all
Defined in:
lib/matchers/http/response_body_contains.rb

Instance Method Summary collapse

Constructor Details

#initialize(search_term) ⇒ ResponseBodyContains



13
14
15
# File 'lib/matchers/http/response_body_contains.rb', line 13

def initialize(search_term)
  @search_term = search_term
end

Instance Method Details

#matches?(body_s) ⇒ Boolean



18
19
20
21
# File 'lib/matchers/http/response_body_contains.rb', line 18

def matches?(body_s)
  return @search_term.match(body_s) if @search_term.class == Regexp
  body_s.include?(@search_term)
end