Sha256: b005075194d183db59e32b3b8fd3ca0fec2614c7c77e7ed35ace0beae6de98dc
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
# -*- coding: utf-8 -*- require "test_helper" class ContextTest < Sablon::TestCase def test_converts_symbol_keys_to_string_keys transformed = Sablon::Context.transform({a: 1, b: {c: 2, "d" => 3}}) assert_equal({"a"=>1, "b"=>{"c" =>2, "d"=>3}}, transformed) end def test_recognizes_wordml_keys transformed = Sablon::Context.transform({"word_ml:mykey" => "<w:p><w:p>", "otherkey" => "<nope>"}) assert_equal({ "mykey"=>Sablon.content(:word_ml, "<w:p><w:p>"), "otherkey"=>"<nope>"}, transformed) end def test_recognizes_html_keys transformed = Sablon::Context.transform({"html:mykey" => "**yay**", "otherkey" => "<nope>"}) assert_equal({ "mykey"=>Sablon.content(:html, "**yay**"), "otherkey"=>"<nope>"}, transformed) end def test_does_not_wrap_html_and_wordml_with_nil_value transformed = Sablon::Context.transform({"html:mykey" => nil, "word_ml:otherkey" => nil, "normalkey" => nil}) assert_equal({ "mykey" => nil, "otherkey" => nil, "normalkey" => nil}, transformed) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sablon-0.0.21 | test/context_test.rb |
sablon-0.0.20 | test/context_test.rb |