opal-sprockets 0.4.9.1.0.3.7 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +26 -0
- data/CHANGELOG.md +11 -0
- data/bin/console +14 -0
- data/bin/rake +6 -0
- data/bin/rspec +29 -0
- data/bin/setup +8 -0
- data/lib/opal/environment.rb +4 -0
- data/lib/opal/processor.rb +4 -0
- data/lib/opal/sprockets.rb +13 -81
- data/lib/opal/sprockets/assets_helper.rb +78 -0
- data/lib/opal/sprockets/environment.rb +12 -14
- data/lib/opal/sprockets/erb.rb +12 -16
- data/lib/opal/sprockets/mime_types.rb +19 -0
- data/lib/opal/sprockets/processor.rb +111 -114
- data/lib/opal/sprockets/server.rb +94 -98
- data/lib/opal/sprockets/version.rb +1 -8
- data/opal-sprockets.gemspec +38 -24
- data/spec/fixtures/complex_sprockets.js.rb.erb +1 -1
- data/spec/fixtures/{jst_file.js.jst → jst_file.jst.ejs} +0 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/sprockets/erb_spec.rb +15 -25
- data/spec/sprockets/processor_spec.rb +53 -57
- data/spec/sprockets/server_spec.rb +95 -25
- data/spec/tilt/opal_spec.rb +1 -1
- metadata +66 -24
- data/.travis.yml +0 -21
- data/lib/opal/sprockets/path_reader.rb +0 -36
- data/spec/shared/path_finder_shared.rb +0 -19
- data/spec/shared/path_reader_shared.rb +0 -31
- data/spec/sprockets/path_reader_spec.rb +0 -41
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'shared/path_reader_shared'
|
3
|
-
require 'opal/sprockets/path_reader'
|
4
|
-
|
5
|
-
describe Opal::Sprockets::PathReader do
|
6
|
-
let(:env) { Sprockets::Environment.new }
|
7
|
-
let(:context) { double('context', depend_on: nil, depend_on_asset: nil) }
|
8
|
-
let(:contents) { File.read(full_path) }
|
9
|
-
let(:full_path) { fixtures_dir.join(logical_path+'.js.rb') }
|
10
|
-
let(:logical_path) { 'sprockets_file' }
|
11
|
-
let(:fixtures_dir) { Pathname('../../fixtures/').expand_path(__FILE__) }
|
12
|
-
|
13
|
-
subject(:path_reader) { described_class.new(env, context) }
|
14
|
-
|
15
|
-
before do
|
16
|
-
Opal.paths.each {|p| env.append_path(p)}
|
17
|
-
env.append_path fixtures_dir
|
18
|
-
end
|
19
|
-
|
20
|
-
include_examples :path_reader do
|
21
|
-
let(:path) { logical_path }
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'can read stuff from sprockets env' do
|
25
|
-
expect(path_reader.read(logical_path)).to eq(contents)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'reads js files processing their directives' do
|
29
|
-
path = 'file_with_directives.js'
|
30
|
-
full_path = fixtures_dir.join(path)
|
31
|
-
required_contents = File.read(fixtures_dir.join('required_file.js')).strip
|
32
|
-
read_contents = path_reader.read(path)
|
33
|
-
actual_contents = full_path.read
|
34
|
-
|
35
|
-
expect(actual_contents).to include('//= require')
|
36
|
-
expect(read_contents).not_to include('//= require')
|
37
|
-
|
38
|
-
expect(read_contents).to include(required_contents)
|
39
|
-
expect(actual_contents).not_to include(required_contents)
|
40
|
-
end
|
41
|
-
end
|