Created
June 8, 2018 00:03
-
-
Save twalpole/5f14160e792ce64f06499376adb95558 to your computer and use it in GitHub Desktop.
test current path
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
gem 'poltergeist', '1.18.1' | |
require "capybara/dsl" | |
require 'capybara/poltergeist' | |
html = DATA.read | |
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] } | |
sess = Capybara::Session.new(:poltergeist, app) | |
sess.visit('/') | |
sess.assert_current_path('/') | |
puts sess.current_path | |
sess.visit('/something') | |
sess.assert_current_path('/something') | |
puts sess.current_path | |
__END__ | |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>Snippet</title> | |
</head> | |
<body> | |
<div>Contents</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment