Sha256: 4ba998c456a70c4d023297c86381649c81d659fd0d29f475208846e712aac8e0
Contents?: true
Size: 1.29 KB
Versions: 7
Compression:
Stored size: 1.29 KB
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 test "Generate PDF using non printable characters" do get "/tex/example3.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 (/tab: END/), reader.pages.first.text assert_match (/cr:END/), reader.pages.first.text # PDF reader detects sometimes one, sometimes two newlines assert_match (/form feed:END/), reader.pages.first.text end end
Version data entries
7 entries across 7 versions & 1 rubygems