Class: RSpec::LiveControllers::Matchers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/live_controllers/matchers/base.rb

Direct Known Subclasses

EndWithChunk, HaveChunk, StartFromChunk

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(actual_matcher) ⇒ Base

Returns a new instance of Base.



7
8
9
# File 'lib/rspec/live_controllers/matchers/base.rb', line 7

def initialize(actual_matcher)
  @actual_matcher = actual_matcher
end

Instance Attribute Details

#actual_matcherObject (readonly)

Returns the value of attribute actual_matcher.



5
6
7
# File 'lib/rspec/live_controllers/matchers/base.rb', line 5

def actual_matcher
  @actual_matcher
end

#list_of_matchersObject (readonly)

Returns the value of attribute list_of_matchers.



5
6
7
# File 'lib/rspec/live_controllers/matchers/base.rb', line 5

def list_of_matchers
  @list_of_matchers
end

#response_bodyObject (readonly)

Returns the value of attribute response_body.



5
6
7
# File 'lib/rspec/live_controllers/matchers/base.rb', line 5

def response_body
  @response_body
end

#target_responseObject (readonly)

Returns the value of attribute target_response.



5
6
7
# File 'lib/rspec/live_controllers/matchers/base.rb', line 5

def target_response
  @target_response
end

Instance Method Details

#failure_messageObject



20
21
22
# File 'lib/rspec/live_controllers/matchers/base.rb', line 20

def failure_message
  raise 'Not implemented'
end

#failure_message_when_negatedObject



24
25
26
# File 'lib/rspec/live_controllers/matchers/base.rb', line 24

def failure_message_when_negated
  raise 'Not implemented'
end

#matches?(target_response) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
17
18
# File 'lib/rspec/live_controllers/matchers/base.rb', line 11

def matches?(target_response)
  @target_response = target_response
  @response_body = extract_response_body(target_response)
  row = target_response_row(actual_matcher)
  json = target_response_json(actual_matcher)
  string = target_response_string(actual_matcher)
  check_matches?(response_body, row, json, string)
end