Sha256: 8f493d0376ee95f526f64a2b5c5d12b913006af023529f6edd96cb0f06bdb534

Contents?: true

Size: 834 Bytes

Versions: 2

Compression:

Stored size: 834 Bytes

Contents

require File.dirname(__FILE__) + '/helper'

class YieldTest < Test::Unit::TestCase
  include Liquor
  
  def test_yield_for_layout
    layout_template = '<title>test</title> <body>{% yield %}</body>'
    view_template = '{% assign text="body" %}{{ text }}'
    
    rendered_template = Template.parse(view_template).render({ :layout => Template.parse(layout_template) })
    
    assert_equal '<title>test</title> <body>body</body>', rendered_template
  end
  
  def test_yield_for_not_defined
    layout_template = '<title>{% yield title %}</title> <body>{% yield %}</body>'
    view_template = '{% assign text="body" %}{{ text }}'
    
    rendered_template = Template.parse(view_template).render({ :layout => Template.parse(layout_template) })
    
    assert_equal '<title></title> <body>body</body>', rendered_template
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
liquor-0.1.1 test/yield_test.rb
liquor-0.1.0 test/yield_test.rb