Class: FillIN::Select

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

Overview

When /^select “(.*)” from “(.*)”$/ do |value, label|

select value, from: label

end

Instance Method Summary collapse

Constructor Details

#initialize(label, value, within) ⇒ Select

Returns a new instance of Select.



7
8
9
10
11
# File 'lib/cucumber/pickles/steps/fill_in/select.rb', line 7

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

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
# File 'lib/cucumber/pickles/steps/fill_in/select.rb', line 13

def call
  locator, wait  = Locator::Wait.execute(@label)
  locator, index = Locator::Index.execute(locator)

  options = { from: locator }
  options[:wait] = wait if wait

  @within.select @value, options
end