mirror of
https://github.com/lloeki/sprockets-umodule.git
synced 2025-12-06 10:34:41 +01:00
Initial, working version
This commit is contained in:
commit
e9a75766fd
12 changed files with 196 additions and 0 deletions
44
spec/sprockets-umodule_spec.rb
Normal file
44
spec/sprockets-umodule_spec.rb
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
require 'spec_helper'
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.filter_run_excluding broken: true
|
||||
c.filter_run_excluding todo: true
|
||||
end
|
||||
|
||||
describe Sprockets::Umodule do
|
||||
before :each do
|
||||
@root = create_construct
|
||||
@assets = @root.directory 'assets'
|
||||
@env = Sprockets::Environment.new @root.to_s
|
||||
@env.append_path @assets.to_s
|
||||
end
|
||||
|
||||
after :each do
|
||||
@root.destroy!
|
||||
end
|
||||
|
||||
it 'processes umodule js files' do
|
||||
@assets.file 'foo.js.umodule', %Q[bar = function () { "bar" };\n]
|
||||
asset = @env['foo.js']
|
||||
asset.to_s.should eq <<-SOURCE
|
||||
(function () {
|
||||
define = require('module').define;
|
||||
|
||||
define('foo', function (exports, require, module) {
|
||||
bar = function () { "bar" };
|
||||
|
||||
});
|
||||
})();
|
||||
SOURCE
|
||||
end
|
||||
|
||||
it 'sets the module name with the directory' do
|
||||
@assets.file 'sub/foo.js.umodule', %Q[bar = function () { "bar" };\n]
|
||||
asset = @env['sub/foo.js']
|
||||
asset.to_s.should include %q[define('sub/foo',]
|
||||
end
|
||||
|
||||
it 'indents the module contents prettily'
|
||||
it 'works with coffeescript'
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue