prawn 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +7 -5
  3. data/lib/prawn.rb +4 -4
  4. data/lib/prawn/document.rb +47 -46
  5. data/lib/prawn/document/bounding_box.rb +13 -19
  6. data/lib/prawn/document/column_box.rb +3 -5
  7. data/lib/prawn/document/internals.rb +0 -1
  8. data/lib/prawn/document/span.rb +12 -12
  9. data/lib/prawn/errors.rb +32 -33
  10. data/lib/prawn/font.rb +29 -36
  11. data/lib/prawn/font/afm.rb +20 -20
  12. data/lib/prawn/font/dfont.rb +0 -1
  13. data/lib/prawn/font/ttf.rb +30 -27
  14. data/lib/prawn/font_metric_cache.rb +4 -8
  15. data/lib/prawn/graphics.rb +37 -42
  16. data/lib/prawn/graphics/cap_style.rb +1 -1
  17. data/lib/prawn/graphics/color.rb +21 -23
  18. data/lib/prawn/graphics/dash.rb +5 -6
  19. data/lib/prawn/graphics/join_style.rb +1 -2
  20. data/lib/prawn/graphics/patterns.rb +25 -21
  21. data/lib/prawn/graphics/transformation.rb +4 -5
  22. data/lib/prawn/graphics/transparency.rb +6 -8
  23. data/lib/prawn/grid.rb +21 -14
  24. data/lib/prawn/image_handler.rb +2 -2
  25. data/lib/prawn/images.rb +29 -31
  26. data/lib/prawn/images/image.rb +1 -1
  27. data/lib/prawn/images/jpg.rb +10 -12
  28. data/lib/prawn/images/png.rb +13 -13
  29. data/lib/prawn/measurements.rb +7 -14
  30. data/lib/prawn/outline.rb +6 -6
  31. data/lib/prawn/repeater.rb +1 -5
  32. data/lib/prawn/security.rb +17 -25
  33. data/lib/prawn/security/arcfour.rb +1 -1
  34. data/lib/prawn/soft_mask.rb +11 -12
  35. data/lib/prawn/stamp.rb +16 -8
  36. data/lib/prawn/text.rb +23 -20
  37. data/lib/prawn/text/box.rb +3 -6
  38. data/lib/prawn/text/formatted/arranger.rb +9 -12
  39. data/lib/prawn/text/formatted/box.rb +23 -22
  40. data/lib/prawn/text/formatted/fragment.rb +0 -4
  41. data/lib/prawn/text/formatted/line_wrap.rb +13 -24
  42. data/lib/prawn/text/formatted/parser.rb +16 -20
  43. data/lib/prawn/text/formatted/wrap.rb +2 -7
  44. data/lib/prawn/utilities.rb +6 -3
  45. data/lib/prawn/version.rb +1 -1
  46. data/manual/basic_concepts/basic_concepts.rb +0 -2
  47. data/manual/basic_concepts/view.rb +1 -1
  48. data/manual/bounding_box/bounding_box.rb +0 -3
  49. data/manual/bounding_box/russian_boxes.rb +7 -8
  50. data/manual/bounding_box/stretchy.rb +0 -1
  51. data/manual/contents.rb +2 -2
  52. data/manual/cover.rb +11 -12
  53. data/manual/document_and_page_options/document_and_page_options.rb +2 -5
  54. data/manual/document_and_page_options/metadata.rb +10 -10
  55. data/manual/document_and_page_options/page_size.rb +0 -1
  56. data/manual/graphics/fill_rules.rb +5 -4
  57. data/manual/graphics/graphics.rb +0 -3
  58. data/manual/graphics/lines_and_curves.rb +1 -1
  59. data/manual/graphics/rotate.rb +0 -2
  60. data/manual/graphics/scale.rb +4 -2
  61. data/manual/graphics/soft_masks.rb +0 -1
  62. data/manual/graphics/stroke_cap.rb +1 -1
  63. data/manual/graphics/stroke_join.rb +1 -1
  64. data/manual/graphics/translate.rb +3 -3
  65. data/manual/graphics/transparency.rb +0 -1
  66. data/manual/how_to_read_this_manual.rb +0 -1
  67. data/manual/images/images.rb +0 -3
  68. data/manual/layout/boxes.rb +5 -5
  69. data/manual/layout/content.rb +2 -2
  70. data/manual/layout/layout.rb +0 -3
  71. data/manual/outline/outline.rb +0 -3
  72. data/manual/repeatable_content/page_numbering.rb +1 -1
  73. data/manual/repeatable_content/repeatable_content.rb +0 -3
  74. data/manual/repeatable_content/repeater.rb +6 -6
  75. data/manual/security/encryption.rb +0 -2
  76. data/manual/security/permissions.rb +0 -2
  77. data/manual/security/security.rb +0 -3
  78. data/manual/text/alignment.rb +3 -3
  79. data/manual/text/color.rb +0 -1
  80. data/manual/text/column_box.rb +0 -1
  81. data/manual/text/fallback_fonts.rb +2 -2
  82. data/manual/text/formatted_callbacks.rb +3 -2
  83. data/manual/text/paragraph_indentation.rb +2 -3
  84. data/manual/text/registering_families.rb +13 -9
  85. data/manual/text/rotation.rb +0 -1
  86. data/manual/text/text.rb +0 -3
  87. data/manual/text/text_box_overflow.rb +7 -5
  88. data/manual/text/utf8.rb +1 -1
  89. data/manual/text/win_ansi_charset.rb +2 -2
  90. data/prawn.gemspec +4 -4
  91. data/spec/acceptance/png.rb +6 -7
  92. data/spec/annotations_spec.rb +21 -28
  93. data/spec/bounding_box_spec.rb +100 -109
  94. data/spec/column_box_spec.rb +26 -32
  95. data/spec/destinations_spec.rb +2 -4
  96. data/spec/document_spec.rb +145 -151
  97. data/spec/extensions/mocha.rb +0 -1
  98. data/spec/font_metric_cache_spec.rb +7 -7
  99. data/spec/font_spec.rb +103 -102
  100. data/spec/formatted_text_arranger_spec.rb +76 -74
  101. data/spec/formatted_text_box_spec.rb +170 -159
  102. data/spec/formatted_text_fragment_spec.rb +57 -56
  103. data/spec/graphics_spec.rb +158 -175
  104. data/spec/grid_spec.rb +28 -29
  105. data/spec/image_handler_spec.rb +4 -5
  106. data/spec/images_spec.rb +50 -36
  107. data/spec/inline_formatted_text_parser_spec.rb +397 -393
  108. data/spec/jpg_spec.rb +4 -6
  109. data/spec/line_wrap_spec.rb +54 -55
  110. data/spec/measurement_units_spec.rb +12 -15
  111. data/spec/outline_spec.rb +77 -98
  112. data/spec/png_spec.rb +55 -65
  113. data/spec/reference_spec.rb +3 -3
  114. data/spec/repeater_spec.rb +20 -26
  115. data/spec/security_spec.rb +42 -49
  116. data/spec/soft_mask_spec.rb +4 -5
  117. data/spec/span_spec.rb +5 -6
  118. data/spec/spec_helper.rb +2 -4
  119. data/spec/stamp_spec.rb +41 -22
  120. data/spec/stroke_styles_spec.rb +36 -39
  121. data/spec/text_at_spec.rb +28 -29
  122. data/spec/text_box_spec.rb +160 -165
  123. data/spec/text_rendering_mode_spec.rb +9 -9
  124. data/spec/text_spacing_spec.rb +13 -13
  125. data/spec/text_spec.rb +116 -124
  126. data/spec/text_with_inline_formatting_spec.rb +5 -5
  127. data/spec/transparency_spec.rb +20 -20
  128. data/spec/view_spec.rb +0 -1
  129. metadata +7 -7
