Sha256: 22bd82db939eae7410410875effa1b63fb8a9f8926053d52b5f324422a69cb34
Contents?: true
Size: 1.77 KB
Versions: 3
Compression:
Stored size: 1.77 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' @staticmatic = StaticMatic::Base.new(@base_dir) end def test_should_setup_directories tmp_dir = File.dirname(__FILE__) + '/sandbox/tmp' 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 def test_should_include_custom_helper content = @staticmatic.generate_html_with_layout("index") assert_match "Hello, Steve!", content end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
staticmatic-0.8.8 | test/base_test.rb |
staticmatic-0.8.10 | test/base_test.rb |
staticmatic-0.8.9 | test/base_test.rb |