Class: ViewMatchers::Form

Inherits:
Object
  • Object
show all
Defined in:
lib/view_matchers/form_matcher/form.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ Form

Returns a new instance of Form.



5
6
7
8
# File 'lib/view_matchers/form_matcher/form.rb', line 5

def initialize(block)
  @block = block
  self
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (private)



20
21
22
# File 'lib/view_matchers/form_matcher/form.rb', line 20

def method_missing(method, *args, &block)
  @exists_in_rendered &= matches_selector? method, *args, &block
end

Instance Attribute Details

#failuresObject (readonly)

Returns the value of attribute failures.



3
4
5
# File 'lib/view_matchers/form_matcher/form.rb', line 3

def failures
  @failures
end

Instance Method Details

#exists_in_rendered?(actual_form) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
16
# File 'lib/view_matchers/form_matcher/form.rb', line 10

def exists_in_rendered?(actual_form)
  @failures = {}
  @current_scope = actual_form
  @exists_in_rendered = true
  instance_eval(&@block)
  @exists_in_rendered
end