prawn-rails 1.4.1 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -3
- data/README.md +16 -2
- data/Rakefile +0 -0
- data/lib/prawn-rails/config.rb +27 -9
- data/lib/prawn-rails/document.rb +5 -19
- data/lib/prawn-rails/rails_helper.rb +8 -12
- data/lib/prawn-rails/version.rb +1 -1
- data/lib/prawn-rails.rb +16 -1
- metadata +18 -219
- data/lib/prawn-rails/railtie.rb +0 -14
- data/test/dummy_app/Rakefile +0 -7
- data/test/dummy_app/app/assets/config/manifest.js +0 -3
- data/test/dummy_app/app/assets/javascripts/application.js +0 -0
- data/test/dummy_app/app/assets/stylesheets/application.css +0 -3
- data/test/dummy_app/app/controllers/application_controller.rb +0 -3
- data/test/dummy_app/app/controllers/reports_controller.rb +0 -37
- data/test/dummy_app/app/mailers/reports_mailer.rb +0 -18
- data/test/dummy_app/app/views/layouts/application.html.erb +0 -14
- data/test/dummy_app/app/views/reports/custom.pdf.prawn +0 -3
- data/test/dummy_app/app/views/reports/custom_disposition.pdf.prawn +0 -3
- data/test/dummy_app/app/views/reports/custom_filename.pdf.prawn +0 -3
- data/test/dummy_app/app/views/reports/sample.html.erb +0 -1
- data/test/dummy_app/app/views/reports/sample.pdf.prawn +0 -40
- data/test/dummy_app/app/views/reports/table.pdf.prawn +0 -7
- data/test/dummy_app/app/views/reports_mailer/send_report.html.erb +0 -1
- data/test/dummy_app/config/application.rb +0 -52
- data/test/dummy_app/config/boot.rb +0 -10
- data/test/dummy_app/config/database.yml +0 -25
- data/test/dummy_app/config/environment.rb +0 -5
- data/test/dummy_app/config/environments/development.rb +0 -30
- data/test/dummy_app/config/environments/production.rb +0 -60
- data/test/dummy_app/config/environments/test.rb +0 -41
- data/test/dummy_app/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy_app/config/initializers/inflections.rb +0 -10
- data/test/dummy_app/config/initializers/mime_types.rb +0 -5
- data/test/dummy_app/config/initializers/prawn-rails.rb +0 -5
- data/test/dummy_app/config/initializers/secret_token.rb +0 -11
- data/test/dummy_app/config/initializers/session_store.rb +0 -8
- data/test/dummy_app/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy_app/config/locales/en.yml +0 -5
- data/test/dummy_app/config/routes.rb +0 -9
- data/test/dummy_app/config/secrets.yml +0 -22
- data/test/dummy_app/config.ru +0 -4
- data/test/dummy_app/db/schema.rb +0 -15
- data/test/dummy_app/db/test.sqlite3 +0 -0
- data/test/dummy_app/log/test.log +0 -950
- data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/0Q/0QR6jgJcsDY23uF8NGHFYajkal8CGG4d3kOZQCD8Oj8.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/1K/1KcQYwe3g9uhY2WePD1_5P38IzP0Veu8rDPI0wXQSP8.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/3N/3NnKgR2TsTI1qCXKZpts0uJzp2dRJcoYp3nnFU6YE4o.cache +0 -2
- data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/4O/4O6Anm3R8aSIVfMhGtp5tZK3x17fcY1SbWoDN_6hb-o.cache +0 -2
- data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/4X/4XWDJRe7gZAeojFwJq7j6jJxRr152aQBfyhVtPPSHDY.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/7z/7zB4MNaDZMfwUPQ7LsLGHLt1EAx1oMCEUjywneVyoyY.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/8D/8D13-8wUZxyVgrsD9RHdWUPhLlWcqnHXtOBMOPQRX-Q.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/LR/LRLaw7viwBb9Mi_VFZxGbKIooy8Fqf1aB_iOTETsMyc.cache +0 -3
- data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/Mj/MjwYGG9GkHD1fwwH2bg66EBYl3zCA_mqeDF9otey4-U.cache +0 -3
- data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/Yr/YrGeNwkHFUXGwgJhi0aqJdEHL--OyRwU5aN5azmIXM4.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/ib/ibSeAobTqAE0a-v_-umXpnbXaIEx_WOtSsQkSRJCwwI.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/mO/mOu9n3QmqPXFbaUP-4RAuwabvsLdudRBvk9LMIOTSoI.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/vt/vtyC4n-7HZNOJV7EprjE7ThndKZkG00OVD8sO8cUFAM.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/wt/wtoVyr5IaVgQI72M_TLZFUNHeStJ5maRaHlfA8Vt6d0.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/-i/-i0h20pCtmvENM-EAyaKkJDFhjn-HuXuoE0e1sLu_rg.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/0r/0r4iTRUbzH4dQwbjPscLVpHM1SJyEKVXeCEzD_U9JYE.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/3N/3NnKgR2TsTI1qCXKZpts0uJzp2dRJcoYp3nnFU6YE4o.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/4O/4O6Anm3R8aSIVfMhGtp5tZK3x17fcY1SbWoDN_6hb-o.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/6y/6yMwFwpdEybDnrikBloKhYP4Zmo9Ry746DScoqO8mbE.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/7z/7zB4MNaDZMfwUPQ7LsLGHLt1EAx1oMCEUjywneVyoyY.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/8D/8D13-8wUZxyVgrsD9RHdWUPhLlWcqnHXtOBMOPQRX-Q.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Ac/Ac0RnYBszO_tvu-01dVJjO6aKZedDO2TVCAwpY5nE4U.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Do/Do83AoOat5W-c1g7piDGy2GMmffsY6JY0Qfuh5PY3GM.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/FD/FDmzMYru4EyGcs7Q7tsCbapZmNV-jXENb6M-UuS8GLs.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/FH/FHiO02EbiWfhKFHA3d6jTB6d50AXJzY9OjwpyzlbR3A.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Jn/JnmWS5ayWWDAiBYz39zc51V2mHFWYAlXjW-vPbehyvk.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Jr/JraYt1MnVVm8nrRu036hPHr_-BxBo2RwGcH_4XFDk9g.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/LQ/LQQTiHeHlmh1Fwvuv1Ss9ne5mXE0TOv2xaanJ40LEXA.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/LR/LRLaw7viwBb9Mi_VFZxGbKIooy8Fqf1aB_iOTETsMyc.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Mj/MjwYGG9GkHD1fwwH2bg66EBYl3zCA_mqeDF9otey4-U.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/OH/OHFQxWHvIcKq2nREonlhK8AgUKTRZ-2tDjQIRFoh400.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/QV/QVq7YZh551f-JSU-9f9VWDRJA0Wm_LcbdJfJEO45hpY.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Rx/RxPz7Gq0QcrSvjCMwAGBbCp9-4uiZixta20a-pY50G0.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Sd/SdKiVwcnL47CkgJH6d6rg8bT2jeMfr_KOpH6K-e_Rpw.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Tq/TqJjVveNs9BoMZZ0bqrtV17QUpcioQePyc75rUF8Q5U.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/WX/WXW-hCt_qs8QZgCDuLbIdi4PEZY5Dr4gkk3TG2bzIlA.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/X0/X0VVDULN8me11G85S0HRqtRtWpg2evTeD-eptzBX0Js.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/bc/bc6phGXVat2w60GIQpknrZ6UeHcwGAJkPSEyx2vzYWA.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/cc/ccsnAmW1sI8J39ktFOU92ag0Cmd98hy1nLoiYxk-ztA.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/cq/cqmOKwCIiucE1noRNr0g5M-9rOz5lOw_KfXGRITzjfM.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/dL/dLpVVClnOjqhfdUOtaPPRDGP73ARy79nba4H4B4TtkQ.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/i5/i5ZEAsQ_Rav4MDMy4ihQldRNRjQ8rSickZnnbPrf8MM.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/iv/ivPda3JMWfbu-IHENKRMM5Y-RPDGx17E-UsDHaRw2l0.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/jX/jXTNqwlV7NH3QgrxukXmrtTRmJdf7JLsLthOWuSajAk.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/oL/oL18MfHhURyZjTEiCN9pzxDO5yolnjepKPIQ3AxRtuw.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/pC/pCWceIteP62iSWMjZn19ap3KwUG6vXoQUzXAe5Pd07s.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/pv/pv6tV3CDkIAmLXdU8EPLlNEkXAKJPufVD4VP30o4fWo.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/qY/qYZa9MjWU2euhPKhmXxsJtfsHa76D0-yIqmqhhqDnWM.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/ro/roxJL7F-lfG7snTu-4sBGaTfHUu94FPZMfWpTEJq-V8.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/tV/tVR6xDtsNbiDca0JyoaKp4tirI4zYUF0RiWbw-9qyP0.cache +0 -1
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/uO/uOomFpb2HCobA5V40idjrZP3fmfIzbyS21BXqdFnonw.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/vv/vvPcNRT1bVyxTWN8IxKtvuBhxXib3G0tzztnaz6AE9k.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/wX/wX5yL9P13fJNPuZX10N7nQYMaQJl8JdZKPpsRiESJgE.cache +0 -0
- data/test/dummy_app/tmp/cache/assets/sprockets/v4.0.0/yy/yycp8-xBCXFX3VWJYNtJkJvzZD2XEejmUso7wI-7cbo.cache +0 -0
- data/test/integration/prawn_rails_test.rb +0 -105
- data/test/prawn_rails_test.rb +0 -28
- data/test/test_helper.rb +0 -16
@@ -1 +0,0 @@
|
|
1
|
-
I"�app/assets/javascripts/application.js?type=application/javascript&id=7b3a99820c71d7042d0378186f81e6ffd61c650a55f27cebcb852601ae05fa83:ET
|
@@ -1 +0,0 @@
|
|
1
|
-
I"�app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=de1f6ddbeed2af709dcf36381627b030f3002cda655cc621dcb78b60b6120a69:ET
|
@@ -1,2 +0,0 @@
|
|
1
|
-
[o:Set:
|
2
|
-
@hash}I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Lprocessors:type=application/javascript&file_type=application/javascript;TTI"8file-digest://app/assets/javascripts/application.js;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTF
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
"%�汷g�d�Q~�A�fǟ��#�R��&�j�
|
@@ -1 +0,0 @@
|
|
1
|
-
"%��B�����șo�$'�A�d��L���xR�U
|
Binary file
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
I"�app/assets/javascripts/application.js?type=application/javascript&pipeline=self&id=1111edca24b3df6c2857a3e3fe10a1fc3030827fb4be5ce1c5072f75d77c88fb:ET
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
I"}app/assets/stylesheets/application.css?type=text/css&id=1fef9fc1245c63a4668490c81d3c6c1e5b485f76b14c9805b2f4bfbb005aebfe:ET
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
I"�app/assets/javascripts/application.js?type=application/javascript&id=31ada01b5adc670124570518ac38a4f4996b80f5196e8ed6517d659ca522780c:ET
|
@@ -1 +0,0 @@
|
|
1
|
-
"%�汷g�d�Q~�A�fǟ��#�R��&�j�
|
@@ -1 +0,0 @@
|
|
1
|
-
"%��B�����șo�$'�A�d��L���xR�U
|
@@ -1 +0,0 @@
|
|
1
|
-
I"�app/assets/config/manifest.js?type=application/javascript&pipeline=self&id=b0dea7c8f76a38f177edc16de96cf530977b4d644ecb08a99885e224caa12133:ET
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
I"}app/assets/stylesheets/application.css?type=text/css&id=3623398b1322eb2043a8ed559734cca4150043d2782957122f6218ef2c4d83a8:ET
|
@@ -1 +0,0 @@
|
|
1
|
-
"%�ku9FJʚ�$M���=s���:�BwbՈ%��-�
|
@@ -1 +0,0 @@
|
|
1
|
-
I"�app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=14c01a6b2c54bdc827c4d87594713818e1524285d57db5395f0860a4e3477d20:ET
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
I"}app/assets/config/manifest.js?type=application/javascript&id=9dfd105e6b9ccdb1fb0e47b220c9ddb78042c19991f11167f36cec7c5995e794:ET
|
@@ -1 +0,0 @@
|
|
1
|
-
I"}app/assets/stylesheets/application.css?type=text/css&id=8fb5686606961dd89221bff6da586cf9cd7c9a690704713b81a3abf6c559d718:ET
|
@@ -1 +0,0 @@
|
|
1
|
-
"%��Rm�v�S3.��O�L���ڹc�ƕq�=_j�
|
@@ -1 +0,0 @@
|
|
1
|
-
I"�app/assets/config/manifest.js?type=application/javascript&pipeline=self&id=629e019a985ee72c0e5880d19cbc18e2f5281478c9b0bc0a9470a080a2c53460:ET
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
I"�app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=cff2a79ae151ef1e7b2b46eae7f0e6f07c33097402dd7a963b5f0b3cba844425:ET
|
@@ -1 +0,0 @@
|
|
1
|
-
"%��B�����șo�$'�A�d��L���xR�U
|
@@ -1 +0,0 @@
|
|
1
|
-
I"�app/assets/javascripts/application.js?type=application/javascript&id=1ec7f77957bdb819356ad38b94da3866a68f58223feb9d6489058f4f0a6b6045:ET
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
I"}app/assets/config/manifest.js?type=application/javascript&id=c61d158795bc867935d7404c7faa2e2719c150644eb158993070326a483f5557:ET
|
@@ -1 +0,0 @@
|
|
1
|
-
I"}app/assets/stylesheets/application.css?type=text/css&id=7343d9eb7e09fb13b68ee20ad5a53a65f37ce8e4a9b74d75f7c160c6073cc96a:ET
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
I"�app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=7dc10ba4fe712063fc7be8a20de64710ef87aa57645416cc2a46799f7ce270af:ET
|
Binary file
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
I"�app/assets/javascripts/application.js?type=application/javascript&pipeline=self&id=78e0287d4751b34c4c460949417daf05b54549a9a4656a77acd37fa8143edd98:ET
|
@@ -1 +0,0 @@
|
|
1
|
-
I"�app/assets/javascripts/application.js?type=application/javascript&pipeline=self&id=2f0785cbb6b4e29d0ace40424cc833c21198306bdabfc948c4ec27a197a2b07c:ET
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,105 +0,0 @@
|
|
1
|
-
### FOR RAILS TESTS
|
2
|
-
|
3
|
-
require 'test_helper'
|
4
|
-
require 'pdf/reader'
|
5
|
-
|
6
|
-
class NavigationTest < ActionDispatch::IntegrationTest
|
7
|
-
fixtures :all
|
8
|
-
|
9
|
-
def confirm_pdf_format(source)
|
10
|
-
reader = PDF::Reader.new(StringIO.new(source))
|
11
|
-
assert_not_nil(reader)
|
12
|
-
assert_equal(1, reader.page_count)
|
13
|
-
page_str = reader.pages[0].to_s
|
14
|
-
assert page_str.include?('Hello World!')
|
15
|
-
assert_not page_str.include?("<h1>Hello World!</h1>")
|
16
|
-
end
|
17
|
-
|
18
|
-
test "Registers :pdf mime type" do
|
19
|
-
assert Mime::Type.lookup_by_extension(:pdf)
|
20
|
-
end
|
21
|
-
|
22
|
-
test "Registers :prawn template handler" do
|
23
|
-
assert ActionView::Template::Handlers.extensions.include?(:prawn)
|
24
|
-
end
|
25
|
-
|
26
|
-
test "Renders html action" do
|
27
|
-
get '/reports/sample'
|
28
|
-
assert_response :success
|
29
|
-
assert_match("<h1>Hello World!</h1>", @response.body)
|
30
|
-
end
|
31
|
-
|
32
|
-
test "Renders pdf to string" do
|
33
|
-
pdf_str = ApplicationController.new.render_to_string("reports/sample.pdf", locals: {:@items => []})
|
34
|
-
|
35
|
-
confirm_pdf_format(pdf_str)
|
36
|
-
end
|
37
|
-
|
38
|
-
test "Renders sample pdf action" do
|
39
|
-
get '/reports/sample', params: {format: :pdf}
|
40
|
-
assert_response :success
|
41
|
-
|
42
|
-
confirm_pdf_format(@response.body)
|
43
|
-
end
|
44
|
-
|
45
|
-
test "Renders table pdf action using auto-required plugin Prawn-Table" do
|
46
|
-
get '/reports/table', params: {format: :pdf}
|
47
|
-
assert_response :success
|
48
|
-
|
49
|
-
reader = PDF::Reader.new(StringIO.new(@response.body))
|
50
|
-
assert_not_nil(reader)
|
51
|
-
|
52
|
-
assert_equal(1, reader.page_count)
|
53
|
-
|
54
|
-
page_str = reader.pages[0].to_s
|
55
|
-
|
56
|
-
assert_equal(page_str, "1 2 3\n\n4 5 6\n\n7 8 9")
|
57
|
-
end
|
58
|
-
|
59
|
-
test "Sets file name from '@filename' when present" do
|
60
|
-
get '/reports/ivar_filename.pdf'
|
61
|
-
|
62
|
-
disposition_header = @response.headers["Content-Disposition"]
|
63
|
-
assert disposition_header.include?("attachment")
|
64
|
-
assert disposition_header.include?("ivar-filename.pdf")
|
65
|
-
end
|
66
|
-
|
67
|
-
test "Maintains existing 'Content-Disposition' header" do
|
68
|
-
get '/reports/custom_headers.pdf'
|
69
|
-
|
70
|
-
disposition_header = @response.headers["Content-Disposition"]
|
71
|
-
assert disposition_header.include?("attachment")
|
72
|
-
assert disposition_header.include?("custom-headers.pdf")
|
73
|
-
end
|
74
|
-
|
75
|
-
test "Respects the 'filename' option alone" do
|
76
|
-
get '/reports/custom_filename.pdf'
|
77
|
-
|
78
|
-
disposition_header = @response.headers["Content-Disposition"]
|
79
|
-
assert disposition_header.include?("inline")
|
80
|
-
assert disposition_header.include?("from-options.pdf")
|
81
|
-
end
|
82
|
-
|
83
|
-
test "Respects the 'disposition' option alone" do
|
84
|
-
get '/reports/custom_disposition.pdf'
|
85
|
-
|
86
|
-
disposition_header = @response.headers["Content-Disposition"]
|
87
|
-
assert disposition_header.include?("attachment")
|
88
|
-
assert_not disposition_header.include?("filename")
|
89
|
-
end
|
90
|
-
|
91
|
-
test "Respects both options on 'prawn-document' together" do
|
92
|
-
get '/reports/custom.pdf'
|
93
|
-
|
94
|
-
disposition_header = @response.headers["Content-Disposition"]
|
95
|
-
assert disposition_header.include?("attachment")
|
96
|
-
assert disposition_header.include?("from-options.pdf")
|
97
|
-
end
|
98
|
-
|
99
|
-
test "render_to_string in mailer" do
|
100
|
-
mail = ReportsMailer.send_report
|
101
|
-
assert_equal(1, mail.attachments.size)
|
102
|
-
|
103
|
-
confirm_pdf_format(mail.attachments["report.pdf"].body.raw_source)
|
104
|
-
end
|
105
|
-
end
|
data/test/prawn_rails_test.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
### FOR GENERIC NON-RAILS TESTS
|
2
|
-
|
3
|
-
require 'test_helper'
|
4
|
-
require 'pdf/reader'
|
5
|
-
|
6
|
-
class PrawnRailsTest < ActiveSupport::TestCase
|
7
|
-
include PrawnRails::RailsHelper
|
8
|
-
|
9
|
-
test "text can take non strings" do
|
10
|
-
output = prawn_document do |pdf|
|
11
|
-
pdf.text "Number:"
|
12
|
-
pdf.text 10
|
13
|
-
end
|
14
|
-
|
15
|
-
reader = PDF::Reader.new(StringIO.new(output))
|
16
|
-
assert_not_nil(reader)
|
17
|
-
|
18
|
-
page = reader.page(1).to_s
|
19
|
-
assert page.include?("Number:\n10")
|
20
|
-
end
|
21
|
-
|
22
|
-
test "matches .PDF extension regardless of case" do
|
23
|
-
["pDf", "pdf", "PDF"].each do |ext|
|
24
|
-
@filename = "test.#{ext}"
|
25
|
-
assert_equal get_metadata[:info][:Title], "test"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
ENV["RAILS_ENV"] = "test"
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'warning'
|
5
|
-
|
6
|
-
Warning.ignore(
|
7
|
-
%r{mail/parsers/address_lists_parser}, ### Hide mail gem warnings
|
8
|
-
)
|
9
|
-
rescue LoadError
|
10
|
-
# Do nothing
|
11
|
-
end
|
12
|
-
|
13
|
-
require File.expand_path("../dummy_app/config/environment.rb", __FILE__)
|
14
|
-
require "rails/test_help"
|
15
|
-
|
16
|
-
Rails.backtrace_cleaner.remove_silencers!
|