Class: Kombu::RSpec::Matchers::ComponentRenderedMatcher::Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/kombu/test/rspec/matchers/component_rendered_matcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(component, entry: nil, mount_element_id: nil, attributes: {}) ⇒ Matcher

Returns a new instance of Matcher.



12
13
14
15
16
17
# File 'lib/kombu/test/rspec/matchers/component_rendered_matcher.rb', line 12

def initialize(component, entry: nil, mount_element_id: nil, attributes: {})
  @expected_component = component
  @expected_entry = entry
  @expected_mount_element_id = mount_element_id
  @expected_attributes = attributes
end

Instance Method Details

#failure_messageObject



24
25
26
27
28
29
# File 'lib/kombu/test/rspec/matchers/component_rendered_matcher.rb', line 24

def failure_message
  return failure_component_message unless component_match?
  return failure_attributes_message unless attributes_match?
  return failure_entry_message unless entry_match?
  failure_mount_element_id_message unless mount_element_id_match?
end

#matches?(controller) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/kombu/test/rspec/matchers/component_rendered_matcher.rb', line 19

def matches?(controller)
  set_actual_avaliables(controller)
  component_match? && entry_match? && mount_element_id_match? && attributes_match?
end