Sha256: 39b81fe7fe5f07b5c977720ddc860de0986d7f81b52e0dc8232a62bb035c29f4
Contents?: true
Size: 1.05 KB
Versions: 10
Compression:
Stored size: 1.05 KB
Contents
# Test facets/buildable.rb require 'facets/buildable.rb' require 'test/unit' class TestBuildable < Test::Unit::TestCase module M include Buildable extend self def m(n,*m) ; "#{n}{#{m}}"; end def t(n) ; "#{n}"; end alias :build :m end def test_01 str = M.build do html do head do title "Test" end body do i "Hello" build! :not t "Test" t "Hey" end end end r = "html{head{title{Test}}body{i{Hello}not{}TestHey}}" assert_equal( r, M.builder.to_s ) end end # class TestBuildingBlock < Test::Unit::TestCase module M extend self def m(n,*m) ; "#{n}{#{m}}"; end def t(n) ; "#{n}"; end end def test_01 build = BuildingBlock.new(M, :m) build.html do head do title "Test" end body do i "Hello" build! :not t "Test" t "Hey" end end r = "html{head{title{Test}}body{i{Hello}not{}TestHey}}" assert_equal( r, build.to_s ) end end
Version data entries
10 entries across 10 versions & 1 rubygems