railpack 1.2.7 → 1.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26a629014375c6614d4b3c2e4f9673ff7df37152cb504cc236913d817f147123
4
- data.tar.gz: ad53fdfe5e81b6cab82e71b423104979d20c6ed49df64fab037861af6a6a47ea
3
+ metadata.gz: fe05b41d6d14b07c685da85ad0d3f7f89f15964372a0caa370d9774e990936a4
4
+ data.tar.gz: 35f84323f06c0132e245a5b6db03d852374be0887a52131273bf098c9d8cdf72
5
5
  SHA512:
6
- metadata.gz: 706d8c94a84dc23d1b3bd7bf88a6df3ef7f075770ef168efef448e4ac136ae82255c33007b4b8aee70ffcda1321fc26bdc1b8a79b447e74349745bdab097e839
7
- data.tar.gz: e3f6fb48000ad925127355df341824429091c19cb78299bcaa7caf3bcfd4c5a4a277d12a3c7c995dde3f5a8761d64303fef99a0586258e53e01839df96e4e2b3
6
+ metadata.gz: '006682248e46a9b3e75e80a87eb6d5add2a8faa5e7df3eb2dea9a310266e72f82dc521a329519fa415dd5f5d42aaf9f7ca8be3ce0e0323486cbab8d8291662ca'
7
+ data.tar.gz: b7edcd749a26210d6a5d7ea29e0d8a544f154f8f28d0f9b9beb0d8e1b14ec8f5dffe64162fc7eb0fde210f081722872f2b05b95f099c937a763196dfa756a98a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.2.9] - 2026-01-26
4
+
5
+ - Add comprehensive dedicated test files for Rails integration
6
+ - propshaft_test.rb: 7 focused tests for Propshaft manifest generation
7
+ - sprockets_test.rb: 10 focused tests for Sprockets manifest generation
8
+ - rails_integration_test.rb: Rails-specific integration tests
9
+ - Test subdirectory handling, digest calculation, multiple assets
10
+ - Test manifest structure validation, source map exclusion
11
+ - Test Rails constant detection, logger integration, config loading
12
+ - All 75 tests passing with 229 assertions
13
+
14
+ ## [1.2.8] - 2026-01-26
15
+
16
+ - Add Sprockets compatibility for older Rails applications
17
+ - Automatic asset pipeline detection (Propshaft vs Sprockets)
18
+ - Generate appropriate manifest format based on Rails version
19
+ - Propshaft manifest: .manifest.json (Rails 7+ default)
20
+ - Sprockets manifest: .sprockets-manifest-*.json (Rails < 7)
21
+ - Enhanced Rails integration for broader compatibility
22
+ - All 46 tests passing with 147 assertions
23
+
3
24
  ## [1.2.7] - 2026-01-26
4
25
 
5
26
  - Add dedicated test files for Manager and Bundler classes
@@ -10,6 +31,23 @@
10
31
  - Improved test organization with separate test files per major class
11
32
  - All 43 tests passing with 137 assertions
12
33
 
34
+ ## [1.2.6] - 2026-01-26
35
+
36
+ - Add dedicated config_test.rb file for Config class unit tests
37
+ - Comprehensive Config class testing with 12 focused unit tests
38
+ - Test initialization, default values, build flags/args, environment overrides
39
+ - Test YAML file loading, error handling, and dynamic method access
40
+ - Improved test organization with separate test files per class
41
+ - All 24 tests passing with 86 assertions
42
+
43
+ ## [1.2.5] - 2026-01-26
44
+
45
+ - Bump version to 1.2.5 - Add YAML config file loading test
46
+ - Add comprehensive YAML config file loading test
47
+ - Test that Railpack correctly reads config/railpack.yml from Rails.root
48
+ - Test bundler selection, environment overrides, and config merging
49
+ - All 19 tests passing with 72 assertions
50
+
13
51
  ## [1.2.4] - 2026-01-26
14
52
 
15
53
  - Add comprehensive test suite (19 tests, 72 assertions)
@@ -128,6 +128,39 @@ module Railpack
128
128
  outdir = config['outdir']
129
129
  return unless outdir && Dir.exist?(outdir)
130
130
 
131
+ # Detect asset pipeline type
132
+ pipeline_type = detect_asset_pipeline
133
+
134
+ case pipeline_type
135
+ when :propshaft
136
+ generate_propshaft_manifest(config)
137
+ when :sprockets
138
+ generate_sprockets_manifest(config)
139
+ else
140
+ # Default to Propshaft for Rails 7+
141
+ generate_propshaft_manifest(config)
142
+ end
143
+ rescue => error
144
+ Railpack.logger.warn "⚠️ Failed to generate asset manifest: #{error.message}"
145
+ end
146
+
147
+ private
148
+
149
+ def detect_asset_pipeline
150
+ # Check for Propshaft (Rails 7+ default)
151
+ if defined?(Propshaft) || (defined?(Rails) && Rails.version.to_f >= 7.0)
152
+ :propshaft
153
+ # Check for Sprockets
154
+ elsif defined?(Sprockets)
155
+ :sprockets
156
+ else
157
+ # Default to Propshaft for modern Rails or when no Rails is detected
158
+ :propshaft
159
+ end
160
+ end
161
+
162
+ def generate_propshaft_manifest(config)
163
+ outdir = config['outdir']
131
164
  manifest = {}
132
165
 
133
166
  # Find built assets - Propshaft format
@@ -135,28 +168,63 @@ module Railpack
135
168
  next unless File.file?(file)
136
169
  relative_path = Pathname.new(file).relative_path_from(Pathname.new(outdir)).to_s
137
170
 
138
- # Map logical names to physical files (Propshaft style)
139
- if relative_path.include?('application') && relative_path.end_with?('.js')
140
- manifest['application.js'] = {
141
- 'logical_path' => 'application.js',
142
- 'pathname' => Pathname.new(relative_path),
143
- 'digest' => Digest::MD5.file(file).hexdigest
144
- }
145
- elsif relative_path.include?('application') && relative_path.end_with?('.css')
146
- manifest['application.css'] = {
147
- 'logical_path' => 'application.css',
148
- 'pathname' => Pathname.new(relative_path),
149
- 'digest' => Digest::MD5.file(file).hexdigest
150
- }
151
- end
171
+ # Use relative path as logical path for Propshaft
172
+ logical_path = relative_path
173
+ manifest[logical_path] = {
174
+ 'logical_path' => logical_path,
175
+ 'pathname' => Pathname.new(relative_path),
176
+ 'digest' => Digest::MD5.file(file).hexdigest
177
+ }
152
178
  end
153
179
 
154
180
  # Write manifest for Propshaft (Rails 7+ default)
155
181
  manifest_path = "#{outdir}/.manifest.json"
156
182
  File.write(manifest_path, JSON.pretty_generate(manifest))
157
183
  Railpack.logger.debug "📄 Generated Propshaft manifest: #{manifest_path}"
158
- rescue => error
159
- Railpack.logger.warn "⚠️ Failed to generate asset manifest: #{error.message}"
184
+ end
185
+
186
+ def generate_sprockets_manifest(config)
187
+ outdir = config['outdir']
188
+ manifest = {
189
+ 'files' => {},
190
+ 'assets' => {}
191
+ }
192
+
193
+ # Find built assets - Sprockets format
194
+ Dir.glob("#{outdir}/**/*.{js,css}").each do |file|
195
+ next unless File.file?(file)
196
+ relative_path = Pathname.new(file).relative_path_from(Pathname.new(outdir)).to_s
197
+
198
+ # Generate digest for Sprockets format
199
+ digest = Digest::MD5.file(file).hexdigest
200
+ logical_path = relative_path
201
+
202
+ # Map logical names (Sprockets style) - only for application files
203
+ if relative_path.include?('application') && relative_path.end_with?('.js')
204
+ manifest['assets']['application.js'] = "#{digest}-#{File.basename(relative_path)}"
205
+ logical_path = 'application.js'
206
+ elsif relative_path.include?('application') && relative_path.end_with?('.css')
207
+ manifest['assets']['application.css'] = "#{digest}-#{File.basename(relative_path)}"
208
+ logical_path = 'application.css'
209
+ else
210
+ # For non-application files, still add to files but not to assets mapping
211
+ logical_path = relative_path
212
+ end
213
+
214
+ # Add file entry for all files
215
+ manifest['files']["#{digest}-#{File.basename(relative_path)}"] = {
216
+ 'logical_path' => logical_path,
217
+ 'pathname' => relative_path,
218
+ 'digest' => digest,
219
+ 'size' => File.size(file),
220
+ 'mtime' => File.mtime(file).iso8601
221
+ }
222
+ end
223
+
224
+ # Write manifest for Sprockets (Rails < 7)
225
+ manifest_path = "#{outdir}/.sprockets-manifest-#{Digest::MD5.hexdigest(outdir)}.json"
226
+ File.write(manifest_path, JSON.pretty_generate(manifest))
227
+ Railpack.logger.debug "📄 Generated Sprockets manifest: #{manifest_path}"
160
228
  end
