Sha256: e400781b967386af24067b47fb968390342aca7f5aac0274c08d919b25b51d52
Contents?: true
Size: 1.79 KB
Versions: 1
Compression:
Stored size: 1.79 KB
Contents
$:.unshift File.join(File.dirname(__FILE__), "..", "..", "lib") require 'test/unit' require 'buildmaster' module BuildMaster class SiteSpecTest < Test::Unit::TestCase def test_should_get_relative_path spec = SiteSpec.new spec.content_dir = '/one/two/content' assert_equal('images/logo.gif', spec.relative_to_root('/one/two/content/images/logo.gif').to_s) end def test_should_support_windows_path spec = SiteSpec.new spec.content_dir = "C:\\Work\\project\\content" assert_equal('images/logo.gif', spec.relative_to_root('C:\\Work\\project\\content\\images\\logo.gif').to_s) end def test_should_evaluate spec = SampleSiteSpec.new spec.content_dir = '/one/two/content' result = spec.evaluate('expression', '/one/two/content/dir/file.txt') assert_equal('dir/file.txt', result) end def test_should_check_for_property spec = SiteSpec.new spec.content_dir = "/one" spec.add_property('release', '0.6') assert_equal('0.6', spec.evaluate('release', '/one')) end def test_should_throw_error_with_proper_message_for_expression_problem spec = SiteSpec.new spec.content_dir = "/one" begin spec.evaluate('expression', '/one/two') fail('exception should have been thrown') rescue RuntimeError => boom assert_equal("Neither property nor method found with name 'expression'", boom.message) end end def test_relative_to_root_expression spec = SiteSpec.new spec.content_dir = '/one' actual = spec.evaluate('relative_to_root', '/one/two') assert_equal(Pathname.new('two'), actual) end end class SampleSiteSpec < SiteSpec private def expression(path) return path end def expression2 return 'expected' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
BuildMaster-0.7.0 | test/buildmaster/tc_site_spec.rb |