Sha256: 38e1f418a7d6bdf05f9b1c14c97a0b1c2d49a7f5a6678689d27dcf6e460e941e
Contents?: true
Size: 939 Bytes
Versions: 1
Compression:
Stored size: 939 Bytes
Contents
require 'test/unit' require 'tempfile' require 'sprockets-cjs' class SprocketsCJSTest < Test::Unit::TestCase TEST_DIR = File.expand_path('..', __FILE__) LIB_DIR = File.expand_path('../lib/assets/javascripts', TEST_DIR) attr_reader :output def setup env = Sprockets::Environment.new env.register_postprocessor 'application/javascript', Sprockets::CJS env.append_path TEST_DIR env.append_path LIB_DIR outfile = Tempfile.new('sprockets-output') env['source.js'].write_to outfile.path @output = File.read outfile.path end def test_adds_commonjs_require assert_match %r[var require = function\(name, root\) {], @output end def test_modularizes_modules assert_match %r[require.define\({\"modules/foo\":function], @output assert_match %r["Foo!"], @output end def test_does_not_modularize_non_modules assert_no_match %r[require.define\({\"bar\":function], @output end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sprockets-cjs-0.1.0 | test/sprockets_cjs_test.rb |