test/unit/generator/test_pdf.rb in thinreports-0.7.7 vs test/unit/generator/test_pdf.rb in thinreports-0.8.0
- old
+ new
@@ -1,20 +1,23 @@
# coding: utf-8
-require 'test/unit/helper'
+require 'test_helper'
-class ThinReports::Generator::TestPDF < MiniTest::Unit::TestCase
- include ThinReports::TestHelpers
-
- # Alias
- PDF = ThinReports::Generator::PDF
-
+class Thinreports::Generator::TestPDF < Minitest::Test
+ include Thinreports::TestHelper
+
+ PDF = Thinreports::Generator::PDF
+
def test_new_should_set_title_as_metadata
- report = create_basic_report('basic_layout1.tlf') {|r| r.start_new_page }
-
- flexmock(PDF::Document).should_receive(:new).
- with(Hash, :Title => 'Basic Layout').once
-
- PDF.new(report, {})
+ report = new_report('layout_text1.tlf') {|r| r.start_new_page }
+
+ actual_pdf_title = nil
+ PDF::Document.define_singleton_method(:new) {|options, meta|
+ actual_pdf_title = meta[:Title]
+ }
+ PDF.new report, {}
+
+ assert_equal 'Basic Layout', actual_pdf_title
+ ensure
+ PDF::Document.singleton_class.send(:remove_method, :new)
end
end
-