Module: Capybara::Select2

Defined in:
lib/capybara_select2.rb,
lib/capybara_select2.rb

Defined Under Namespace

Classes: Element

Instance Method Summary collapse

Instance Method Details

#select2(value, options = {}) ⇒ Object



54
55
56
57
58
59
# File 'lib/capybara_select2.rb', line 54

def select2(value, options = {})
  raise "Must pass a hash containing 'from' or 'xpath'" unless options.is_a?(Hash) and [:from, :xpath].any? { |k| options.has_key? k }
  element = Capybara::Select2::Element.new(self, options)
  element.initiate!(value)
  element.select_match!
end