Sha256: b5ac4fab4fbe882ad4e8891aeb9c9a9aeeda49fa9e39b14247acccddba369826

Contents?: true

Size: 828 Bytes

Versions: 7

Compression:

Stored size: 828 Bytes

Contents

require "test_helper"

class RenderingTest < ActionDispatch::IntegrationTest
  test "Generate PDF on the fly in a controller" do
    get "/tex/example.pdf"
    assert_match (/application\/pdf/), response.headers["Content-Type"]
    reader = PDF::Reader.new(StringIO.new(response.body))
    assert_equal 1, reader.pages.count
    assert_match (/Test latex document/), reader.pages.first.text
  end

  test "Generate PDF using escaped characters" do
    get "/tex/example2.pdf"
    assert_match (/application\/pdf/), response.headers["Content-Type"]
    reader = PDF::Reader.new(StringIO.new(response.body))
    assert_equal 1, reader.pages.count
    assert_match (/& % \$ #/), reader.pages.first.text
    assert_match (/\~ \^/), reader.pages.first.text
    # PDF reader does not parse the others correctly unfortunately
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
latexpdf-0.4.8 test/integration/rendering_test.rb
latexpdf-0.4.7 test/integration/rendering_test.rb
latexpdf-0.4.6 test/integration/rendering_test.rb
latexpdf-0.4.5 test/integration/rendering_test.rb
latexpdf-0.4.4 test/integration/rendering_test.rb
latexpdf-0.4.3 test/integration/rendering_test.rb
latexpdf-0.4.2 test/integration/rendering_test.rb