Class: Formulaic::Inputs::StringInput
- Inherits:
-
Input
- Object
- Input
- Formulaic::Inputs::StringInput
show all
- Defined in:
- lib/formulaic/inputs/string_input.rb
Instance Method Summary
collapse
Methods inherited from Input
#initialize
Instance Method Details
#fill ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/formulaic/inputs/string_input.rb', line 4
def fill
if page.has_selector?(:fillable_field, label)
fill_in(label, with: value)
elsif page.has_selector?(:radio_button, label)
choose(value)
elsif has_option_in_select?(value, label)
select(value, from: label)
else
raise Formulaic::InputNotFound.new(%[Unable to find input "#{label}".])
end
end
|
#has_option_in_select?(option, select) ⇒ Boolean
16
17
18
19
20
|
# File 'lib/formulaic/inputs/string_input.rb', line 16
def has_option_in_select?(option, select)
find(:select, select).has_selector?(:option, option)
rescue Capybara::ElementNotFound
false
end
|