Class: TestHarness::FormStruct

Inherits:
Object
  • Object
show all
Defined in:
lib/form_struct.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(browser) ⇒ FormStruct

Returns a new instance of FormStruct.



5
6
7
# File 'lib/form_struct.rb', line 5

def initialize(browser)
  self.browser = browser
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



9
10
11
12
13
14
# File 'lib/form_struct.rb', line 9

def method_missing(name, *args, &block)
  id = name.to_s.chomp('=')
  value = args[0]
  field = browser.find_field(id)
  field[:type] =~ /^select/ ? field.select(value) : field.set(value)
end

Instance Attribute Details

#browserObject

Returns the value of attribute browser.



3
4
5
# File 'lib/form_struct.rb', line 3

def browser
  @browser
end