Sha256: 7d1a305150c3391b021bb001f089dcc10f490750744860a212b9e7d7fbbfa665
Contents?: true
Size: 1.35 KB
Versions: 5
Compression:
Stored size: 1.35 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 MasterView module ParserMock def self.createMockDCS dcs = OpenStruct.new dcs.context = {} dcs.context[:tag] = OpenStruct.new dcs.context[:tag].attributes = CaseInsensitiveHash.new dcs end end end module Test module Unit module Assertions def assert_template_result(expected, template, options={}, message=nil, normalize_white_space=true) #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) if normalize_white_space 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 end assert_equal expected, MasterView::IOMgr.erb.string_hash, message end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
masterview-0.3.3 | test/test_helper.rb |
masterview-0.3.0 | test/test_helper.rb |
masterview-0.3.1 | test/test_helper.rb |
masterview-0.3.2 | test/test_helper.rb |
masterview-0.3.4 | test/test_helper.rb |