@@ -21,14 +21,13 @@ module SoftMaskHelper
21
21
  end
22
22
 
23
23
  describe "Document with soft masks" do
24
-
25
24
  include SoftMaskHelper
26
25
 
27
26
  it "should have PDF version at least 1.4" do
28
27
  create_pdf
29
28
  make_soft_mask
30
29
  str = @pdf.render
31
- str[0,8].should == "%PDF-1.4"
30
+ expect(str[0, 8]).to eq("%PDF-1.4")
32
31
  end
33
32
 
34
33
  it "should create a new extended graphics state for each unique soft mask" do
@@ -45,7 +44,7 @@ describe "Document with soft masks" do
45
44
  end
46
45
 
47
46
  extgstates = PDF::Inspector::ExtGState.analyze(@pdf.render).extgstates
48
- extgstates.length.should == 2
47
+ expect(extgstates.length).to eq(2)
49
48
  end
50
49
 
51
50
  it "a new extended graphics state should contain soft mask with drawing instructions" do
@@ -57,7 +56,7 @@ describe "Document with soft masks" do
57
56
  end
58
57
 
59
58
  extgstate = PDF::Inspector::ExtGState.analyze(@pdf.render).extgstates.first
60
- extgstate[:soft_mask][:G].data.should == "q\n/DeviceRGB cs\n0.000 0.000 0.000 scn\n/DeviceRGB CS\n0.000 0.000 0.000 SCN\n1 w\n0 J\n0 j\n[] 0 d\n/DeviceRGB cs\n0.502 0.502 0.502 scn\n100.0 -100.0 200.0 200.0 re\nf\nQ\n"
59
+ expect(extgstate[:soft_mask][:G].data).to eq("q\n/DeviceRGB cs\n0.000 0.000 0.000 scn\n/DeviceRGB CS\n0.000 0.000 0.000 SCN\n1 w\n0 J\n0 j\n[] 0 d\n/DeviceRGB cs\n0.502 0.502 0.502 scn\n100.0 -100.0 200.0 200.0 re\nf\nQ\n")
61
60
  end
62
61
 
63
62
  it "should not create duplicate extended graphics states" do
@@ -74,6 +73,6 @@ describe "Document with soft masks" do
74
73
  end
75
74
 
76
75
  extgstates = PDF::Inspector::ExtGState.analyze(@pdf.render).extgstates
77
- extgstates.length.should == 1
76
+ expect(extgstates.length).to eq(1)
78
77
  end
79
78
  end
@@ -3,7 +3,6 @@
3
3
  require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
4
4
 
5
5
  describe "drawing span" do
6
-
7
6
  before do
8
7
  Prawn.debug = false
9
8
  create_pdf
@@ -15,11 +14,11 @@ describe "drawing span" do
15
14
 
16
15
  it "should only accept :position as option in debug mode" do
17
16
  Prawn.debug = true
18
- lambda { @pdf.span(350, {:x => 3}) {} }.should raise_error(Prawn::Errors::UnknownOption)
17
+ expect { @pdf.span(350, :x => 3) {} }.to raise_error(Prawn::Errors::UnknownOption)
19
18
  end
20
19
 
21
20
  it "should have raise an error if :position is invalid" do
22
- lambda { @pdf.span(350, :position => :x) {} }.should raise_error(ArgumentError)
21
+ expect { @pdf.span(350, :position => :x) {} }.to raise_error(ArgumentError)
23
22
  end
24
23
 
25
24
  it "should restore the margin box when bounding box exits" do
@@ -29,7 +28,7 @@ describe "drawing span" do
29
28
  @pdf.text "Here's some centered text in a 350 point column. " * 100
30
29
  end
31
30
 
32
- @pdf.bounds.should == margin_box
31
+ expect(@pdf.bounds).to eq(margin_box)
33
32
  end
34
33
 
35
34
  it "should do create a margin box" do
@@ -38,7 +37,7 @@ describe "drawing span" do
38
37
  @pdf.text "Here's some centered text in a 350 point column. " * 100
39
38
  end
40
39
 
41
- margin_box.top.should == 792.0
42
- margin_box.bottom.should == 0
40
+ expect(margin_box.top).to eq(792.0)
41
+ expect(margin_box.bottom).to eq(0)
43
42
  end
44
43
  end
@@ -17,7 +17,6 @@ require_relative "../lib/prawn"
17
17
  Prawn.debug = true
18
18
  Prawn::Font::AFM.hide_m17n_warning = true
19
19
 
20
- #require "test/spec"
21
20
  require "rspec"
22
21
  require "mocha/api"
23
22
  require "pdf/reader"
@@ -25,7 +24,7 @@ require "pdf/inspector"
25
24
 
26
25
  # Requires supporting ruby files with custom matchers and macros, etc,
27
26
  # in spec/extensions/ and its subdirectories.
28
- Dir[File.dirname(__FILE__) + "/extensions/**/*.rb"].each {|f| require f }
27
+ Dir[File.dirname(__FILE__) + "/extensions/**/*.rb"].each { |f| require f }
29
28
 
30
29
  RSpec.configure do |config|
31
30
  config.mock_framework = :mocha
@@ -33,7 +32,7 @@ RSpec.configure do |config|
33
32
  config.treat_symbols_as_metadata_keys_with_true_values = true
34
33
  end
35
34
 
36
- def create_pdf(klass=Prawn::Document)
35
+ def create_pdf(klass = Prawn::Document)
37
36
  @pdf = klass.new(:margin => 0)
38
37
  end
39
38
 
@@ -51,4 +50,3 @@ end
51
50
  module Prawn::Graphics
52
51
  public :map_to_absolute
53
52
  end
54
-
@@ -31,26 +31,26 @@ describe "#stamp_at" do
31
31
  # invoke_xobject message and count the number of times it was
32
32
  # called, but it was only called once, so I reverted checking the
33
33
  # output with a regular expression
34
- @pdf.render.should =~ /\/Stamp1 Do.*?/m
34
+ expect(@pdf.render).to match(/\/Stamp1 Do.*?/m)
35
35
  end
36
36
  end
37
37
 
38
38
  describe "Document with a stamp" do
39
- it "should raise_error NameTaken error when attempt to create stamp "+
39
+ it "should raise_error NameTaken error when attempt to create stamp " \
40
40
  "with same name as an existing stamp" do
41
41
  create_pdf
42
42
  @pdf.create_stamp("MyStamp")
43
- lambda {
43
+ expect {
44
44
  @pdf.create_stamp("MyStamp")
45
- }.should raise_error(Prawn::Errors::NameTaken)
45
+ }.to raise_error(Prawn::Errors::NameTaken)
46
46
  end
47
47
 
48
- it "should raise_error InvalidName error when attempt to create "+
48
+ it "should raise_error InvalidName error when attempt to create " \
49
49
  "stamp with a blank name" do
50
50
  create_pdf
51
- lambda {
51
+ expect {
52
52
  @pdf.create_stamp("")
53
- }.should raise_error(Prawn::Errors::InvalidName)
53
+ }.to raise_error(Prawn::Errors::InvalidName)
54
54
  end
55
55
 
56
56
  it "a new XObject should be defined for each stamp created" do
@@ -62,16 +62,16 @@ describe "Document with a stamp" do
62
62
 
63
63
  inspector = PDF::Inspector::XObject.analyze(@pdf.render)
64
64
  xobjects = inspector.page_xobjects.last
65
- xobjects.length.should == 2
65
+ expect(xobjects.length).to eq(2)
66
66
  end
67
67
 
68
- it "calling stamp with a name that does not match an existing stamp "+
68
+ it "calling stamp with a name that does not match an existing stamp " \
69
69
  "should raise_error UndefinedObjectName" do
70
70
  create_pdf
71
71
  @pdf.create_stamp("MyStamp")
72
- lambda {
72
+ expect {
73
73
  @pdf.stamp("OtherStamp")
74
- }.should raise_error(Prawn::Errors::UndefinedObjectName)
74
+ }.to raise_error(Prawn::Errors::UndefinedObjectName)
75
75
  end
76
76
 
77
77
  it "stamp should be drawn into the document each time stamp is called" do
@@ -84,14 +84,33 @@ describe "Document with a stamp" do
84
84
  # invoke_xobject message and count the number of times it was
85
85
  # called, but it was only called once, so I reverted checking the
86
86
  # output with a regular expression
87
- @pdf.render.should =~ /(\/Stamp1 Do.*?){3}/m
87
+ expect(@pdf.render).to match(/(\/Stamp1 Do.*?){3}/m)
88
88
  end
89
89
 
90
- it "resources added during stamp creation should be added to the "+
90
+ it "stamp should render clickable links" do
91
+ create_pdf
92
+ @pdf.create_stamp 'bar' do
93
+ @pdf.text '<b>Prawn</b> <link href="http://github.com">GitHub</link>', inline_format: true
94
+ end
95
+ @pdf.stamp 'bar'
96
+
97
+ output = @pdf.render
98
+ objects = output.split("endobj")
99
+
100
+ objects.each do |obj|
101
+ if obj =~ /\/Type \/Page$/
102
+ # The page object must contain the annotation reference
103
+ # to render a clickable link
104
+ expect(obj).to match(/^\/Annots \[\d \d .\]$/)
105
+ end
106
+ end
107
+ end
108
+
109
+ it "resources added during stamp creation should be added to the " \
91
110
  "stamp XObject, not the page" do
92
111
  create_pdf
93
112
  @pdf.create_stamp("MyStamp") do
94
- @pdf.transparent(0.5) { @pdf.circle([100, 100], 10)}
113
+ @pdf.transparent(0.5) { @pdf.circle([100, 100], 10) }
95
114
  end
96
115
  @pdf.stamp("MyStamp")
97
116
 
@@ -102,9 +121,9 @@ describe "Document with a stamp" do
102
121
  objects = output.split("endobj")
103
122
  objects.each do |object|
104
123
  if object =~ /\/Type \/Page$/
105
- object.should_not =~ /\/ExtGState/
124
+ expect(object).not_to match(/\/ExtGState/)
106
125
  elsif object =~ /\/Type \/XObject$/
107
- object.should =~ /\/ExtGState/
126
+ expect(object).to match(/\/ExtGState/)
108
127
  end
109
128
  end
110
129
  end
@@ -116,12 +135,12 @@ describe "Document with a stamp" do
116
135
  end
117
136
  @pdf.stamp("MyStamp")
118
137
  stamps = PDF::Inspector::XObject.analyze(@pdf.render)
119
- stamps.xobject_streams[:Stamp1].data.chomp.should =~ /q(.|\s)*Q\Z/
138
+ expect(stamps.xobject_streams[:Stamp1].data.chomp).to match(/q(.|\s)*Q\Z/)
120
139
  end
121
140
 
122
141
  it "should not add to the page graphic state stack " do
123
142
  create_pdf
124
- @pdf.state.page.stack.stack.size.should == 1
143
+ expect(@pdf.state.page.stack.stack.size).to eq(1)
125
144
 
126
145
  @pdf.create_stamp("MyStamp") do
127
146
  @pdf.save_graphics_state
@@ -130,7 +149,7 @@ describe "Document with a stamp" do
130
149
  @pdf.text "This should have a 'q' before it and a 'Q' after it"
131
150
  @pdf.restore_graphics_state
132
151
  end
133
- @pdf.state.page.stack.stack.size.should == 1
152
+ expect(@pdf.state.page.stack.stack.size).to eq(1)
134
153
  end
135
154
 
136
155
  it "should be able to change fill and stroke colors within the stamp stream" do
@@ -142,8 +161,8 @@ describe "Document with a stamp" do
142
161
  @pdf.stamp("MyStamp")
143
162
  stamps = PDF::Inspector::XObject.analyze(@pdf.render)
144
163
  stamp_stream = stamps.xobject_streams[:Stamp1].data
145
- stamp_stream.should include("/DeviceCMYK cs\n1.000 1.000 0.200 0.000 scn")
146
- stamp_stream.should include("/DeviceCMYK CS\n1.000 1.000 0.200 0.000 SCN")
164
+ expect(stamp_stream).to include("/DeviceCMYK cs\n1.000 1.000 0.200 0.000 scn")
165
+ expect(stamp_stream).to include("/DeviceCMYK CS\n1.000 1.000 0.200 0.000 SCN")
147
166
  end
148
167
 
149
168
  it "should save the color space even when same as current page color space" do
@@ -155,6 +174,6 @@ describe "Document with a stamp" do
155
174
  @pdf.stamp("MyStamp")
156
175
  stamps = PDF::Inspector::XObject.analyze(@pdf.render)
157
176
  stamp_stream = stamps.xobject_streams[:Stamp1].data
158
- stamp_stream.should include("/DeviceCMYK CS\n1.000 1.000 0.200 0.000 SCN")
177
+ expect(stamp_stream).to include("/DeviceCMYK CS\n1.000 1.000 0.200 0.000 SCN")
159
178
  end
160
179
  end
@@ -5,15 +5,15 @@ require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
5
5
  describe "When stroking with default settings" do
6
6
  before(:each) { create_pdf }
7
7
  it "cap_style should be :butt" do
8
- @pdf.cap_style.should == :butt
8
+ expect(@pdf.cap_style).to eq(:butt)
9
9
  end
10
10
 
11
11
  it "join_style should be :miter" do
12
- @pdf.join_style.should == :miter
12
+ expect(@pdf.join_style).to eq(:miter)
13
13
  end
14
14
 
15
15
  it "dashed? should be_false" do
16
- @pdf.should_not be_dashed
16
+ expect(@pdf).not_to be_dashed
17
17
  end
18
18
  end
19
19
 
@@ -22,14 +22,14 @@ describe "Cap styles" do
22
22
 
23
23
  it "should be able to use assignment operator" do
24
24
  @pdf.cap_style = :round
25
- @pdf.cap_style.should == :round
25
+ expect(@pdf.cap_style).to eq(:round)
26
26
  end
27
27
 
28
28
  describe "#cap_style(:butt)" do
29
29
  it "rendered PDF should include butt style cap" do
30
30
  @pdf.cap_style(:butt)
31
31
  cap_style = PDF::Inspector::Graphics::CapStyle.analyze(@pdf.render).cap_style
32
- cap_style.should == 0
32
+ expect(cap_style).to eq(0)
33
33
  end
34
34
  end
35
35
 
@@ -37,7 +37,7 @@ describe "Cap styles" do
37
37
  it "rendered PDF should include round style cap" do
38
38
  @pdf.cap_style(:round)
39
39
  cap_style = PDF::Inspector::Graphics::CapStyle.analyze(@pdf.render).cap_style
40
- cap_style.should == 1
40
+ expect(cap_style).to eq(1)
41
41
  end
42
42
  end
43
43
 
@@ -45,7 +45,7 @@ describe "Cap styles" do
45
45
  it "rendered PDF should include projecting_square style cap" do
46
46
  @pdf.cap_style(:projecting_square)
47
47
  cap_style = PDF::Inspector::Graphics::CapStyle.analyze(@pdf.render).cap_style
48
- cap_style.should == 2
48
+ expect(cap_style).to eq(2)
49
49
  end
50
50
  end
51
51
 
@@ -53,8 +53,8 @@ describe "Cap styles" do
53
53
  @pdf.cap_style(:round)
54
54
  @pdf.start_new_page
55
55
  cap_styles = PDF::Inspector::Graphics::CapStyle.analyze(@pdf.render)
56
- cap_styles.cap_style_count.should == 2
57
- cap_styles.cap_style.should == 1
56
+ expect(cap_styles.cap_style_count).to eq(2)
57
+ expect(cap_styles.cap_style).to eq(1)
58
58
  end
59
59
  end
60
60
 
@@ -63,14 +63,14 @@ describe "Join styles" do
63
63
 
64
64
  it "should be able to use assignment operator" do
65
65
  @pdf.join_style = :round
66
- @pdf.join_style.should == :round
66
+ expect(@pdf.join_style).to eq(:round)
67
67
  end
68
68
 
69
69
  describe "#join_style(:miter)" do
70
70
  it "rendered PDF should include miter style join" do
71
71
  @pdf.join_style(:miter)
72
72
  join_style = PDF::Inspector::Graphics::JoinStyle.analyze(@pdf.render).join_style
73
- join_style.should == 0
73
+ expect(join_style).to eq(0)
74
74
  end
75
75
  end
76
76
 
@@ -78,7 +78,7 @@ describe "Join styles" do
78
78
  it "rendered PDF should include round style join" do
79
79
  @pdf.join_style(:round)
80
80
  join_style = PDF::Inspector::Graphics::JoinStyle.analyze(@pdf.render).join_style
81
- join_style.should == 1
81
+ expect(join_style).to eq(1)
82
82
  end
83
83
  end
84
84
 
@@ -86,7 +86,7 @@ describe "Join styles" do
86
86
  it "rendered PDF should include bevel style join" do
87
87
  @pdf.join_style(:bevel)
88
88
  join_style = PDF::Inspector::Graphics::JoinStyle.analyze(@pdf.render).join_style
89
- join_style.should == 2
89
+ expect(join_style).to eq(2)
90
90
  end
91
91
  end
92
92
 
@@ -94,28 +94,28 @@ describe "Join styles" do
94
94
  @pdf.join_style(:round)
95
95
  @pdf.start_new_page
96
96
  join_styles = PDF::Inspector::Graphics::JoinStyle.analyze(@pdf.render)
97
- join_styles.join_style_count.should == 2
98
- join_styles.join_style.should == 1
97
+ expect(join_styles.join_style_count).to eq(2)
98
+ expect(join_styles.join_style).to eq(1)
99
99
  end
100
100
  end
101
101
 
102
102
  describe "Dashes" do
103
103
  before(:each) { create_pdf }
104
104
 
105
- it "should be able to use assignment operator" do
106
- @pdf.dash = 2
107
- @pdf.should be_dashed
105
+ it "should be able to use assignment operator" do
106
+ @pdf.dash = 2
107
+ expect(@pdf).to be_dashed
108
108
  end
109
109
 
110
110
  describe "setting a dash" do
111
111
  it "dashed? should be_true" do
112
112
  @pdf.dash(2)
113
- @pdf.should be_dashed
113
+ expect(@pdf).to be_dashed
114
114
  end
115
115
  it "rendered PDF should include a stroked dash" do
116
116
  @pdf.dash(2)
117
117
  dashes = PDF::Inspector::Graphics::Dash.analyze(@pdf.render)
118
- dashes.stroke_dash.should == [[2, 2], 0]
118
+ expect(dashes.stroke_dash).to eq([[2, 2], 0])
119
119
  end
120
120
  end
121
121
 
@@ -123,7 +123,7 @@ describe "Dashes" do
123
123
  it "space between dashes should be the same length as the dash in the rendered PDF" do
124
124
  @pdf.dash(2)
125
125
  dashes = PDF::Inspector::Graphics::Dash.analyze(@pdf.render)
126
- dashes.stroke_dash.should == [[2, 2], 0]
126
+ expect(dashes.stroke_dash).to eq([[2, 2], 0])
127
127
  end
128
128
  end
129
129
 
@@ -131,7 +131,7 @@ describe "Dashes" do
131
131
  it "space between dashes in the rendered PDF should be different length than the length of the dash" do
132
132
  @pdf.dash(2, :space => 3)
133
133
  dashes = PDF::Inspector::Graphics::Dash.analyze(@pdf.render)
134
- dashes.stroke_dash.should == [[2, 3], 0]
134
+ expect(dashes.stroke_dash).to eq([[2, 3], 0])
135
135
  end
136
136
  end
137
137
 
@@ -139,25 +139,25 @@ describe "Dashes" do
139
139
  it "rendered PDF should include a non-zero phase" do
140
140
  @pdf.dash(2, :phase => 1)
141
141
  dashes = PDF::Inspector::Graphics::Dash.analyze(@pdf.render)
142
- dashes.stroke_dash.should == [[2, 2], 1]
142
+ expect(dashes.stroke_dash).to eq([[2, 2], 1])
143
143
  end
144
144
  end
145
145
 
146
146
  describe "setting a dash by using an array" do
147
147
  it "dash and spaces should be set from the array" do
148
- @pdf.dash([1,2,3,4])
148
+ @pdf.dash([1, 2, 3, 4])
149
149
  dashes = PDF::Inspector::Graphics::Dash.analyze(@pdf.render)
150
- dashes.stroke_dash.should == [[1, 2, 3, 4], 0]
150
+ expect(dashes.stroke_dash).to eq([[1, 2, 3, 4], 0])
151
151
  end
152
152
  it "space options has to be ignored" do
153
- @pdf.dash([1,2,3,4], :space => 3)
153
+ @pdf.dash([1, 2, 3, 4], :space => 3)
154
154
  dashes = PDF::Inspector::Graphics::Dash.analyze(@pdf.render)
155
- dashes.stroke_dash.should == [[1, 2, 3, 4], 0]
155
+ expect(dashes.stroke_dash).to eq([[1, 2, 3, 4], 0])
156
156
  end
157
157
  it "phase options should be correctly used" do
158
- @pdf.dash([1,2,3,4], :phase => 3)
158
+ @pdf.dash([1, 2, 3, 4], :phase => 3)
159
159
  dashes = PDF::Inspector::Graphics::Dash.analyze(@pdf.render)
160
- dashes.stroke_dash.should == [[1, 2, 3, 4], 3]
160
+ expect(dashes.stroke_dash).to eq([[1, 2, 3, 4], 3])
161
161
  end
162
162
  end
163
163
 
@@ -166,7 +166,7 @@ describe "Dashes" do
166
166
  @pdf.dash(2)
167
167
  @pdf.undash
168
168
  dashes = PDF::Inspector::Graphics::Dash.analyze(@pdf.render)
169
- dashes.stroke_dash.should == [[], 0]
169
+ expect(dashes.stroke_dash).to eq([[], 0])
170
170
  end
171
171
  end
172
172
 
@@ -174,20 +174,19 @@ describe "Dashes" do
174
174
  @pdf.dash(2)
175
175
  @pdf.start_new_page
176
176
  dashes = PDF::Inspector::Graphics::Dash.analyze(@pdf.render)
177
- dashes.stroke_dash_count.should == 2
178
- dashes.stroke_dash.should == [[2, 2], 0]
177
+ expect(dashes.stroke_dash_count).to eq(2)
178
+ expect(dashes.stroke_dash).to eq([[2, 2], 0])
179
179
  end
180
180
 
181
181
  describe "#dashed?" do
182
-
183
182
  it "an initial document should not be dashed" do
184
- @pdf.dashed?.should == false
183
+ expect(@pdf.dashed?).to eq(false)
185
184
  end
186
185
 
187
186
  it "should return true if any of the currently active settings are dashed" do
188
187
  @pdf.dash(2)
189
188
  @pdf.save_graphics_state
190
- @pdf.dashed?.should == true
189
+ expect(@pdf.dashed?).to eq(true)
191
190
  end
192
191
 
193
192
  it "should return false if the document was most recently undashed" do
@@ -195,7 +194,7 @@ describe "Dashes" do
195
194
  @pdf.save_graphics_state
196
195
  @pdf.undash
197
196
  @pdf.save_graphics_state
198
- @pdf.dashed?.should == false
197
+ expect(@pdf.dashed?).to eq(false)
199
198
  end
200
199
 
201
200
  it "should return true when restoring to a state that was dashed" do
@@ -203,9 +202,7 @@ describe "Dashes" do
203
202
  @pdf.save_graphics_state
204
203
  @pdf.undash
205
204
  @pdf.restore_graphics_state
206
- @pdf.dashed?.should == true
205
+ expect(@pdf.dashed?).to eq(true)
207
206
  end
208
-
209
207
  end
210
-
211
208
  end