Sha256: d774e5b5c9a9cdbf8f1c51455dd16c9522d4bb5e44d8de7072f4f1a6e54da86a
Contents?: true
Size: 949 Bytes
Versions: 1
Compression:
Stored size: 949 Bytes
Contents
require 'test/unit' require 'tempfile' require 'sprockets-commonjs' class SprocketsCommonjsTest < 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::CommonJS 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\(\{\"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-commonjs-mindreframer-0.1.0 | test/sprockets_commonjs_test.rb |