File: compiling_test.rb

package info (click to toggle)
ruby-handlebars-assets 2%3A0.23.9%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 300 kB
  • sloc: ruby: 744; sh: 46; javascript: 15; makefile: 10
file content (30 lines) | stat: -rw-r--r-- 859 bytes parent folder | download | duplicates (4)
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
require 'test_helper'

module HandlebarsAssets
  class CompilingTest < ::MiniTest::Test

    def setup
      HandlebarsAssets::Config.reset!
      HandlebarsAssets::Handlebars.reset!
    end

    def test_custom_handlebars
      source = "This is {{handlebars}}"

      HandlebarsAssets::Config.compiler_path = File.expand_path '../../edge', __FILE__

      compiled = Handlebars.precompile(source, HandlebarsAssets::Config.options)
      assert_match /PRECOMPILE CALLED/, compiled
    end

    def test_patching_handlebars
      source = "This is {{nested.handlebars}}"

      HandlebarsAssets::Config.patch_path = File.expand_path '../../patch', __FILE__
      HandlebarsAssets::Config.patch_files = ['patch.js']

      compiled = Handlebars.precompile(source, HandlebarsAssets::Config.options)
      assert_match /CALLED PATCH/, compiled
    end
  end
end