test/zafu_test.rb in zafu-0.7.5 vs test/zafu_test.rb in zafu-0.7.6
- old
+ new
@@ -13,13 +13,16 @@
class Dummy
include RubyLess
safe_method :hello => String
safe_method :one => {:class => String, :method => "dummy_one"}
+ safe_context :friend => Dummy
end
safe_method :dum => Dummy
+ safe_method :list => [Dummy]
safe_method :dum2 => {:class => Dummy, :nil => true}
+ safe_method [:raw, String] => String
context 'Compilation in a model' do
setup do
@node_context = Zafu::NodeContext.new('@test', Dummy)
end
@@ -31,15 +34,15 @@
should 'use the model to resolve methods' do
assert_equal '<%= @test.hello %>', zafu_erb('<r:hello/>')
end
should 'change node context by following safe_method types' do
- assert_equal '<% var1 = dum -%><%= var1.hello %>', zafu_erb("<r:dum do='hello'/>")
+ assert_equal '<% var1 = dum %><%= var1.hello %>', zafu_erb("<r:dum do='hello'/>")
end
context 'that can be nil' do
should 'wrap context in if' do
- assert_equal '<% if var1 = dum2 -%><%= var1.hello %><% end -%>', zafu_erb("<r:dum2 do='hello'/>")
+ assert_equal '<% if var1 = dum2 %><%= var1.hello %><% end %>', zafu_erb("<r:dum2 do='hello'/>")
end
end
end
# ========== YAML TESTS