Class: Accessibility::HasChildShortlyMatcher

Inherits:
AbstractMatcher show all
Includes:
DSL
Defined in:
lib/rspec/expectations/ax_elements.rb

Overview

Custom matcher for RSpec to check if an element has the specified child element within a grace period. Used for testing things after an asynchronous action is performed.

Instance Attribute Summary

Attributes inherited from AbstractMatcher

#block, #filters, #kind

Instance Method Summary collapse

Methods included from DSL

#app_with_bundle_identifier, #app_with_name, #app_with_pid, #cancel, #click, #confirm, #decrement, #delete, #double_click, #drag_mouse_to, #element_at_point, #element_under_mouse, #graph, #hide, #highlight, #increment, #method_missing, #move_mouse_to, #pick, #press, #raise, #right_click, #screenshot, #scroll, #scroll_menu_to, #scroll_to, #select_menu_item, #set, #set_focus_to, #show_about_window_for, #show_menu, #show_preferences_window_for, #subtree, #system_wide, #terminate, #type, #unhide, #wait_for, #wait_for_child, #wait_for_descendant, #wait_for_invalidation_of

Methods inherited from AbstractMatcher

#does_not_match?, #initialize

Constructor Details

This class inherits a constructor from Accessibility::AbstractMatcher

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Accessibility::DSL

Instance Method Details

#descriptionString

Returns:



122
123
124
# File 'lib/rspec/expectations/ax_elements.rb', line 122

def description
  "should have a child that matches #{qualifier.describe} before a timeout occurs"
end

#failure_message_for_shouldString

Returns:



112
113
114
# File 'lib/rspec/expectations/ax_elements.rb', line 112

def failure_message_for_should
  "Expected #@parent to have child #{qualifier.describe} before a timeout occurred"
end

#failure_message_for_should_notString

Returns:



117
118
119
# File 'lib/rspec/expectations/ax_elements.rb', line 117

def failure_message_for_should_not
  "Expected #@parent to NOT have child #@result before a timeout occurred"
end

#matches?(parent) ⇒ Boolean

Parameters:

Returns:

  • (Boolean)


105
106
107
108
109
# File 'lib/rspec/expectations/ax_elements.rb', line 105

def matches? parent
  @filters[:parent] = @parent = parent
  @result = wait_for kind, filters, &block
  !@result.blank?
end