Class: FillIN::Input

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/pickles/steps/fill_in/input.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, value, within) ⇒ Input

Returns a new instance of Input.



5
6
7
8
9
# File 'lib/cucumber/pickles/steps/fill_in/input.rb', line 5

def initialize(label, value, within)
  @label = label
  @value = value
  @within = within || Capybara.current_session
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



3
4
5
# File 'lib/cucumber/pickles/steps/fill_in/input.rb', line 3

def label
  @label
end

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/cucumber/pickles/steps/fill_in/input.rb', line 3

def value
  @value
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cucumber/pickles/steps/fill_in/input.rb', line 11

def call
  case input.native.attribute("type")

  when "radio", "checkbox"
    Pickles.select_input(input, @value)
  when "file"
    Pickles.attach_file(input, @value)
  else # password email tel ...
    input.set(@value)
  end

  input
end