Skip to content

Instantly share code, notes, and snippets.

@chadbailey59
Last active December 28, 2015 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save chadbailey59/7456120 to your computer and use it in GitHub Desktop.
Save chadbailey59/7456120 to your computer and use it in GitHub Desktop.
def select2_select(option, opts={})
# same as foundation_select, but for select2
# boxes used throughout the staff app.
originating_select_name = opts[:from]
custom_select = find("select[name='#{originating_select_name}']").parent.find(".select2-container")
# click dropdown
custom_select.find("a.select2-choice").click
# click option with correct text
find("ul.select2-results").find('li', text: option).click
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment