Sha256: 15e950349e76984790f989197d0c1448b6dcf6932a854a0e5e39dcc305f75a68
Contents?: true
Size: 1.6 KB
Versions: 16
Compression:
Stored size: 1.6 KB
Contents
#!/usr/bin/env ruby require 'test/unit' currentPath = File.dirname(__FILE__) require File.join( currentPath, '../lib/masterview' ) require 'masterview/extras/watcher.rb' class TestTemplateFileWatcher < Test::Unit::TestCase CurrentPath = File.dirname(__FILE__) MVTemplateDir = File.join(CurrentPath, '../examples') MVFilenamePattern = '*.html' TmpOutputDir = File.join(CurrentPath, '../tmp/views') MVProductFile = File.join(CurrentPath, '../examples/product.html') def setup FileUtils.remove_dir(TmpOutputDir, true) end def test_a_run files_run = MasterView::TemplateFileWatcher.check(MVTemplateDir, MVFilenamePattern, true) do |f| MasterView::Parser.parse_file( f, TmpOutputDir ) end assert_equal [MVProductFile], files_run assert File.exist?(TmpOutputDir+'/layouts/product.rhtml') assert File.exist?(TmpOutputDir+'/product/_form.rhtml') assert File.exist?(TmpOutputDir+'/product/edit.rhtml') assert File.exist?(TmpOutputDir+'/product/list.rhtml') assert File.exist?(TmpOutputDir+'/product/new.rhtml') assert File.exist?(TmpOutputDir+'/product/show.rhtml') end def test_b_no_change files_run = MasterView::TemplateFileWatcher.check(MVTemplateDir, MVFilenamePattern, true) do |f| MasterView::Parser.parse_file( f, TmpOutputDir ) end assert_equal [], files_run end def test_c_file_changed_run FileUtils.touch MVProductFile files_run = MasterView::TemplateFileWatcher.check(MVTemplateDir, MVFilenamePattern, true) do |f| MasterView::Parser.parse_file( f, TmpOutputDir ) end assert_equal [MVProductFile], files_run end end
Version data entries
16 entries across 16 versions & 2 rubygems