Skip to content

Instantly share code, notes, and snippets.

def select2 text, options
page.find("#s2id_#{options[:from]} a").click
find(:xpath, "//body").find("input.select2-input").set(text)
page.execute_script(%|$("input.select2-input:visible").keyup();|)
find(:xpath, '//body').find('ul.select2-results li', text: text).click
end
#!/usr/bin/env ruby
#
# A complete URL-shortening web application, written in Ruby/Sinatra. Run it
# from the command line, and then visit http://localhost:4567/
#
# Or to run it under apache/passenger, you'll need a config.ru file with the
# following contents:
#
# require 'tinyurl'
# run Sinatra::Application