161
229
  end
162
230
  end
@@ -1,3 +1,3 @@
1
1
  module Railpack
2
- VERSION = "1.2.7"
2
+ VERSION = "1.2.9"
3
3
  end
@@ -0,0 +1,173 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'minitest/autorun'
4
+ require 'railpack'
5
+
6
+ class BundlerTest < Minitest::Test
7
+ def test_bundler_base_class
8
+ bundler = Railpack::Bundler.new({})
9
+
10
+ assert_respond_to bundler, :build!
11
+ assert_respond_to bundler, :watch
12
+ assert_respond_to bundler, :install!
13
+ assert_respond_to bundler, :name
14
+ assert_respond_to bundler, :commands
15
+ end
16
+
17
+ def test_bun_bundler_initialization
18
+ bundler = Railpack::BunBundler.new({})
19
+ assert_instance_of Railpack::BunBundler, bundler
20
+ assert_equal 'bun', bundler.name
21
+ end
22
+
23
+ def test_bun_bundler_commands
24
+ bundler = Railpack::BunBundler.new({})
25
+ commands = bundler.send(:commands)
26
+
27
+ assert_equal 'bun run build', commands[:build]
28
+ assert_equal 'bun run watch', commands[:watch]
29
+ assert_equal 'bun install', commands[:install]
30
+ end
31
+
32
+ def test_esbuild_bundler_initialization
33
+ bundler = Railpack::EsbuildBundler.new({})
34
+ assert_instance_of Railpack::EsbuildBundler, bundler
35
+ assert_equal 'esbuild', bundler.name
36
+ end
37
+
38
+ def test_esbuild_bundler_commands
39
+ bundler = Railpack::EsbuildBundler.new({})
40
+ commands = bundler.send(:commands)
41
+
42
+ assert_equal 'esbuild', commands[:build]
43
+ assert_equal 'esbuild --watch', commands[:watch]
44
+ assert_equal 'npm install', commands[:install]
45
+ end
46
+
47
+ def test_rollup_bundler_initialization
48
+ bundler = Railpack::RollupBundler.new({})
49
+ assert_instance_of Railpack::RollupBundler, bundler
50
+ assert_equal 'rollup', bundler.name
51
+ end
52
+
53
+ def test_rollup_bundler_commands
54
+ bundler = Railpack::RollupBundler.new({})
55
+ commands = bundler.send(:commands)
56
+
57
+ assert_equal 'rollup', commands[:build]
58
+ assert_equal 'rollup --watch', commands[:watch]
59
+ assert_equal 'npm install', commands[:install]
60
+ end
61
+
62
+ def test_webpack_bundler_initialization
63
+ bundler = Railpack::WebpackBundler.new({})
64
+ assert_instance_of Railpack::WebpackBundler, bundler
65
+ assert_equal 'webpack', bundler.name
66
+ end
67
+
68
+ def test_webpack_bundler_commands
69
+ bundler = Railpack::WebpackBundler.new({})
70
+ commands = bundler.send(:commands)
71
+
72
+ assert_equal 'webpack', commands[:build]
73
+ assert_equal 'webpack --watch', commands[:watch]
74
+ assert_equal 'npm install', commands[:install]
75
+ end
76
+
77
+ def test_bundler_name_uniqueness
78
+ bundlers = [
79
+ Railpack::BunBundler.new({}),
80
+ Railpack::EsbuildBundler.new({}),
81
+ Railpack::RollupBundler.new({}),
82
+ Railpack::WebpackBundler.new({})
83
+ ]
84
+
85
+ names = bundlers.map(&:name)
86
+ assert_equal names.uniq.size, names.size, "All bundler names should be unique"
87
+ end
88
+
89
+ def test_bundler_commands_structure
90
+ bundlers = [
91
+ Railpack::BunBundler.new({}),
92
+ Railpack::EsbuildBundler.new({}),
93
+ Railpack::RollupBundler.new({}),
94
+ Railpack::WebpackBundler.new({})
95
+ ]
96
+
97
+ bundlers.each do |bundler|
98
+ commands = bundler.send(:commands)
99
+ assert_respond_to commands, :[]
100
+ assert commands.key?(:build)
101
+ assert commands.key?(:watch)
102
+ assert commands.key?(:install)
103
+
104
+ # All commands should be strings
105
+ assert commands[:build].is_a?(String)
106
+ assert commands[:watch].is_a?(String)
107
+ assert commands[:install].is_a?(String)
108
+ end
109
+ end
110
+
111
+ def test_bundler_inheritance
112
+ bundlers = [
113
+ Railpack::BunBundler,
114
+ Railpack::EsbuildBundler,
115
+ Railpack::RollupBundler,
116
+ Railpack::WebpackBundler
117
+ ]
118
+
119
+ bundlers.each do |bundler_class|
120
+ assert bundler_class < Railpack::Bundler, "#{bundler_class} should inherit from Railpack::Bundler"
121
+ end
122
+ end
123
+
124
+ def test_bundler_config_passing
125
+ config = { 'target' => 'node', 'format' => 'cjs' }
126
+
127
+ bundler = Railpack::BunBundler.new(config)
128
+ assert_equal config, bundler.instance_variable_get(:@config)
129
+ end
130
+
131
+ def test_bundler_error_handling
132
+ bundler = Railpack::BunBundler.new({})
133
+
134
+ # Mock system to return false (command failure)
135
+ bundler.define_singleton_method(:execute!) do |*args|
136
+ raise Railpack::Error, "Command failed"
137
+ end
138
+
139
+ # This should raise an error
140
+ assert_raises(Railpack::Error) do
141
+ bundler.build!([])
142
+ end
143
+ end
144
+
145
+ def test_bundler_watch_method
146
+ bundler = Railpack::BunBundler.new({})
147
+
148
+ # Mock system to avoid actual execution
149
+ bundler.define_singleton_method(:system) do |*args|
150
+ true
151
+ end
152
+
153
+ # Watch should not raise an error
154
+ begin
155
+ bundler.watch([])
156
+ assert true # If we get here, no exception was raised
157
+ rescue
158
+ flunk "watch method should not raise an error"
159
+ end
160
+ end
161
+
162
+ def test_bundler_install_method
163
+ bundler = Railpack::BunBundler.new({})
164
+
165
+ # Mock system to return true (command success)
166
+ bundler.define_singleton_method(:system) do |*args|
167
+ true
168
+ end
169
+
170
+ result = bundler.install!
171
+ assert result
172
+ end
173
+ end
@@ -0,0 +1,254 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'minitest/autorun'
4
+ require 'tempfile'
5
+ require 'fileutils'
6
+ require 'pathname'
7
+ require 'railpack'
8
+
9
+ class ManagerTest < Minitest::Test
10
+ def setup
11
+ @temp_dir = Dir.mktmpdir
12
+ @original_rails_root = nil
13
+ if defined?(Rails) && Rails.respond_to?(:root)
14
+ @original_rails_root = Rails.singleton_class.instance_method(:root)
15
+ end
16
+ end
17
+
18
+ def teardown
19
+ FileUtils.remove_entry(@temp_dir) if @temp_dir && Dir.exist?(@temp_dir)
20
+ # Restore original Rails.root method if it was overridden
21
+ if @original_rails_root && defined?(Rails)
22
+ Rails.singleton_class.define_method(:root, @original_rails_root)
23
+ end
24
+ end
25
+
26
+ def test_manager_initialization
27
+ manager = Railpack::Manager.new
28
+ assert_instance_of Railpack::Manager, manager
29
+ assert_respond_to manager, :build!
30
+ assert_respond_to manager, :watch
31
+ assert_respond_to manager, :install!
32
+ end
33
+
34
+ def test_manager_bundler_creation
35
+ manager = Railpack::Manager.new
36
+ bundler = manager.send(:create_bundler)
37
+ assert_instance_of Railpack::BunBundler, bundler
38
+ end
39
+
40
+ def test_manager_bundle_size_calculation
41
+ # Create test output directory with fake assets
42
+ outdir = File.join(@temp_dir, 'builds')
43
+ FileUtils.mkdir_p(outdir)
44
+
45
+ # Create fake JS and CSS files
46
+ File.write(File.join(outdir, 'app.js'), 'console.log("test");')
47
+ File.write(File.join(outdir, 'app.css'), 'body { color: red; }')
48
+ File.write(File.join(outdir, 'app.js.map'), '{"version":3}')
49
+
50
+ config = { 'outdir' => outdir }
51
+ manager = Railpack::Manager.new
52
+
53
+ size = manager.send(:calculate_bundle_size, config)
54
+ assert size.is_a?(Float)
55
+ assert size > 0
56
+ end
57
+
58
+ def test_manager_bundle_size_calculation_empty_directory
59
+ # Test with empty directory
60
+ outdir = File.join(@temp_dir, 'empty_builds')
61
+ FileUtils.mkdir_p(outdir)
62
+
63
+ config = { 'outdir' => outdir }
64
+ manager = Railpack::Manager.new
65
+
66
+ size = manager.send(:calculate_bundle_size, config)
67
+ assert_equal 0.0, size
68
+ end
69
+
70
+ def test_manager_bundle_size_calculation_nonexistent_directory
71
+ manager = Railpack::Manager.new
72
+ config = { 'outdir' => '/nonexistent/directory' }
73
+
74
+ size = manager.send(:calculate_bundle_size, config)
75
+ assert_equal 'unknown', size
76
+ end
77
+
78
+ def test_manager_asset_manifest_generation
79
+ outdir = File.join(@temp_dir, 'builds')
80
+ FileUtils.mkdir_p(outdir)
81
+
82
+ # Create fake built assets
83
+ File.write(File.join(outdir, 'application.js'), 'console.log("app");')
84
+ File.write(File.join(outdir, 'application.css'), 'body { color: blue; }')
85
+
86
+ config = { 'outdir' => outdir }
87
+ manager = Railpack::Manager.new
88
+
89
+ manager.send(:generate_asset_manifest, config)
90
+
91
+ manifest_path = File.join(outdir, '.manifest.json')
92
+ assert File.exist?(manifest_path)
93
+
94
+ manifest = JSON.parse(File.read(manifest_path))
95
+ assert manifest.key?('application.js')
96
+ assert manifest.key?('application.css')
97
+ assert manifest['application.js']['logical_path'] == 'application.js'
98
+ assert manifest['application.js']['pathname'].end_with?('application.js')
99
+ assert manifest['application.js']['digest']
100
+ end
101
+
102
+ def test_manager_asset_manifest_generation_no_assets
103
+ outdir = File.join(@temp_dir, 'empty_builds')
104
+ FileUtils.mkdir_p(outdir)
105
+
106
+ config = { 'outdir' => outdir }
107
+ manager = Railpack::Manager.new
108
+
109
+ # Ensure Propshaft detection for this test
110
+ def manager.detect_asset_pipeline
111
+ :propshaft
112
+ end
113
+
114
+ manager.send(:generate_asset_manifest, config)
115
+
116
+ manifest_path = File.join(outdir, '.manifest.json')
117
+ assert File.exist?(manifest_path)
118
+
119
+ manifest = JSON.parse(File.read(manifest_path))
120
+ assert_empty manifest
121
+ end
122
+
123
+ def test_manager_build_with_config
124
+ manager = Railpack::Manager.new
125
+
126
+ # Mock the bundler to avoid actual command execution
127
+ mock_bundler = Minitest::Mock.new
128
+ mock_bundler.expect(:build!, true, [[]])
129
+ manager.instance_variable_set(:@bundler, mock_bundler)
130
+
131
+ # Mock Rails.env to avoid dependency
132
+ rails_module = if defined?(Rails)
133
+ Rails
134
+ else
135
+ Object.const_set(:Rails, Module.new)
136
+ end
137
+ rails_module.define_singleton_method(:env) { 'development' }
138
+
139
+ result = manager.build!
140
+ assert result
141
+
142
+ mock_bundler.verify
143
+ end
144
+
145
+ def test_manager_install_with_config
146
+ manager = Railpack::Manager.new
147
+
148
+ # Mock the bundler to avoid actual command execution
149
+ mock_bundler = Minitest::Mock.new
150
+ mock_bundler.expect(:install!, true, [[]])
151
+ manager.instance_variable_set(:@bundler, mock_bundler)
152
+
153
+ result = manager.install!
154
+ assert result
155
+
156
+ mock_bundler.verify
157
+ end
158
+
159
+ def test_manager_watch_with_config
160
+ manager = Railpack::Manager.new
161
+
162
+ # Mock the bundler to avoid actual command execution
163
+ mock_bundler = Minitest::Mock.new
164
+ mock_bundler.expect(:watch, nil, [[]])
165
+ manager.instance_variable_set(:@bundler, mock_bundler)
166
+
167
+ manager.watch
168
+
169
+ mock_bundler.verify
170
+ end
171
+
172
+ def test_manager_bundler_constants
173
+ assert_equal Railpack::BunBundler, Railpack::Manager::BUNDLERS['bun']
174
+ assert_equal Railpack::EsbuildBundler, Railpack::Manager::BUNDLERS['esbuild']
175
+ assert_equal Railpack::RollupBundler, Railpack::Manager::BUNDLERS['rollup']
176
+ assert_equal Railpack::WebpackBundler, Railpack::Manager::BUNDLERS['webpack']
177
+ end
178
+
179
+ def test_detect_asset_pipeline_propshaft
180
+ manager = Railpack::Manager.new
181
+
182
+ # Mock Rails version for Propshaft detection
183
+ rails_module = if defined?(Rails)
184
+ Rails
185
+ else
186
+ Object.const_set(:Rails, Module.new)
187
+ end
188
+ rails_module.define_singleton_method(:version) { '7.0.0' }
189
+
190
+ pipeline = manager.send(:detect_asset_pipeline)
191
+ assert_equal :propshaft, pipeline
192
+ end
193
+
194
+ def test_detect_asset_pipeline_sprockets
195
+ manager = Railpack::Manager.new
196
+
197
+ # Mock Sprockets being available
198
+ Object.const_set(:Sprockets, Module.new) unless defined?(Sprockets)
199
+
200
+ # Mock Rails version for Sprockets detection
201
+ rails_module = if defined?(Rails)
202
+ Rails
203
+ else
204
+ Object.const_set(:Rails, Module.new)
205
+ end
206
+ rails_module.define_singleton_method(:version) { '6.1.0' }
207
+
208
+ pipeline = manager.send(:detect_asset_pipeline)
209
+ assert_equal :sprockets, pipeline
210
+ ensure
211
+ Object.send(:remove_const, :Sprockets) if defined?(Sprockets) && Sprockets.name.nil?
212
+ end
213
+
214
+ def test_generate_sprockets_manifest
215
+ outdir = File.join(@temp_dir, 'builds')
216
+ FileUtils.mkdir_p(outdir)
217
+
218
+ # Create fake built assets
219
+ File.write(File.join(outdir, 'application.js'), 'console.log("app");')
220
+ File.write(File.join(outdir, 'application.css'), 'body { color: blue; }')
221
+
222
+ config = { 'outdir' => outdir }
223
+ manager = Railpack::Manager.new
224
+
225
+ manager.send(:generate_sprockets_manifest, config)
226
+
227
+ manifest_path = Dir.glob("#{outdir}/.sprockets-manifest-*.json").first
228
+ assert manifest_path
229
+ assert File.exist?(manifest_path)
230
+
231
+ manifest = JSON.parse(File.read(manifest_path))
232
+ assert manifest.key?('files')
233
+ assert manifest.key?('assets')
234
+ assert manifest['assets'].key?('application.js')
235
+ assert manifest['assets'].key?('application.css')
236
+
237
+ # Check file entries
238
+ js_digest = manifest['assets']['application.js']
239
+ assert manifest['files'].key?(js_digest)
240
+ assert_equal 'application.js', manifest['files'][js_digest]['logical_path']
241
+ end
242
+
243
+ private
244
+
245
+ def mock_rails_root(path)
246
+ rails_module = if defined?(Rails)
247
+ Rails
248
+ else
249
+ Object.const_set(:Rails, Module.new)
250
+ end
251
+
252
+ rails_module.define_singleton_method(:root) { Pathname.new(path) }
253
+ end
254
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.7
4
+ version: 1.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - 21tycoons LLC
@@ -48,7 +48,9 @@ files:
48
48
  - lib/railpack/version.rb
49
49
  - lib/tasks/railpack.rake
50
50
  - sig/railpack.rbs
51
+ - test/bundler_test.rb
51
52
  - test/config_test.rb
53
+ - test/manager_test.rb
52
54
  - test/railpack_test.rb
53
55
  homepage: https://github.com/21tycoons/railpack
54
56
  licenses: