Debian Codegraph @

test/autoloading_test.rb

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 require_relative 'helper'
2
3 module TestViews; end
4
5 class AutoloadingTest < Minitest::Test
6 def setup
7 Mustache.view_path = File.dirname(__FILE__) + '/fixtures'
8 end
9
10 def test_autoload
11 klass = Mustache.view_class(:Comments)
12 assert_equal Comments, klass
13 end
14
15 def test_autoload_lowercase
16 klass = Mustache.view_class(:comments)
17 assert_equal Comments, klass
18 end
19
20 def test_autoload_nil
21 klass = Mustache.view_class(nil)
22 assert_equal Mustache, klass
23 end
24
25 def test_autoload_empty_string
26 klass = Mustache.view_class('')
27 assert_equal Mustache, klass
28 end
29
30 def test_namespaced_autoload
31 Mustache.view_namespace = TestViews
32 klass = Mustache.view_class('Namespaced')
33 assert_equal TestViews::Namespaced, klass
34 assert_equal <<-end_render.strip, klass.render
35 <h1>Dragon &lt; Tiger</h1>
36 end_render
37 end
38
39 def test_folder_autoload
40 assert_equal TestViews::Namespaced, Mustache.view_class('test_views/namespaced')
41 end
42
43 def test_namespaced_partial_autoload
44 Mustache.view_namespace = TestViews
45 klass = Mustache.view_class(:namespaced_with_partial)
46 assert_equal TestViews::NamespacedWithPartial, klass
47 assert_equal <<-end_render.strip, klass.render
48 My opinion: Again, Victory!
49 end_render
50 end
51
52 def test_bad_constant_name
53 assert_equal Mustache, Mustache.view_class(404)
54 end
55 end