Skip to content

Instantly share code, notes, and snippets.

@twalpole
Created December 1, 2017 20:50
Show Gist options
  • Save twalpole/a6bf26a7fc2814730b80654c51ff09a5 to your computer and use it in GitHub Desktop.
Save twalpole/a6bf26a7fc2814730b80654c51ff09a5 to your computer and use it in GitHub Desktop.
Charset test
require "capybara/dsl"
require 'selenium-webdriver'
require 'capybara/poltergeist'
html = DATA.read
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }
sess1 = Capybara::Session.new(:rack_test, app)
sess1.visit("/")
sess1.find('span', text: 'Não verificado')
sess2 = Capybara::Session.new(:selenium_chrome, app)
sess2.visit("/")
sess2.find('span', text: 'Não verificado')
sess3 = Capybara::Session.new(:poltergeist, app)
sess3.visit("/")
sess3.find('span', text: 'Não verificado')
__END__
<!doctype html>
<html>
<head>
<meta charset="UTF-8" content="text/html" http-equiv="content-type">
<title>Some title</title>
</head>
<body>
<span class="text-bold text-negative"> (Não verificado)</span
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment