File: tilt_wikiclothtemplate_test.rb

package info (click to toggle)
ruby-tilt 2.0.0%2Breally1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 476 kB
  • ctags: 411
  • sloc: ruby: 3,546; makefile: 5
file content (32 lines) | stat: -rw-r--r-- 961 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require 'contest'
require 'tilt'

begin
  require 'wikicloth'

  class WikiClothTemplateTest < Test::Unit::TestCase
    test "is registered for '.mediawiki' files" do
      assert_equal Tilt::WikiClothTemplate, Tilt['test.mediawiki']
    end

    test "is registered for '.mw' files" do
      assert_equal Tilt::WikiClothTemplate, Tilt['test.mw']
    end

    test "is registered for '.wiki' files" do
      assert_equal Tilt::WikiClothTemplate, Tilt['test.wiki']
    end

    test "compiles and evaluates the template on #render" do
      template = Tilt::WikiClothTemplate.new { |t| "= Hello World! =" }
      assert_match /<h1>.*Hello World!.*<\/h1>/, template.render
    end

    test "can be rendered more than once" do
      template = Tilt::WikiClothTemplate.new { |t| "= Hello World! =" }
      3.times { assert_match /<h1>.*Hello World!.*<\/h1>/, template.render }
    end
  end
rescue LoadError => boom
  warn "Tilt::WikiClothTemplate (disabled)"
end