Skip to content

Instantly share code, notes, and snippets.

@kyanny
Last active August 29, 2015 14:01
Show Gist options
  • Save kyanny/548d25f77cd8f0a7cbb0 to your computer and use it in GitHub Desktop.
Save kyanny/548d25f77cd8f0a7cbb0 to your computer and use it in GitHub Desktop.
Capybara console
#!/usr/bin/env ruby
require 'pry'
require 'capybara/dsl'
require 'capybara/poltergeist'
require 'uri'
include Capybara::DSL
Capybara.default_driver = :poltergeist
if url = ARGV[0]
unless url.to_s.match(/\Ahttps?:\/\//)
url = "http://#{url}"
end
uri = URI.parse(url)
app_host = uri.to_s.sub(uri.request_uri, '')
Capybara.app_host = app_host
visit uri.request_uri
puts "Visit to #{uri.to_s}"
end
pry
@kyanny
Copy link
Author

kyanny commented May 29, 2014

Usage:

$ capybara
$ capybara example.com
$ capybara http://example.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment