prawn_cocktail 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,10 +7,10 @@ require_relative "renderer"
7
7
  module PrawnCocktail
8
8
  class Document
9
9
  class_attribute :doc_initializers
10
- self.doc_initializers ||= []
10
+ self.doc_initializers = []
11
11
 
12
12
  def self.initialize_document(&block)
13
- self.doc_initializers << block
13
+ self.doc_initializers += [block]
14
14
  end
15
15
 
16
16
  def self.helper(mod)
@@ -1,3 +1,3 @@
1
1
  module PrawnCocktail
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
@@ -18,3 +18,7 @@ class TestDocument < PrawnCocktail::Document
18
18
  { status: @status }
19
19
  end
20
20
  end
21
+
22
+ class SubTestDocument < TestDocument
23
+ initialize_document { text "Sub-init works." }
24
+ end
@@ -0,0 +1,6 @@
1
+ meta page_size: "A4"
2
+
3
+ content do |data|
4
+ text "Sub test document"
5
+ status_line data.status
6
+ end
@@ -36,8 +36,22 @@ describe PrawnCocktail do
36
36
  assert_document_has_the_right_geometry
37
37
  end
38
38
  end
39
+
40
+ describe "inheriting documents" do
41
+ let(:data) do
42
+ SubTestDocument.new("success").render
43
+ end
44
+
45
+ it "inherits initializers and helpers" do
46
+ assert_equal(
47
+ [ "Init works.", "Sub-init works.", "Sub test document", "Status: success" ],
48
+ parse_strings(data)
49
+ )
50
+ end
51
+ end
39
52
  end
40
53
 
54
+
41
55
  def assert_document_has_the_right_contents
42
56
  assert_equal(
43
57
  [ "Init works.", "Test document", "Status: success" ],
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn_cocktail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-02-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: prawn
16
- requirement: &70204700961000 !ruby/object:Gem::Requirement
16
+ requirement: &70243544258740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70204700961000
24
+ version_requirements: *70243544258740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &70204700960520 !ruby/object:Gem::Requirement
27
+ requirement: &70243544274560 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70204700960520
35
+ version_requirements: *70243544274560
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70204700774940 !ruby/object:Gem::Requirement
38
+ requirement: &70243544274080 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70204700774940
46
+ version_requirements: *70243544274080
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: pdf-inspector
49
- requirement: &70204700774460 !ruby/object:Gem::Requirement
49
+ requirement: &70243544273600 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70204700774460
57
+ version_requirements: *70243544273600
58
58
  description:
59
59
  email:
60
60
  - henrik@barsoom.se
@@ -75,6 +75,7 @@ files:
75
75
  - lib/prawn_cocktail/version.rb
76
76
  - prawn_cocktail.gemspec
77
77
  - spec/fixtures/document.rb
78
+ - spec/fixtures/sub_test_document.pdf.rb
78
79
  - spec/fixtures/test_document.pdf.rb
79
80
  - spec/integration_spec.rb
80
81
  homepage: ''
@@ -103,6 +104,7 @@ specification_version: 3
103
104
  summary: Simple documents, templates and helpers on top of Prawn.
104
105
  test_files:
105
106
  - spec/fixtures/document.rb
107
+ - spec/fixtures/sub_test_document.pdf.rb
106
108
  - spec/fixtures/test_document.pdf.rb
107
109
  - spec/integration_spec.rb
108
110
  has_rdoc: