Last active
August 29, 2015 14:01
-
-
Save kyanny/548d25f77cd8f0a7cbb0 to your computer and use it in GitHub Desktop.
Capybara console
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
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: