Sha256: 63a6896cf8a4bb7df00a08c5c61c144676ddc45383a23036d5566c4940654f5f

Contents?: true

Size: 1007 Bytes

Versions: 11

Compression:

Stored size: 1007 Bytes

Contents

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

class PartialsTest < Test::Unit::TestCase
  include Haml::Helpers
  include Sinatra::Helpers::Haml::Partials
  include Sinatra::Templates

  @templates = {}

  class << self
    attr_accessor :templates
  end

  attr_accessor :options

  def setup
    @options = mock()
    @options.stubs(:views => File.dirname(__FILE__) + '/views')
    init_haml_helpers
    super
  end

  def test_partial
    assert_html haml_partial('thing'), nil, "<p>Hello world</p>\n"
  end

  def test_partial_with_object
    assert_html haml_partial('object', :object => mock(:name => 'object')), nil, "<p>Hello object</p>\n"
  end

  def test_partial_with_locals
    assert_html haml_partial('object', :locals => { :object => mock(:name => 'local')}), nil, "<p>Hello local</p>\n"
  end

  def test_partial_with_collection
    assert_html haml_partial('object', :collection => [ mock(:name => 'one'), mock(:name => 'two')]), nil, "<p>Hello one</p>\n<p>Hello two</p>\n"
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
sbfaulkner-sinatra-helpers-0.9.1 test/haml/partials_test.rb
tdreyno-middleman-0.2.8 vendor/sinatra-helpers/test/haml/partials_test.rb
tdreyno-middleman-0.2.9 vendor/sinatra-helpers/test/haml/partials_test.rb
tdreyno-middleman-0.3.0 vendor/sinatra-helpers/test/haml/partials_test.rb
tdreyno-middleman-0.3.1 vendor/sinatra-helpers/test/haml/partials_test.rb
middleman-0.3.6 vendor/sinatra-helpers/test/haml/partials_test.rb
middleman-0.3.5 vendor/sinatra-helpers/test/haml/partials_test.rb
middleman-0.2.8 vendor/sinatra-helpers/test/haml/partials_test.rb
middleman-0.2.9 vendor/sinatra-helpers/test/haml/partials_test.rb
middleman-0.3.0 vendor/sinatra-helpers/test/haml/partials_test.rb
middleman-0.3.1 vendor/sinatra-helpers/test/haml/partials_test.rb