spec/integration/html/test_caret.rb in wlang-2.0.0.beta vs spec/integration/html/test_caret.rb in wlang-2.0.0

- old
+ new

@@ -1,25 +1,38 @@ require 'spec_helper' require 'wlang/html' module WLang describe Html, "^{...}" do + debug = Module.new{ def inspect; "lambda{ #{call.inspect} }"; end } + def render(tpl, scope = {}) Html.render(tpl, scope, "") end - [false, nil].each do |test| + [ + false, + nil, + lambda{ nil }.extend(debug), + lambda{ false }.extend(debug) + ].each do |test| context "when #{test.inspect}" do it 'renders the then block' do render("^{test}{hello}", binding).should eq("hello") end it 'does not render the else block' do render("^{test}{hello}{otherwise}", binding).should eq("hello") end end end - [true, "Something", []].each do |test| + [ + true, + "Something", + [], + lambda{ true }.extend(debug), + lambda{ "something" }.extend(debug) + ].each do |test| context "when #{test.inspect}" do it 'do not render the then block' do render("^{test}{hello}", binding).should eq("") end it 'renders the else block if present' do \ No newline at end of file