spec/integration_spec.rb in prawn_cocktail-0.6.0 vs spec/integration_spec.rb in prawn_cocktail-0.7.0
- old
+ new
@@ -1,7 +1,6 @@
-require "minitest/autorun"
-require "minitest/pride"
+require_relative "spec_helper"
require "pdf/inspector"
require "prawn_cocktail"
PrawnCocktail.template_root = "spec/fixtures"
@@ -12,30 +11,36 @@
TestDocument.new("success").render
end
describe "#render" do
it "has the right contents" do
- assert_document_has_the_right_contents
+ assert_equal(
+ [ "Init works.", "Test document", "Status: success" ],
+ parse_strings(data)
+ )
end
it "has the right geometry" do
- assert_document_has_the_right_geometry
+ assert_equal expected_geometry("A4"), parse_geometry(data)
end
end
describe "#render_file" do
let(:data) do
TestDocument.new("success").render_file("/tmp/test_document.pdf")
File.read("/tmp/test_document.pdf")
end
it "has the right contents" do
- assert_document_has_the_right_contents
+ assert_equal(
+ [ "Init works.", "Test document", "Status: success" ],
+ parse_strings(data)
+ )
end
it "has the right geometry" do
- assert_document_has_the_right_geometry
+ assert_equal expected_geometry("A4"), parse_geometry(data)
end
end
describe "inheriting documents" do
let(:data) do
@@ -47,23 +52,9 @@
[ "Init works.", "Sub-init works.", "Sub test document", "Status: success" ],
parse_strings(data)
)
end
end
-end
-
-def assert_document_has_the_right_contents
- assert_equal(
- [ "Init works.", "Test document", "Status: success" ],
- parse_strings(data)
- )
-end
-
-def assert_document_has_the_right_geometry
- assert_equal(
- parse_geometry(data),
- expected_geometry("A4")
- )
end
def parse_strings(pdf_data)
PDF::Inspector::Text.analyze(pdf_data).strings
end