Sha256: ba708acc3b13f1e485fd48d2a842ee2b646be5bb8523c7982c12a5f006864e9e

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 KB

Contents

# -*- coding: utf-8 -*-
require 'helper'

class ErbLatexTest < MiniTest::Test


    def test_document
        tmpl = ErbLatex::Template.new( document(:valid) )
        tmpl.to_file tmp_output_file
        assert_match "This is a very simple file", text_output
    end

    def test_errors
        tmpl = ErbLatex::Template.new( document(:with_error) )
        assert_raises(ErbLatex::LatexError) do
            tmpl.to_stringio
        end
    end

    def test_layout
        tmpl = ErbLatex::Template.new( document(:body),
                                       :layout => document(:layout),
                                       :data   => { :sentence=>"hello, this is doge" }
                                     )
        tmpl.to_file tmp_output_file
        assert_match "hello, this is doge", text_output
    end

    def test_multiple_runs
        tmpl = ErbLatex::Template.new( document(:multi_page) )
        tmpl.to_file tmp_output_file
        assert_equal 2, tmpl.pass_count
        text = text_output
        assert_match "Page 1 of 3", text
        assert_match "Page 2 of 3", text
        assert_match "Page 3 of 3", text
    end

    def test_partials
        tmpl = ErbLatex::Template.new( document(:with_partial) )
        tmpl.to_file tmp_output_file
        assert_match "a test ’ of a partial", text_output
    end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
erb_latex-0.2.0 test/erb_latex_test.rb
erb_latex-0.0.1 test/erb_latex_test.rb