|
1 | 1 | require "test_helper"
|
2 | 2 |
|
3 |
| -class ManifestContainerTest < ActiveSupport::TestCase |
4 |
| - def setup |
5 |
| - precompile_assets |
| 3 | +# Rails 3.x doesn't have `application.assets_manifest=` |
| 4 | +# I don't think we have to support Rails 3 + Sprockets 3 anyways! |
| 5 | +if Rails::VERSION::MAJOR > 3 |
| 6 | + class ManifestContainerTest < ActiveSupport::TestCase |
| 7 | + def setup |
| 8 | + precompile_assets |
6 | 9 |
|
7 |
| - # Make a new manifest since assets weren't compiled before |
8 |
| - config = Rails.application.config |
9 |
| - path = File.join(config.paths['public'].first, config.assets.prefix) |
10 |
| - new_manifest = Sprockets::Manifest.new(Rails.application.assets, path, config.assets.manifest) |
11 |
| - Rails.application.assets_manifest = new_manifest |
| 10 | + # Make a new manifest since assets weren't compiled before |
| 11 | + config = Rails.application.config |
| 12 | + path = File.join(config.paths['public'].first, config.assets.prefix) |
| 13 | + new_manifest = Sprockets::Manifest.new(Rails.application.assets, path) |
| 14 | + Rails.application.assets_manifest = new_manifest |
12 | 15 |
|
13 |
| - @manifest_container = React::ServerRendering::ManifestContainer.new |
14 |
| - end |
| 16 | + @manifest_container = React::ServerRendering::ManifestContainer.new |
| 17 | + end |
15 | 18 |
|
16 |
| - def teardown |
17 |
| - clear_precompiled_assets |
18 |
| - end |
| 19 | + def teardown |
| 20 | + clear_precompiled_assets |
| 21 | + end |
19 | 22 |
|
20 |
| - def test_find_asset_gets_asset_contents |
21 |
| - application_js_content = @manifest_container.find_asset("application.js") |
22 |
| - assert(application_js_content.length > 50000, "It's the compiled file") |
| 23 | + def test_find_asset_gets_asset_contents |
| 24 | + application_js_content = @manifest_container.find_asset("application.js") |
| 25 | + assert(application_js_content.length > 50000, "It's the compiled file") |
| 26 | + end |
23 | 27 | end
|
24 | 28 | end
|
0 commit comments