Sha256: 5548274a1c14312aaf1dd7e7a1a0265634d72dad5ece9a21d099d7ef91c7e889
Contents?: true
Size: 1.01 KB
Versions: 14
Compression:
Stored size: 1.01 KB
Contents
require 'spec_helper' module WLang describe Dialect, ".compile" do def compile(s, options = nil) options.nil? ? Upcasing.compile(s) : Upcasing.compile(s, options) end it 'returns a Template' do compile(hello_tpl).should be_a(Template) end it 'supports a path-like as input' do compile(hello_path).should be_a(Template) end it 'supports an IO object as input' do hello_io do |f| compile(f).should be_a(Template) end end specify 'returned template is callable' do compile(hello_tpl).call.should eq("Hello WHO!") end specify 'returned template is renderable' do compile(hello_tpl).render.should eq("Hello WHO!") end it 'returns a thread-safe template object' do t = WLang.dialect{ tag('$'){|buf,fn| raise if defined?(@somevar) @somevar = "World" } }.compile('${who}') 2.times do lambda{ t.call }.should_not raise_error end end end # describe Dialect end # module WLang
Version data entries
14 entries across 14 versions & 1 rubygems