Sha256: 274e9e4f324acfd1ec876016a5bf1877f902e0f7e68f399cdc5b33da606dfcb1
Contents?: true
Size: 1.96 KB
Versions: 5
Compression:
Stored size: 1.96 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_initial_configuration_settings assert_equal true, @staticmatic.configuration.use_extensions_for_page_links assert_equal 3000, @staticmatic.configuration.preview_server_port 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
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
staticmatic-0.9.0 | test/base_test.rb |
staticmatic-0.9.1 | test/base_test.rb |
staticmatic-0.9.4 | test/base_test.rb |
staticmatic-0.9.3 | test/base_test.rb |
staticmatic-0.9.5 | test/base_test.rb |