Browse files

tweak these specs to work when spacing between lines changes

  • Loading branch information...
1 parent 3ce70ae commit 972d7d64e1fa8e55b63975b6c40ebc1dfef5964b @yob committed Nov 21, 2012
Showing with 9 additions and 5 deletions.
  1. +6 −2 spec/integration_spec.rb
  2. +3 −3 spec/page_text_receiver_spec.rb
View
8 spec/integration_spec.rb
@@ -231,15 +231,19 @@
filename = pdf_spec_file("encrypted_with_user_pass_apples")
PDF::Reader.open(filename, :password => "apples") do |reader|
- reader.page(1).text.should eql("This sample file is encrypted with a user password.\nUser password: apples\nOwner password: password")
+ reader.page(1).text.should match(/^This sample file is encrypted with a user password.$/m)
+ reader.page(1).text.should match(/^User password: apples$/m)
+ reader.page(1).text.should match(/^Owner password: password$/m)
end
end
it "should correctly extract text from an encrypted PDF with an owner password" do
filename = pdf_spec_file("encrypted_with_user_pass_apples")
PDF::Reader.open(filename, :password => "password") do |reader|
- reader.page(1).text.should eql("This sample file is encrypted with a user password.\nUser password: apples\nOwner password: password")
+ reader.page(1).text.should match(/^This sample file is encrypted with a user password.$/)
+ reader.page(1).text.should match(/^User password: apples$/m)
+ reader.page(1).text.should match(/^Owner password: password$/m)
end
end
View
6 spec/page_text_receiver_spec.rb
@@ -21,7 +21,7 @@
@page.walk(@receiver)
- @receiver.content.should eql("Hello World\nFrom James")
+ @receiver.content.should match(/\AHello World$.+^From James\Z/m)
end
it "should return the text content from Form XObjects" do
@@ -41,7 +41,7 @@
@page.walk(@receiver)
- @receiver.content.should eql("James Healy\nSome regular content")
+ @receiver.content.should match(/\AJames Healy$.+^Some regular content\Z/m)
end
it "should correctly parse a page with nested Form XObjects" do
@@ -61,7 +61,7 @@
@page.walk(@receiver)
- @receiver.content.should eql("one\ntwo\nthree\nfour")
+ @receiver.content.should match(/\Aone$.+^two$.+^three$.+^four\Z/m)
end
end

0 comments on commit 972d7d6

Please sign in to comment.