Class: Accessibility::HasChildMatcher
Overview
Custom matcher for RSpec to check if an element has the specified
child element.
Instance Attribute Summary
#block, #filters, #kind
Instance Method Summary
collapse
#does_not_match?, #initialize
Instance Method Details
#description ⇒ String
65
66
67
|
# File 'lib/rspec/expectations/ax_elements.rb', line 65
def description
"should have a child that matches #{qualifier.describe}"
end
|
#failure_message_for_should ⇒ String
55
56
57
|
# File 'lib/rspec/expectations/ax_elements.rb', line 55
def failure_message_for_should
"Expected #@parent to have child #{qualifier.describe}"
end
|
#failure_message_for_should_not ⇒ String
60
61
62
|
# File 'lib/rspec/expectations/ax_elements.rb', line 60
def failure_message_for_should_not
"Expected #@parent to NOT have child #@result"
end
|
#matches?(parent) ⇒ Boolean
48
49
50
51
52
|
# File 'lib/rspec/expectations/ax_elements.rb', line 48
def matches? parent
@parent = parent
@result = parent.children.find { |x| qualifier.qualifies? x }
!@result.blank?
end
|