Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differences in JRuby and MRI HTML output #88

Open
ThomasKoppensteiner opened this issue Feb 11, 2019 · 0 comments
Open

Differences in JRuby and MRI HTML output #88

ThomasKoppensteiner opened this issue Feb 11, 2019 · 0 comments

Comments

@ThomasKoppensteiner
Copy link
Contributor

Similar to issue #84 there are also differences in the HTML output between JRuby and MRI.

Example:

describe "a html response" do
  let(:test_html) do
<<-TEST
<!doctype html>
<head>
<title>Test Title</title>
<meta charset="utf-8"/>
</head>
<body>
<h1>Test Page</h1>
</body>
</html>
TEST
end

  it "a test" do
    verify do
      test_html
    end
  end
end

MRI Output
MRI: 2.5.3
Approvals: 0.0.24
Nokogiri: 1.10.1

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Test Title</title>
    <meta charset="utf-8" />
  </head>
  <body>
<h1>Test Page</h1>
</body>
</html>

JRuby Output
JRuby: 9.2.5.0
Approvals: 0.0.24
Nokogiri: 1.10.1-java

<!DOCTYPE html >
<html>
  <head>
    <title>Test Title</title>
    <meta charset="utf-8" />

  </head>
  <body>
    <h1>Test Page</h1>
  </body>
</html>

Workaround
A workaround is to use the format: :txt options, which produces the same (unchanged) output for both Ruby versions.

<!doctype html>
<head>
<title>Test Title</title>
<meta charset="utf-8"/>
</head>
<body>
<h1>Test Page</h1>
</body>
</html>

As far as I can tell, the issue is related to this line of code (https://github.com/kytrinyx/approvals/blob/master/lib/approvals/writers/html_writer.rb#L10), where Nokogiri produces a different output for each of the two Ruby versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant