Sha256: bca63510edb48dffedbe314ed86a96c5c05af5b89258f853ca9ef75e6f715ae0
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
require 'test/unit' require File.dirname(__FILE__) + '/../lib/staticmatic' class StaticMaticBaseTest < Test::Unit::TestCase def setup @base_dir = File.dirname(__FILE__) + '/sandbox/test_site' @tmp_dir = File.dirname(__FILE__) + '/sandbox/tmp' @staticmatic = StaticMatic::Base.new(@base_dir) end def test_should_setup_directories staticmatic = StaticMatic::Base.new(@tmp_dir) staticmatic.run('setup') StaticMatic::Base.base_dirs.each do |dir| assert File.exists?("#{@tmp_dir}/#{dir}"), "Should create #{dir}" end StaticMatic::Base.base_dirs.reverse.each do |dir| Dir.entries("#{@tmp_dir}/#{dir}").each do |file| next if file.match(/^\./) File.delete("#{@tmp_dir}/#{dir}/#{file}") end Dir.delete("#{@tmp_dir}/#{dir}") if File.exists?("#{@tmp_dir}/#{dir}") end end def test_should_generate_html_with_layout content = @staticmatic.generate_html_with_layout("index") assert_match "StaticMatic", content assert_match "This is some test content", content end def test_should_generate_html_with_layout_assigned_in_template content = @staticmatic.generate_html_with_layout("layout_test") assert_match "Alternate Layout", content end def test_should_generate_css content = @staticmatic.generate_css("application") end def test_should_find_source_filename_from_path assert_equal "application", @staticmatic.source_template_from_path("@base_dir/src/stylesheets/application.css")[1] end def test_should_find_layout_from_passed_path assert_equal "projects", @staticmatic.detirmine_layout("test/projects") end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
staticmatic-0.8.5 | test/base_test.rb |
staticmatic-0.8.6 | test/base_test.rb |