Created
February 1, 2017 23:00
-
-
Save twalpole/7287b8d2e9b2ba6287c93df519e90765 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'capybara/dsl' | |
require 'capybara/webkit' | |
app = proc do |env| | |
[200, { "Content-Type" => "text/html" }, [ | |
%{<!doctype html> | |
<html> | |
<head> | |
<title>Title: #{env["REQUEST_PATH"]}</title> | |
</head> | |
<body> | |
<button onclick="window.location.href = '/next'">Move on</button> | |
</body> | |
</html>%} | |
] ] | |
end | |
session = Capybara::Session.new(:webkit, app) | |
session.visit('/') | |
session.assert_current_path('/') | |
session.assert_title("Title: /") | |
session.click_button('Move on') | |
session.assert_current_path('/next') | |
session.assert_title("Title: /next") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment