Sha256: a26711a9a787d2677d84b17b4ff74892109e79b2d83933b670914faddb8ec996

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

require 'test/unit'
require 'test/unit/assertions'
currentPath = File.dirname(__FILE__)
require File.join( currentPath, '../lib/masterview' )

MasterView::OmitGeneratedComments = true #turn off the generated comments to make it easier for us to test


module Test
  module Unit
    module Assertions
        def assert_template_result(expected, template, options={}, message=nil)
          #options[:template_pathname] = Pathname.for_path(options.delete(:template_path)) if options[:template_path]
          output_hash = {}
          full_options = options.merge( { :output_mio_tree => MasterView::IOMgr.erb } )
          MasterView::Parser.parse(template, full_options)
          MasterView::IOMgr.erb.string_hash.each do |key,value|
            value.gsub!( /([^=]>)\s+/, '\1' ) #remove whitespace after tag but not => 
            value.gsub!( /(\s{2,}|\n\s*)/, ' ') #change double space or newline and spaces into single space 
          end
          assert_equal expected, MasterView::IOMgr.erb.string_hash, message
        end 
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
masterview-0.2.0 test/test_helper.rb
masterview-0.2.1 test/test_helper.rb
masterview-0.2.2 test/test_helper.rb
masterview-0.2.3 test/test_helper.rb
masterview-0.2.4 test/test_helper.rb
masterview-0.2.5 test/test_helper.rb