test/processor_test.rb in sablon-0.0.8 vs test/processor_test.rb in sablon-0.0.9
- old
+ new
@@ -15,16 +15,18 @@
def test_simple_field_replacement
result = process(snippet("simple_field"), {"first_name" => "Jack"})
assert_equal "Hello! My Name is Jack , nice to meet you.", text(result)
assert_xml_equal <<-document, result
+ <w:p>
<w:r><w:t xml:space="preserve">Hello! My Name is </w:t></w:r>
<w:r w:rsidR="004B49F0">
<w:rPr><w:noProof/></w:rPr>
<w:t>Jack</w:t>
</w:r>
<w:r w:rsidR="00BE47B1"><w:t xml:space="preserve">, nice to meet you.</w:t></w:r>
+ </w:p>
document
end
def test_context_can_contain_string_and_symbol_keys
result = process(snippet("simple_fields"), {"first_name" => "Jack", last_name: "Davis"})
@@ -34,29 +36,33 @@
def test_complex_field_replacement
result = process(snippet("complex_field"), {"last_name" => "Zane"})
assert_equal "Hello! My Name is Zane , nice to meet you.", text(result)
assert_xml_equal <<-document, result
+ <w:p>
<w:r><w:t xml:space="preserve">Hello! My Name is </w:t></w:r>
<w:r w:rsidR="004B49F0">
<w:rPr><w:b/><w:noProof/></w:rPr>
<w:t>Zane</w:t>
</w:r>
<w:r w:rsidR="00BE47B1"><w:t xml:space="preserve">, nice to meet you.</w:t></w:r>
+ </w:p>
document
end
def test_complex_field_replacement_with_split_field
result = process(snippet("edited_complex_field"), {"first_name" => "Daniel"})
assert_equal "Hello! My Name is Daniel , nice to meet you.", text(result)
assert_xml_equal <<-document, result
+ <w:p>
<w:r><w:t xml:space="preserve">Hello! My Name is </w:t></w:r>
<w:r w:rsidR="00441382">
<w:rPr><w:noProof/></w:rPr>
<w:t>Daniel</w:t>
</w:r>
<w:r w:rsidR="00BE47B1"><w:t xml:space="preserve">, nice to meet you.</w:t></w:r>
+ </w:p>
document
end
def test_paragraph_block_replacement
result = process(snippet("paragraph_loop"), {"technologies" => ["Ruby", "Rails"]})