-
-
Save patreeceeo/af4a06db090a81665893 to your computer and use it in GitHub Desktop.
Helper for filling in select inputs wrapped by select2.js using Rspec + Capybara
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fill_in_select2(selector, options={}) | |
page.find(:css, "#s2id_#{selector} a").click | |
page.find(:css, "#select2-drop .select2-search input.select2-input").set options[:with] | |
page.find(:css, "#select2-drop .select2-result-label").click # Choose the first result | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment