prawn 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -16,14 +16,12 @@
16
16
  require File.expand_path(File.join(File.dirname(__FILE__),
17
17
  %w[.. example_helper]))
18
18
 
19
-
20
19
  # Bare encryption. No password needed.
21
20
  Prawn::ManualBuilder::Example.generate("bare_encryption.pdf") do
22
21
  text "See, no password was asked but the document is still encrypted."
23
22
  encrypt_document
24
23
  end
25
24
 
26
-
27
25
  # Simple password. All permissions granted.
28
26
  Prawn::ManualBuilder::Example.generate("simple_password.pdf") do
29
27
  text "You was asked for a password."
@@ -18,7 +18,6 @@
18
18
  require File.expand_path(File.join(File.dirname(__FILE__),
19
19
  %w[.. example_helper]))
20
20
 
21
-
22
21
  # User cannot print the document.
23
22
  Prawn::ManualBuilder::Example.generate("cannot_print.pdf") do
24
23
  text "If you used the user password you won't be able to print the doc."
@@ -26,7 +25,6 @@ Prawn::ManualBuilder::Example.generate("cannot_print.pdf") do
26
25
  :permissions => { :print_document => false })
27
26
  end
28
27
 
29
-
30
28
  # All permissions revoked and owner password set to random
31
29
  Prawn::ManualBuilder::Example.generate("no_permissions.pdf") do
32
30
  text "You may only view this and won't be able to use the owner password."
@@ -6,9 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),
6
6
  %w[.. example_helper]))
7
7
 
8
8
  Prawn::ManualBuilder::Example.generate("security.pdf", :page_size => "FOLIO") do
9
-
10
9
  package "security" do |p|
11
-
12
10
  p.example "encryption", :eval_source => false, :full_source => true
13
11
  p.example "permissions", :eval_source => false, :full_source => true
14
12
 
@@ -23,6 +21,5 @@ Prawn::ManualBuilder::Example.generate("security.pdf", :page_size => "FOLIO") do
23
21
  "How to set a owner password that bypass the document permissions"
24
22
  )
25
23
  end
26
-
27
24
  end
28
25
  end
@@ -22,16 +22,16 @@ Prawn::ManualBuilder::Example.generate(filename) do
22
22
  text "This text should be right aligned", :align => :right
23
23
 
24
24
  bounding_box([0, 220], :width => 250, :height => 220) do
25
- text "This text is flowing from the left. " * 4
25
+ text "This text is flowing from the left. " * 4
26
26
 
27
27
  move_down 15
28
28
  text "This text is flowing from the center. " * 3, :align => :center
29
29
 
30
30
  move_down 15
31
- text "This text is flowing from the right. " * 4, :align => :right
31
+ text "This text is flowing from the right. " * 4, :align => :right
32
32
 
33
33
  move_down 15
34
- text "This text is justified. " * 6, :align => :justify
34
+ text "This text is justified. " * 6, :align => :justify
35
35
  transparent(0.5) { stroke_bounds }
36
36
  end
37
37
 
@@ -21,4 +21,3 @@ Prawn::ManualBuilder::Example.generate(filename) do
21
21
  :color => "0000FF",
22
22
  :inline_format => true
23
23
  end
24
-
@@ -29,4 +29,3 @@ Prawn::ManualBuilder::Example.generate(filename) do
29
29
  END
30
30
  end
31
31
  end
32
-
@@ -16,7 +16,7 @@ Prawn::ManualBuilder::Example.generate(filename) do
16
16
 
17
17
  file = "#{Prawn::DATADIR}/fonts/Panic+Sans.dfont"
18
18
  font_families["Panic Sans"] = {
19
- :normal => { :file => file, :font => "PanicSans" },
19
+ :normal => { :file => file, :font => "PanicSans" }
20
20
  }
21
21
 
22
22
  font("Panic Sans") do
@@ -31,7 +31,7 @@ Prawn::ManualBuilder::Example.generate(filename) do
31
31
  move_down 20
32
32
 
33
33
  formatted_text([ { :text => "Fallback fonts can even override" },
34
- { :text => "fragment fonts (你好)", :font => "Times-Roman" },
34
+ { :text => "fragment fonts (你好)", :font => "Times-Roman" }
35
35
  ],
36
36
  :fallback_fonts => ["Times-Roman", "Kai"])
37
37
  end
@@ -25,8 +25,9 @@ Prawn::ManualBuilder::Example.generate(filename) do
25
25
  def render_behind(fragment)
26
26
  original_color = @document.fill_color
27
27
  @document.fill_color = @color
28
- @document.fill_rectangle(fragment.top_left, fragment.width,
29
- fragment.height)
28
+ @document.fill_rectangle(fragment.top_left,
29
+ fragment.width,
30
+ fragment.height)
30
31
  @document.fill_color = original_color
31
32
  end
32
33
  end
@@ -28,7 +28,6 @@ Prawn::ManualBuilder::Example.generate(filename) do
28
28
 
29
29
  text "FROM RIGHT TO LEFT:"
30
30
  text "This paragraph will be indented. " * 10 +
31
- "\n" + "This one will too. " * 10,
32
- :indent_paragraphs => 60, :direction => :rtl
33
-
31
+ "\n" + "This one will too. " * 10,
32
+ :indent_paragraphs => 60, :direction => :rtl
34
33
  end
@@ -14,9 +14,11 @@ require File.expand_path(File.join(File.dirname(__FILE__),
14
14
  filename = File.basename(__FILE__).gsub('.rb', '.pdf')
15
15
  Prawn::ManualBuilder::Example.generate(filename) do
16
16
  # Registering a single TTF font
17
- font_families.update("DejaVu Sans" => {
18
- :normal => "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
19
- })
17
+ font_families.update(
18
+ "DejaVu Sans" => {
19
+ :normal => "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
20
+ }
21
+ )
20
22
 
21
23
  font("DejaVu Sans") do
22
24
  text "Using the DejaVu Sans font providing only its name to the font method"
@@ -25,12 +27,14 @@ Prawn::ManualBuilder::Example.generate(filename) do
25
27
 
26
28
  # Registering a DFONT package
27
29
  font_path = "#{Prawn::DATADIR}/fonts/Panic+Sans.dfont"
28
- font_families.update("Panic Sans" => {
29
- :normal => { :file => font_path, :font => "PanicSans" },
30
- :italic => { :file => font_path, :font => "PanicSans-Italic" },
31
- :bold => { :file => font_path, :font => "PanicSans-Bold" },
32
- :bold_italic => { :file => font_path, :font => "PanicSans-BoldItalic" }
33
- })
30
+ font_families.update(
31
+ "Panic Sans" => {
32
+ :normal => { :file => font_path, :font => "PanicSans" },
33
+ :italic => { :file => font_path, :font => "PanicSans-Italic" },
34
+ :bold => { :file => font_path, :font => "PanicSans-Bold" },
35
+ :bold_italic => { :file => font_path, :font => "PanicSans-BoldItalic" }
36
+ }
37
+ )
34
38
 
35
39
  font "Panic Sans"
36
40
  text "Also using Panic Sans by providing only its name"
@@ -30,7 +30,6 @@ Prawn::ManualBuilder::Example.generate(filename) do
30
30
 
31
31
  [:lower_left, :upper_left,
32
32
  :lower_right, :upper_right].each_with_index do |corner, index|
33
-
34
33
  y = y - 100 if index == 2
35
34
  stroke_rectangle [x + (index % 2) * 200, y], width, height
36
35
  text_box("This text was rotated around the #{corner} corner.",
@@ -6,9 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),
6
6
  %w[.. example_helper]))
7
7
 
8
8
  Prawn::ManualBuilder::Example.generate("text.pdf", :page_size => "FOLIO") do
9
-
10
9
  package "text" do |p|
11
-
12
10
  p.section "Basics" do |s|
13
11
  s.example "free_flowing_text"
14
12
  s.example "positioned_text"
@@ -68,6 +66,5 @@ Prawn::ManualBuilder::Example.generate("text.pdf", :page_size => "FOLIO") do
68
66
  "What happens when rendering text in different languages"
69
67
  )
70
68
  end
71
-
72
69
  end
73
70
  end
@@ -29,8 +29,9 @@ Prawn::ManualBuilder::Example.generate(filename) do
29
29
  y_position = cursor - 20
30
30
  [:truncate, :expand, :shrink_to_fit].each_with_index do |mode, i|
31
31
  text_box string, :at => [i * 150, y_position],
32
- :width => 100, :height => 50,
33
- :overflow => mode
32
+ :width => 100,
33
+ :height => 50,
34
+ :overflow => mode
34
35
  end
35
36
 
36
37
  string = "If the box is too small for the text, :shrink_to_fit " +
@@ -41,8 +42,9 @@ Prawn::ManualBuilder::Example.generate(filename) do
41
42
  y_position = cursor - 20
42
43
  [nil, 8, 10, 12].each_with_index do |value, index|
43
44
  text_box string, :at => [index * 150, y_position],
44
- :width => 50, :height => 50,
45
- :overflow => :shrink_to_fit,
46
- :min_font_size => value
45
+ :width => 50,
46
+ :height => 50,
47
+ :overflow => :shrink_to_fit,
48
+ :min_font_size => value
47
49
  end
48
50
  end
@@ -13,7 +13,7 @@ Prawn::ManualBuilder::Example.generate(filename) do
13
13
  text "€", :size => 32
14
14
  move_down 20
15
15
 
16
- text "This works, because € is one of the few "+
16
+ text "This works, because € is one of the few " +
17
17
  "non-ASCII glyphs supported in PDF built-in fonts."
18
18
 
19
19
  move_down 20
@@ -47,11 +47,11 @@ Prawn::ManualBuilder::Example.generate(filename) do
47
47
  case align
48
48
  when :left then offset = 0
49
49
  when :right then offset = total_width - width
50
- when :center then offset = (total_width - width)/2
50
+ when :center then offset = (total_width - width) / 2
51
51
  end
52
52
 
53
53
  text_box(field.force_encoding("windows-1252").encode("UTF-8"),
54
- :at => [dx + offset, y])
54
+ :at => [dx + offset, y])
55
55
  end
56
56
 
57
57
  dx += total_width
@@ -19,13 +19,13 @@ Gem::Specification.new do |spec|
19
19
  spec.required_rubygems_version = ">= 1.3.6"
20
20
 
21
21
  spec.test_files = Dir[ "spec/*_spec.rb" ]
22
- spec.authors = ["Gregory Brown","Brad Ediger","Daniel Nelson","Jonathan Greenberg","James Healy"]
23
- spec.email = ["gregory.t.brown@gmail.com","brad@bradediger.com","dnelson@bluejade.com","greenberg@entryway.net","jimmy@deefa.com"]
22
+ spec.authors = ["Gregory Brown", "Brad Ediger", "Daniel Nelson", "Jonathan Greenberg", "James Healy"]
23
+ spec.email = ["gregory.t.brown@gmail.com", "brad@bradediger.com", "dnelson@bluejade.com", "greenberg@entryway.net", "jimmy@deefa.com"]
24
24
  spec.rubyforge_project = "prawn"
25
25
  spec.licenses = ['RUBY', 'GPL-2', 'GPL-3']
26
26
 
27
27
  spec.add_dependency('ttfunk', '~> 1.4.0')
28
- spec.add_dependency('pdf-core', "~> 0.5.1")
28
+ spec.add_dependency('pdf-core', "~> 0.6.0")
29
29
 
30
30
  spec.add_development_dependency('pdf-inspector', '~> 1.2.0')
31
31
  spec.add_development_dependency('yard')
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency('simplecov')
36
36
  spec.add_development_dependency('prawn-manual_builder', ">= 0.2.0")
37
37
  spec.add_development_dependency('pdf-reader', '~>1.2')
38
- spec.add_development_dependency('rubocop', '0.28.0')
38
+ spec.add_development_dependency('rubocop', '0.30.1')
39
39
  spec.add_development_dependency('code_statistics', '0.2.13')
40
40
 
41
41
  spec.homepage = "http://prawn.majesticseacreature.com"
@@ -3,11 +3,11 @@
3
3
  require_relative "../../lib/prawn"
4
4
 
5
5
  images = [
6
- ["Type 0", "#{Prawn::BASEDIR}/data/images/web-links.png"],
7
- ["Type 2", "#{Prawn::BASEDIR}/data/images/ruport.png"],
8
- ["Type 3", "#{Prawn::BASEDIR}/data/images/indexed_color.png"],
9
- ["Type 4", "#{Prawn::BASEDIR}/data/images/page_white_text.png"],
10
- ["Type 6", "#{Prawn::BASEDIR}/data/images/dice.png"],
6
+ ["Type 0", "#{Prawn::BASEDIR}/data/images/web-links.png"],
7
+ ["Type 2", "#{Prawn::BASEDIR}/data/images/ruport.png"],
8
+ ["Type 3", "#{Prawn::BASEDIR}/data/images/indexed_color.png"],
9
+ ["Type 4", "#{Prawn::BASEDIR}/data/images/page_white_text.png"],
10
+ ["Type 6", "#{Prawn::BASEDIR}/data/images/dice.png"]
11
11
  ]
12
12
 
13
13
  Prawn::Document.generate("png_types.pdf", :page_size => "A5") do
@@ -19,7 +19,6 @@ Prawn::Document.generate("png_types.pdf", :page_size => "A5") do
19
19
  fill_rectangle bounds.top_left, bounds.width, bounds.height
20
20
  text header
21
21
 
22
- image file, :at => [50,450]
22
+ image file, :at => [50, 450]
23
23
  end
24
24
  end
25
-
@@ -2,73 +2,66 @@
2
2
 
3
3
  require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
4
4
 
5
-
6
5
  describe "When creating annotations" do
7
-
8
6
  before(:each) { create_pdf }
9
7
 
10
8
  it "should append annotation to current page" do
11
9
  @pdf.start_new_page
12
- @pdf.annotate(:Rect => [0,0,10,10], :Subtype => :Text, :Contents => "Hello world!")
10
+ @pdf.annotate(:Rect => [0, 0, 10, 10], :Subtype => :Text, :Contents => "Hello world!")
13
11
  PDF::Reader.open(StringIO.new(@pdf.render)) do |pdf|
14
- pdf.page(1).attributes[:Annots].should be_nil
15
- pdf.page(2).attributes[:Annots].size.should == 1
12
+ expect(pdf.page(1).attributes[:Annots]).to be_nil
13
+ expect(pdf.page(2).attributes[:Annots].size).to eq(1)
16
14
  end
17
15
  end
18
16
 
19
17
  it "should force :Type to be :Annot" do
20
- opts = @pdf.annotate(:Rect => [0,0,10,10], :Subtype => :Text, :Contents => "Hello world!")
21
- opts[:Type].should == :Annot
22
- opts = @pdf.annotate(:Type => :Bogus, :Rect => [0,0,10,10], :Subtype => :Text, :Contents => "Hello world!")
23
- opts[:Type].should == :Annot
18
+ opts = @pdf.annotate(:Rect => [0, 0, 10, 10], :Subtype => :Text, :Contents => "Hello world!")
19
+ expect(opts[:Type]).to eq(:Annot)
20
+ opts = @pdf.annotate(:Type => :Bogus, :Rect => [0, 0, 10, 10], :Subtype => :Text, :Contents => "Hello world!")
21
+ expect(opts[:Type]).to eq(:Annot)
24
22
  end
25
-
26
23
  end
27
24
 
28
25
  describe "When creating text annotations" do
29
-
30
26
  before(:each) do
31
- @rect = [0,0,10,10]
27
+ @rect = [0, 0, 10, 10]
32
28
  @content = "Hello, world!"
33
29
  create_pdf
34
30
  end
35
31
 
36
32
  it "should build appropriate annotation" do
37
33
  opts = @pdf.text_annotation(@rect, @content)
38
- opts[:Type].should == :Annot
39
- opts[:Subtype].should == :Text
40
- opts[:Rect].should == @rect
41
- opts[:Contents].should == @content
34
+ expect(opts[:Type]).to eq(:Annot)
35
+ expect(opts[:Subtype]).to eq(:Text)
36
+ expect(opts[:Rect]).to eq(@rect)
37
+ expect(opts[:Contents]).to eq(@content)
42
38
  end
43
39
 
44
40
  it "should merge extra options" do
45
41
  opts = @pdf.text_annotation(@rect, @content, :Open => true, :Subtype => :Bogus)
46
- opts[:Subtype].should == :Text
47
- opts[:Open].should == true
42
+ expect(opts[:Subtype]).to eq(:Text)
43
+ expect(opts[:Open]).to eq(true)
48
44
  end
49
-
50
45
  end
51
46
 
52
47
  describe "When creating link annotations" do
53
-
54
48
  before(:each) do
55
- @rect = [0,0,10,10]
49
+ @rect = [0, 0, 10, 10]
56
50
  @dest = "home"
57
51
  create_pdf
58
52
  end
59
53
 
60
54
  it "should build appropriate annotation" do
61
55
  opts = @pdf.link_annotation(@rect, :Dest => @dest)
62
- opts[:Type].should == :Annot
63
- opts[:Subtype].should == :Link
64
- opts[:Rect].should == @rect
65
- opts[:Dest].should == @dest
56
+ expect(opts[:Type]).to eq(:Annot)
57
+ expect(opts[:Subtype]).to eq(:Link)
58
+ expect(opts[:Rect]).to eq(@rect)
59
+ expect(opts[:Dest]).to eq(@dest)
66
60
  end
67
61
 
68
62
  it "should merge extra options" do
69
63
  opts = @pdf.link_annotation(@rect, :Dest => @dest, :Subtype => :Bogus)
70
- opts[:Subtype].should == :Link
71
- opts[:Dest].should == @dest
64
+ expect(opts[:Subtype]).to eq(:Link)
65
+ expect(opts[:Dest]).to eq(@dest)
72
66
  end
73
-
74
67
  end
@@ -3,101 +3,101 @@
3
3
  require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
4
4
 
5
5
  describe "A bounding box" do
6
-
7
6
  before(:each) do
8
7
  @x = 100
9
8
  @y = 125
10
9
  @width = 50
11
10
  @height = 75
12
- @box = Prawn::Document::BoundingBox.new(nil, nil, [@x,@y],
13
- :width => @width, :height => @height )
11
+ @box = Prawn::Document::BoundingBox.new(nil,
12
+ nil,
13
+ [@x, @y],
14
+ :width => @width,
15
+ :height => @height)
14
16
  end
15
17
 
16
18
  it "should have an anchor at (x, y - height)" do
17
- @box.anchor.should == [@x,@y-@height]
19
+ expect(@box.anchor).to eq([@x, @y - @height])
18
20
  end
19
21
 
20
22
  it "should have a left boundary of 0" do
21
- @box.left.should == 0
23
+ expect(@box.left).to eq(0)
22
24
  end
23
25
 
24
26
  it "should have a right boundary equal to the width" do
25
- @box.right.should == @width
27
+ expect(@box.right).to eq(@width)
26
28
  end
27
29
 
28
30
  it "should have a top boundary of height" do
29
- @box.top.should == @height
31
+ expect(@box.top).to eq(@height)
30
32
  end
31
33
 
32
34
  it "should have a bottom boundary of 0" do
33
- @box.bottom.should == 0
35
+ expect(@box.bottom).to eq(0)
34
36
  end
35
37
 
36
38
  it "should have a top-left of [0,height]" do
37
- @box.top_left.should == [0,@height]
39
+ expect(@box.top_left).to eq([0, @height])
38
40
  end
39
41
 
40
42
  it "should have a top-right of [width,height]" do
41
- @box.top_right.should == [@width,@height]
43
+ expect(@box.top_right).to eq([@width, @height])
42
44
  end
43
45
 
44
46
  it "should have a bottom-left of [0,0]" do
45
- @box.bottom_left.should == [0,0]
47
+ expect(@box.bottom_left).to eq([0, 0])
46
48
  end
47
49
 
48
50
  it "should have a bottom-right of [width,0]" do
49
- @box.bottom_right.should == [@width,0]
51
+ expect(@box.bottom_right).to eq([@width, 0])
50
52
  end
51
53
 
52
54
  it "should have an absolute left boundary of x" do
53
- @box.absolute_left.should == @x
55
+ expect(@box.absolute_left).to eq(@x)
54
56
  end
55
57
 
56
58
  it "should have an absolute right boundary of x + width" do
57
- @box.absolute_right.should == @x + @width
59
+ expect(@box.absolute_right).to eq(@x + @width)
58
60
  end
59
61
 
60
62
  it "should have an absolute top boundary of y" do
61
- @box.absolute_top.should == @y
63
+ expect(@box.absolute_top).to eq(@y)
62
64
  end
63
65
 
64
66
  it "should have an absolute bottom boundary of y - height" do
65
- @box.absolute_bottom.should == @y - @height
67
+ expect(@box.absolute_bottom).to eq(@y - @height)
66
68
  end
67
69
 
68
70
  it "should have an absolute bottom-left of [x,y-height]" do
69
- @box.absolute_bottom_left.should == [@x, @y - @height]
71
+ expect(@box.absolute_bottom_left).to eq([@x, @y - @height])
70
72
  end
71
73
 
72
74
  it "should have an absolute bottom-right of [x+width,y-height]" do
73
- @box.absolute_bottom_right.should == [@x + @width , @y - @height]
75
+ expect(@box.absolute_bottom_right).to eq([@x + @width , @y - @height])
74
76
  end
75
77
 
76
78
  it "should have an absolute top-left of [x,y]" do
77
- @box.absolute_top_left.should == [@x, @y]
79
+ expect(@box.absolute_top_left).to eq([@x, @y])
78
80
  end
79
81
 
80
82
  it "should have an absolute top-right of [x+width,y]" do
81
- @box.absolute_top_right.should == [@x + @width, @y]
83
+ expect(@box.absolute_top_right).to eq([@x + @width, @y])
82
84
  end
83
85
 
84
86
  it "should require width to be set" do
85
- lambda do
86
- Prawn::Document::BoundingBox.new(nil, nil, [100,100])
87
- end.should raise_error(ArgumentError)
87
+ expect do
88
+ Prawn::Document::BoundingBox.new(nil, nil, [100, 100])
89
+ end.to raise_error(ArgumentError)
88
90
  end
89
91
 
90
92
  it "should raise_error an ArgumentError if a block is not passed" do
91
93
  pdf = Prawn::Document.new
92
- lambda do
94
+ expect do
93
95
  pdf.bounding_box([0, 0], :width => 200)
94
- end.should raise_error(ArgumentError)
96
+ end.to raise_error(ArgumentError)
95
97
  end
96
-
97
98
  end
98
99
 
99
100
  describe "drawing bounding boxes" do
100
-
101
101
  before(:each) { create_pdf }
102
102
 
103
103
  it "should not stomp on the arguments to bounding_box" do
@@ -106,7 +106,7 @@ describe "drawing bounding boxes" do
106
106
  pdf.bounding_box x, :width => 100 do
107
107
  pdf.text "bork-bork-bork"
108
108
  end
109
- x.should == [100, 500]
109
+ expect(x).to eq([100, 500])
110
110
  end
111
111
 
112
112
  it "should restore Document#bounds to the correct margin box on exit" do
@@ -121,26 +121,24 @@ describe "drawing bounding boxes" do
121
121
 
122
122
  x_min, y_min, x_max, y_max = pdf.page.dimensions
123
123
 
124
- pdf.bounds.absolute_top_left.should == [x_min, y_max]
125
- pdf.bounds.absolute_bottom_right.should == [x_max, y_min]
124
+ expect(pdf.bounds.absolute_top_left).to eq([x_min, y_max])
125
+ expect(pdf.bounds.absolute_bottom_right).to eq([x_max, y_min])
126
126
  end
127
127
 
128
128
  it "should restore the parent bounding box when calls are nested" do
129
- @pdf.bounding_box [100,500], :width => 300, :height => 300 do
130
-
131
- @pdf.bounds.absolute_top.should == 500 + @pdf.margin_box.absolute_bottom
132
- @pdf.bounds.absolute_left.should == 100 + @pdf.margin_box.absolute_left
129
+ @pdf.bounding_box [100, 500], :width => 300, :height => 300 do
130
+ expect(@pdf.bounds.absolute_top).to eq(500 + @pdf.margin_box.absolute_bottom)
131
+ expect(@pdf.bounds.absolute_left).to eq(100 + @pdf.margin_box.absolute_left)
133
132
 
134
133
  parent_box = @pdf.bounds
135
134
 
136
- @pdf.bounding_box [50,200], :width => 100, :height => 100 do
137
- @pdf.bounds.absolute_top.should == 200 + parent_box.absolute_bottom
138
- @pdf.bounds.absolute_left.should == 50 + parent_box.absolute_left
135
+ @pdf.bounding_box [50, 200], :width => 100, :height => 100 do
136
+ expect(@pdf.bounds.absolute_top).to eq(200 + parent_box.absolute_bottom)
137
+ expect(@pdf.bounds.absolute_left).to eq(50 + parent_box.absolute_left)
139
138
  end
140
139
 
141
- @pdf.bounds.absolute_top.should == 500 + @pdf.margin_box.absolute_bottom
142
- @pdf.bounds.absolute_left.should == 100 + @pdf.margin_box.absolute_left
143
-
140
+ expect(@pdf.bounds.absolute_top).to eq(500 + @pdf.margin_box.absolute_bottom)
141
+ expect(@pdf.bounds.absolute_left).to eq(100 + @pdf.margin_box.absolute_left)
144
142
  end
145
143
  end
146
144
 
@@ -149,7 +147,7 @@ describe "drawing bounding boxes" do
149
147
  @pdf.text "The rain in Spain falls mainly on the plains."
150
148
  end
151
149
 
152
- @pdf.y.should be_within(0.001).of(458.384)
150
+ expect(@pdf.y).to be_within(0.001).of(458.384)
153
151
  end
154
152
 
155
153
  it "should keep track of the max height the box was stretched to" do
@@ -158,77 +156,74 @@ describe "drawing bounding boxes" do
158
156
  @pdf.move_up 15
159
157
  end
160
158
 
161
- box.height.should == 100
159
+ expect(box.height).to eq(100)
162
160
  end
163
161
 
164
162
  it "should advance the y-position by bbox.height by default" do
165
163
  orig_y = @pdf.y
166
- @pdf.bounding_box [0, @pdf.cursor], :width => @pdf.bounds.width,
167
- :height => 30 do
164
+ @pdf.bounding_box [0, @pdf.cursor], :width => @pdf.bounds.width, :height => 30 do
168
165
  @pdf.text "hello"
169
166
  end
170
- @pdf.y.should be_within(0.001).of(orig_y - 30)
167
+ expect(@pdf.y).to be_within(0.001).of(orig_y - 30)
171
168
  end
172
169
 
173
170
  it "should not advance y-position if passed :hold_position => true" do
174
171
  orig_y = @pdf.y
175
- @pdf.bounding_box [0, @pdf.cursor], :width => @pdf.bounds.width,
176
- :hold_position => true do
172
+ @pdf.bounding_box [0, @pdf.cursor], :width => @pdf.bounds.width, :hold_position => true do
177
173
  @pdf.text "hello"
178
174
  end
179
175
  # y only advances by height of one line ("hello")
180
- @pdf.y.should be_within(0.001).of(orig_y - @pdf.height_of("hello"))
176
+ expect(@pdf.y).to be_within(0.001).of(orig_y - @pdf.height_of("hello"))
181
177
  end
182
178
 
183
- it "should not advance y-position of a stretchy bbox if it would stretch " +
179
+ it "should not advance y-position of a stretchy bbox if it would stretch " \
184
180
  "the bbox further" do
185
181
  bottom = @pdf.y = @pdf.margin_box.absolute_bottom
186
182
  @pdf.bounding_box [0, @pdf.margin_box.top], :width => @pdf.bounds.width do
187
183
  @pdf.y = bottom
188
184
  @pdf.text "hello" # starts a new page
189
185
  end
190
- @pdf.page_count.should == 2
186
+ expect(@pdf.page_count).to eq(2)
191
187
 
192
188
  # Restoring the position (to the absolute bottom) would stretch the bbox to
193
189
  # the bottom of the page, which we don't want. This should be equivalent to
194
190
  # a bbox with :hold_position => true, where we only advance by the amount
195
191
  # that was actually drawn.
196
- @pdf.y.should be_within(0.001).of(
192
+ expect(@pdf.y).to be_within(0.001).of(
197
193
  @pdf.margin_box.absolute_top - @pdf.height_of("hello")
198
194
  )
199
195
  end
200
-
201
196
  end
202
197
 
203
198
  describe "Indentation" do
204
199
  before(:each) { create_pdf }
205
200
 
206
201
  it "should temporarily shift the x coordinate and width" do
207
- @pdf.bounding_box([100,100], :width => 200) do
202
+ @pdf.bounding_box([100, 100], :width => 200) do
208
203
  @pdf.indent(20) do
209
- @pdf.bounds.absolute_left.should == 120
210
- @pdf.bounds.width.should == 180
204
+ expect(@pdf.bounds.absolute_left).to eq(120)
205
+ expect(@pdf.bounds.width).to eq(180)
211
206
  end
212
207
  end
213
208
  end
214
209
 
215
210
  it "should restore the x coordinate and width after block exits" do
216
- @pdf.bounding_box([100,100], :width => 200) do
211
+ @pdf.bounding_box([100, 100], :width => 200) do
217
212
  @pdf.indent(20) do
218
213
  # no-op
219
214
  end
220
- @pdf.bounds.absolute_left.should == 100
221
- @pdf.bounds.width.should == 200
215
+ expect(@pdf.bounds.absolute_left).to eq(100)
216
+ expect(@pdf.bounds.width).to eq(200)
222
217
  end
223
218
  end
224
219
 
225
220
  it "should restore the x coordinate and width on error" do
226
- @pdf.bounding_box([100,100], :width => 200) do
221
+ @pdf.bounding_box([100, 100], :width => 200) do
227
222
  begin
228
- @pdf.indent(20) { raise }
223
+ @pdf.indent(20) { fail }
229
224
  rescue
230
- @pdf.bounds.absolute_left.should == 100
231
- @pdf.bounds.width.should == 200
225
+ expect(@pdf.bounds.absolute_left).to eq(100)
226
+ expect(@pdf.bounds.width).to eq(200)
232
227
  end
233
228
  end
234
229
  end
@@ -237,54 +232,52 @@ describe "Indentation" do
237
232
  original_left = @pdf.bounds.absolute_left
238
233
 
239
234
  @pdf.indent(20) do
240
- @pdf.bounds.absolute_left.should == original_left + 20
235
+ expect(@pdf.bounds.absolute_left).to eq(original_left + 20)
241
236
  @pdf.start_new_page
242
- @pdf.bounds.absolute_left.should == original_left + 20
237
+ expect(@pdf.bounds.absolute_left).to eq(original_left + 20)
243
238
  end
244
239
 
245
- @pdf.bounds.absolute_left.should == original_left
240
+ expect(@pdf.bounds.absolute_left).to eq(original_left)
246
241
  end
247
242
 
248
243
  it "should maintain right indentation across a page break" do
249
244
  original_width = @pdf.bounds.width
250
245
 
251
246
  @pdf.indent(0, 20) do
252
- @pdf.bounds.width.should == original_width - 20
247
+ expect(@pdf.bounds.width).to eq(original_width - 20)
253
248
  @pdf.start_new_page
254
- @pdf.bounds.width.should == original_width - 20
249
+ expect(@pdf.bounds.width).to eq(original_width - 20)
255
250
  end
256
251
 
257
- @pdf.bounds.width.should == original_width
252
+ expect(@pdf.bounds.width).to eq(original_width)
258
253
  end
259
254
 
260
255
  it "optionally allows adjustment of the right bound as well" do
261
- @pdf.bounding_box([100,100], :width => 200) do
256
+ @pdf.bounding_box([100, 100], :width => 200) do
262
257
  @pdf.indent(20, 30) do
263
- @pdf.bounds.absolute_left.should == 120
264
- @pdf.bounds.width.should == 150
258
+ expect(@pdf.bounds.absolute_left).to eq(120)
259
+ expect(@pdf.bounds.width).to eq(150)
265
260
  end
266
- @pdf.bounds.absolute_left.should == 100
267
- @pdf.bounds.width.should == 200
261
+ expect(@pdf.bounds.absolute_left).to eq(100)
262
+ expect(@pdf.bounds.width).to eq(200)
268
263
  end
269
264
  end
270
265
 
271
266
  describe "in a ColumnBox" do
272
267
  it "should subtract the given indentation from the available width" do
273
- @pdf.column_box([0, @pdf.cursor], :width => @pdf.bounds.width,
274
- :height => 200, :columns => 2, :spacer => 20) do
268
+ @pdf.column_box([0, @pdf.cursor], :width => @pdf.bounds.width, :height => 200, :columns => 2, :spacer => 20) do
275
269
  width = @pdf.bounds.width
276
270
  @pdf.indent(20) do
277
- @pdf.bounds.width.should be_within(0.01).of(width - 20)
271
+ expect(@pdf.bounds.width).to be_within(0.01).of(width - 20)
278
272
  end
279
273
  end
280
274
  end
281
275
 
282
276
  it "should subtract right padding from the available width" do
283
- @pdf.column_box([0, @pdf.cursor], :width => @pdf.bounds.width,
284
- :height => 200, :columns => 2, :spacer => 20) do
277
+ @pdf.column_box([0, @pdf.cursor], :width => @pdf.bounds.width, :height => 200, :columns => 2, :spacer => 20) do
285
278
  width = @pdf.bounds.width
286
279
  @pdf.indent(20, 30) do
287
- @pdf.bounds.width.should be_within(0.01).of(width - 50)
280
+ expect(@pdf.bounds.width).to be_within(0.01).of(width - 50)
288
281
  end
289
282
  end
290
283
  end
@@ -294,7 +287,7 @@ describe "Indentation" do
294
287
  3.times do |column|
295
288
  x = @pdf.bounds.left_side
296
289
  @pdf.indent(20) do
297
- @pdf.bounds.left_side.should == x+20
290
+ expect(@pdf.bounds.left_side).to eq(x + 20)
298
291
  end
299
292
  @pdf.bounds.move_past_bottom
300
293
  end
@@ -306,7 +299,7 @@ describe "Indentation" do
306
299
  3.times do |column|
307
300
  x = @pdf.bounds.right_side
308
301
  @pdf.indent(20) do
309
- @pdf.bounds.right_side.should == x
302
+ expect(@pdf.bounds.right_side).to eq(x)
310
303
  end
311
304
  @pdf.bounds.move_past_bottom
312
305
  end
@@ -318,7 +311,7 @@ describe "Indentation" do
318
311
  3.times do |column|
319
312
  x = @pdf.bounds.right_side
320
313
  @pdf.indent(20, 10) do
321
- @pdf.bounds.right_side.should == x-10
314
+ expect(@pdf.bounds.right_side).to eq(x - 10)
322
315
  end
323
316
  @pdf.bounds.move_past_bottom
324
317
  end
@@ -334,7 +327,7 @@ describe "Indentation" do
334
327
  # ...and no right indent here...
335
328
  @pdf.indent(20) do
336
329
  # right indent is inherited from the parent!
337
- @pdf.bounds.right_side.should == x
330
+ expect(@pdf.bounds.right_side).to eq(x)
338
331
  end
339
332
  end
340
333
  @pdf.bounds.move_past_bottom
@@ -350,7 +343,7 @@ describe "Indentation" do
350
343
  # requesting a negative right-indent of equivalent size...
351
344
  @pdf.indent(20, -10) do
352
345
  # ...resets the right margin to that of the column!
353
- @pdf.bounds.right_side.should == x
346
+ expect(@pdf.bounds.right_side).to eq(x)
354
347
  end
355
348
  end
356
349
  @pdf.bounds.move_past_bottom
@@ -364,7 +357,7 @@ describe "Indentation" do
364
357
  w = @pdf.bounds.width
365
358
  @pdf.indent(20, 10) do
366
359
  @pdf.indent(20, 10) do
367
- @pdf.bounds.width.should == w - 60
360
+ expect(@pdf.bounds.width).to eq(w - 60)
368
361
  end
369
362
  end
370
363
  @pdf.bounds.move_past_bottom
@@ -379,9 +372,9 @@ describe "A canvas" do
379
372
 
380
373
  it "should use whatever the last set y position is" do
381
374
  @pdf.canvas do
382
- @pdf.bounding_box([100,500],:width => 200) { @pdf.move_down 50 }
375
+ @pdf.bounding_box([100, 500], :width => 200) { @pdf.move_down 50 }
383
376
  end
384
- @pdf.y.should == 450
377
+ expect(@pdf.y).to eq(450)
385
378
  end
386
379
 
387
380
  it "should restore the original ypos after execution", :issue => 523 do
@@ -392,9 +385,8 @@ describe "A canvas" do
392
385
 
393
386
  doc.canvas {}
394
387
 
395
- doc.y.should == original_ypos
388
+ expect(doc.y).to eq(original_ypos)
396
389
  end
397
-
398
390
  end
399
391
 
400
392
  describe "Deep-copying" do
@@ -403,8 +395,8 @@ describe "Deep-copying" do
403
395
  orig = pdf.bounds
404
396
  copy = orig.deep_copy
405
397
 
406
- copy.should_not == pdf.bounds
407
- copy.document.should be_nil
398
+ expect(copy).not_to eq(pdf.bounds)
399
+ expect(copy.document).to be_nil
408
400
  end
409
401
  end
410
402
 
@@ -415,11 +407,11 @@ describe "Deep-copying" do
415
407
  copy = pdf.bounds.deep_copy
416
408
 
417
409
  # the parent bounds should have the same parameters
418
- copy.parent.width.should == outside.width
419
- copy.parent.height.should == outside.height
410
+ expect(copy.parent.width).to eq(outside.width)
411
+ expect(copy.parent.height).to eq(outside.height)
420
412
 
421
413
  # but should not be the same object
422
- copy.parent.should_not == outside
414
+ expect(copy.parent).not_to eq(outside)
423
415
  end
424
416
  end
425
417
  end
@@ -430,7 +422,7 @@ describe "Prawn::Document#reference_bounds" do
430
422
 
431
423
  it "should return self for non-stretchy bounds" do
432
424
  @pdf.bounding_box([0, @pdf.cursor], :width => 100, :height => 100) do
433
- @pdf.reference_bounds.should == @pdf.bounds
425
+ expect(@pdf.reference_bounds).to eq(@pdf.bounds)
434
426
  end
435
427
  end
436
428
 
@@ -438,7 +430,7 @@ describe "Prawn::Document#reference_bounds" do
438
430
  @pdf.bounding_box([0, @pdf.cursor], :width => 100, :height => 100) do
439
431
  correct_bounds = @pdf.bounds
440
432
  @pdf.bounding_box([0, @pdf.cursor], :width => 100) do
441
- @pdf.reference_bounds.should == correct_bounds
433
+ expect(@pdf.reference_bounds).to eq(correct_bounds)
442
434
  end
443
435
  end
444
436
  end
@@ -448,17 +440,17 @@ describe "Prawn::Document#reference_bounds" do
448
440
  correct_bounds = @pdf.bounds
449
441
  @pdf.bounding_box([0, @pdf.cursor], :width => 100) do
450
442
  @pdf.bounding_box([0, @pdf.cursor], :width => 100) do
451
- @pdf.reference_bounds.should == correct_bounds
443
+ expect(@pdf.reference_bounds).to eq(correct_bounds)
452
444
  end
453
445
  end
454
446
  end
455
447
  end
456
448
 
457
449
  it "should return the margin box if there's no explicit bbox" do
458
- @pdf.reference_bounds.should == @pdf.margin_box
450
+ expect(@pdf.reference_bounds).to eq(@pdf.margin_box)
459
451
 
460
452
  @pdf.bounding_box([0, @pdf.cursor], :width => 100) do
461
- @pdf.reference_bounds.should == @pdf.margin_box
453
+ expect(@pdf.reference_bounds).to eq(@pdf.margin_box)
462
454
  end
463
455
  end
464
456
 
@@ -466,14 +458,13 @@ describe "Prawn::Document#reference_bounds" do
466
458
  @pdf.canvas do
467
459
  canvas_box = @pdf.bounds
468
460
 
469
- @pdf.reference_bounds.should == canvas_box
461
+ expect(@pdf.reference_bounds).to eq(canvas_box)
470
462
 
471
463
  @pdf.bounding_box([0, @pdf.cursor], :width => 100) do
472
- @pdf.reference_bounds.should == canvas_box
464
+ expect(@pdf.reference_bounds).to eq(canvas_box)
473
465
  end
474
466
  end
475
467
  end
476
-
477
468
  end
478
469
 
479
470
  describe "BoundingBox#move_past_bottom" do
@@ -484,9 +475,9 @@ describe "BoundingBox#move_past_bottom" do
484
475
  @pdf.text "Foo"
485
476
 
486
477
  pages = PDF::Inspector::Page.analyze(@pdf.render).pages
487
- pages.size.should == 2
488
- pages[0][:strings].should == []
489
- pages[1][:strings].should == ["Foo"]
478
+ expect(pages.size).to eq(2)
479
+ expect(pages[0][:strings]).to eq([])
480
+ expect(pages[1][:strings]).to eq(["Foo"])
490
481
  end
491
482
 
492
483
  it "should move to the top of the next page if it exists already" do
@@ -499,12 +490,12 @@ describe "BoundingBox#move_past_bottom" do
499
490
  @pdf.text "Foo"
500
491
 
501
492
  @pdf.bounds.move_past_bottom
502
- @pdf.y.should be_within(0.001).of(top_y)
493
+ expect(@pdf.y).to be_within(0.001).of(top_y)
503
494
  @pdf.text "Bar"
504
495
 
505
496
  pages = PDF::Inspector::Page.analyze(@pdf.render).pages
506
- pages.size.should == 2
507
- pages[0][:strings].should == ["Foo"]
508
- pages[1][:strings].should == ["Bar"]
497
+ expect(pages.size).to eq(2)
498
+ expect(pages[0][:strings]).to eq(["Foo"])
499
+ expect(pages[1][:strings]).to eq(["Bar"])
509
500
  end
510
501
  end