Sha256: 10071a2c8e421d7804b4a5f36409fb96feef26bce96cf6b675ccd887ad771059

Contents?: true

Size: 1.25 KB

Versions: 13

Compression:

Stored size: 1.25 KB

Contents

$LOAD_PATH.unshift File.dirname(__FILE__)
require 'helper'

module TestViews; end

class AutoloadingTest < Test::Unit::TestCase
  def setup
    Mustache.view_path = File.dirname(__FILE__) + '/fixtures'
  end

  def test_autoload
    klass = Mustache.view_class(:Comments)
    assert_equal Comments, klass
  end

  def test_autoload_lowercase
    klass = Mustache.view_class(:comments)
    assert_equal Comments, klass
  end

  def test_autoload_nil
    klass = Mustache.view_class(nil)
    assert_equal Mustache, klass
  end

  def test_autoload_empty_string
    klass = Mustache.view_class('')
    assert_equal Mustache, klass
  end

  def test_namespaced_autoload
    Mustache.view_namespace = TestViews
    klass = Mustache.view_class('Namespaced')
    assert_equal TestViews::Namespaced, klass
    assert_equal <<-end_render.strip, klass.render
<h1>Dragon &lt; Tiger</h1>
end_render
  end

  def test_namespaced_partial_autoload
    Mustache.view_namespace = TestViews
    klass = Mustache.view_class(:namespaced_with_partial)
    assert_equal TestViews::NamespacedWithPartial, klass
    assert_equal <<-end_render.strip, klass.render
My opinion: Again, Victory!
end_render
  end

  def test_bad_constant_name
    assert_equal Mustache, Mustache.view_class(404)
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
mustache-0.98.0 test/autoloading_test.rb
mustache-0.13.0 test/autoloading_test.rb
mustache-0.12.1 test/autoloading_test.rb
mustache-0.12.0 test/autoloading_test.rb
angry_mob_common_targets-0.1.0 vendor/mustache/test/autoloading_test.rb
mustache-0.11.2 test/autoloading_test.rb
mustache-0.11.1 test/autoloading_test.rb
mustache-0.11.0 test/autoloading_test.rb
mustache-0.10.0 test/autoloading_test.rb
mustache-0.9.2 test/autoloading_test.rb
mustache-0.9.1 test/autoloading_test.rb
mustache-0.9.0 test/autoloading_test.rb
mustache-0.7.0 test/autoloading_test.rb