pdfcraft 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
1
+ require 'test_helper'
2
+
3
+ class ConfigurationTest < ActionDispatch::IntegrationTest
4
+
5
+ test "rendering with a configured pdf variable" do
6
+ get renamed_var_path(format: :pdf)
7
+
8
+ assert_equal "Rendered by a renamed var", pdf.page(1).text
9
+ end
10
+
11
+ setup do
12
+ Pdfcraft.variable_name = '__pdf__'
13
+ end
14
+
15
+ teardown do
16
+ Pdfcraft.variable_name = 'pdf'
17
+ end
18
+ end
@@ -47,9 +47,11 @@ class PdfRenderingTest < ActionDispatch::IntegrationTest
47
47
  assert_equal [0,0,792,612].map(&:to_f), pdf.page(1).attributes[:MediaBox]
48
48
  end
49
49
 
50
- private
50
+ test "pdf can use rails layouts for header and footer" do
51
+ get pdf_layout_path(format: :pdf)
51
52
 
52
- def pdf
53
- @pdf ||= PDF::Reader.new(StringIO.new(response.body))
53
+ assert_match "Header", pdf.page(1).text
54
+ assert_match "Footer", pdf.page(1).text
54
55
  end
56
+
55
57
  end
@@ -13,3 +13,11 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
13
13
  if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
14
  ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
15
  end
16
+
17
+ ActionDispatch::IntegrationTest.class_eval do
18
+
19
+ def pdf
20
+ @pdf ||= PDF::Reader.new(StringIO.new(response.body))
21
+ end
22
+
23
+ end
metadata CHANGED
@@ -1,83 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdfcraft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan L. Bell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-01 00:00:00.000000000 Z
11
+ date: 2014-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 4.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 4.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: prawn
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0.13'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.13'
41
- - !ruby/object:Gem::Dependency
42
- name: sqlite3
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '>='
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: guard
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - '>='
45
+ - - ">="
60
46
  - !ruby/object:Gem::Version
61
47
  version: '0'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - '>='
52
+ - - ">="
67
53
  - !ruby/object:Gem::Version
68
54
  version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: guard-minitest
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - '>='
59
+ - - ">="
74
60
  - !ruby/object:Gem::Version
75
61
  version: '0'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - '>='
66
+ - - ">="
81
67
  - !ruby/object:Gem::Version
82
68
  version: '0'
83
69
  description: PDFCraft adds templated rendering of PDF documents to Rails. Now PDF
@@ -88,6 +74,7 @@ executables: []
88
74
  extensions: []
89
75
  extra_rdoc_files: []
90
76
  files:
77
+ - CHANGELOG.rdoc
91
78
  - MIT-LICENSE
92
79
  - README.rdoc
93
80
  - Rakefile
@@ -109,14 +96,15 @@ files:
109
96
  - test/dummy/app/views/home/index.pdf.pdfcraft
110
97
  - test/dummy/app/views/home/partials.pdf.pdfcraft
111
98
  - test/dummy/app/views/home/pdf_layout.pdf.pdfcraft
99
+ - test/dummy/app/views/home/renamed_var.pdf.pdfcraft
112
100
  - test/dummy/app/views/layouts/application.html.erb
101
+ - test/dummy/app/views/layouts/application.pdf.pdfcraft
113
102
  - test/dummy/bin/bundle
114
103
  - test/dummy/bin/rails
115
104
  - test/dummy/bin/rake
116
105
  - test/dummy/config.ru
117
106
  - test/dummy/config/application.rb
118
107
  - test/dummy/config/boot.rb
119
- - test/dummy/config/database.yml
120
108
  - test/dummy/config/environment.rb
121
109
  - test/dummy/config/environments/development.rb
122
110
  - test/dummy/config/environments/production.rb
@@ -130,14 +118,13 @@ files:
130
118
  - test/dummy/config/initializers/wrap_parameters.rb
131
119
  - test/dummy/config/locales/en.yml
132
120
  - test/dummy/config/routes.rb
133
- - test/dummy/db/development.sqlite3
134
- - test/dummy/db/test.sqlite3
135
121
  - test/dummy/log/development.log
136
122
  - test/dummy/log/test.log
137
123
  - test/dummy/public/404.html
138
124
  - test/dummy/public/422.html
139
125
  - test/dummy/public/500.html
140
126
  - test/dummy/public/favicon.ico
127
+ - test/integration/configuration_test.rb
141
128
  - test/integration/pdf_rendering_test.rb
142
129
  - test/pdfcraft_test.rb
143
130
  - test/test_helper.rb
@@ -150,12 +137,12 @@ require_paths:
150
137
  - lib
151
138
  required_ruby_version: !ruby/object:Gem::Requirement
152
139
  requirements:
153
- - - '>='
140
+ - - ">="
154
141
  - !ruby/object:Gem::Version
155
142
  version: '0'
156
143
  required_rubygems_version: !ruby/object:Gem::Requirement
157
144
  requirements:
158
- - - '>='
145
+ - - ">="
159
146
  - !ruby/object:Gem::Version
160
147
  version: '0'
161
148
  requirements: []
@@ -175,13 +162,14 @@ test_files:
175
162
  - test/dummy/app/views/home/index.pdf.pdfcraft
176
163
  - test/dummy/app/views/home/partials.pdf.pdfcraft
177
164
  - test/dummy/app/views/home/pdf_layout.pdf.pdfcraft
165
+ - test/dummy/app/views/home/renamed_var.pdf.pdfcraft
178
166
  - test/dummy/app/views/layouts/application.html.erb
167
+ - test/dummy/app/views/layouts/application.pdf.pdfcraft
179
168
  - test/dummy/bin/bundle
180
169
  - test/dummy/bin/rails
181
170
  - test/dummy/bin/rake
182
171
  - test/dummy/config/application.rb
183
172
  - test/dummy/config/boot.rb
184
- - test/dummy/config/database.yml
185
173
  - test/dummy/config/environment.rb
186
174
  - test/dummy/config/environments/development.rb
187
175
  - test/dummy/config/environments/production.rb
@@ -196,8 +184,6 @@ test_files:
196
184
  - test/dummy/config/locales/en.yml
197
185
  - test/dummy/config/routes.rb
198
186
  - test/dummy/config.ru
199
- - test/dummy/db/development.sqlite3
200
- - test/dummy/db/test.sqlite3
201
187
  - test/dummy/log/development.log
202
188
  - test/dummy/log/test.log
203
189
  - test/dummy/public/404.html
@@ -206,6 +192,7 @@ test_files:
206
192
  - test/dummy/public/favicon.ico
207
193
  - test/dummy/Rakefile
208
194
  - test/dummy/README.rdoc
195
+ - test/integration/configuration_test.rb
209
196
  - test/integration/pdf_rendering_test.rb
210
197
  - test/pdfcraft_test.rb
211
198
  - test/test_helper.rb
@@ -1,25 +0,0 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- development:
7
- adapter: sqlite3
8
- database: db/development.sqlite3
9
- pool: 5
10
- timeout: 5000
11
-
12
- # Warning: The database defined as "test" will be erased and
13
- # re-generated from your development database when you run "rake".
14
- # Do not set this db to the same as development or production.
15
- test:
16
- adapter: sqlite3
17
- database: db/test.sqlite3
18
- pool: 5
19
- timeout: 5000
20
-
21
- production:
22
- adapter: sqlite3
23
- database: db/production.sqlite3
24
- pool: 5
25
- timeout: 5000
File without changes
File without changes