Skip to content

Commit 6c38c6f

Browse files
Refactor: Update test mocks to use public_bundles_full_path
- Replace all instances of generated_assets_full_path with public_bundles_full_path in utils_spec.rb - Ensures consistency in method naming across test cases - Aligns with recent changes for clearer asset path handling This change enhances clarity and maintains alignment with the updated method naming conventions.
1 parent 4252368 commit 6c38c6f

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Changes since the last non-beta release.
2626
#### New Features
2727

2828
- **Server Bundle Security**: Added new configuration options for enhanced server bundle security and organization:
29+
2930
- `server_bundle_output_path`: Configurable directory (relative to the Rails root) for server bundle output (default: "ssr-generated"). If set to `nil`, the server bundle will be loaded from the same public directory as client bundles.
3031
- `enforce_private_server_bundles`: When enabled, ensures server bundles are only loaded from private directories outside the public folder (default: false for backward compatibility)
3132

@@ -34,10 +35,17 @@ Changes since the last non-beta release.
3435
- If `server_bundle_output_path` is not set, the server bundle falls back to the client bundle directory (typically the public output path).
3536
- If `enforce_private_server_bundles` is enabled:
3637
- The server bundle will only be loaded from the private directory specified by `server_bundle_output_path`.
37-
- If the bundle is not found there, it will *not* fall back to the public directory.
38+
- If the bundle is not found there, it will _not_ fall back to the public directory.
3839
- If `enforce_private_server_bundles` is not enabled and the bundle is not found in the private directory, it will fall back to the public directory.
3940
- This logic ensures that, when strict enforcement is enabled, server bundles are never loaded from public directories, improving security and clarity of bundle resolution.
4041

42+
#### API Improvements
43+
44+
- **Method Naming Clarification**: Added `public_bundles_full_path` method to clarify bundle path handling:
45+
- `public_bundles_full_path`: New method specifically for webpack bundles in public directories
46+
- `generated_assets_full_path`: Now deprecated (backwards-compatible alias)
47+
- This eliminates confusion between webpack bundles and general Rails public assets
48+
4149
#### Security Enhancements
4250

4351
- **Private Server Bundle Enforcement**: When `enforce_private_server_bundles` is enabled, server bundles bypass public directory fallbacks and are only loaded from designated private locations

spec/react_on_rails/utils_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ def mock_dev_server_running
650650
context "when in development environment" do
651651
before do
652652
allow(Rails.env).to receive(:development?).and_return(true)
653-
allow(described_class).to receive(:generated_assets_full_path)
653+
allow(described_class).to receive(:public_bundles_full_path)
654654
.and_return("/path/to/generated/assets")
655655
end
656656

@@ -670,7 +670,7 @@ def mock_dev_server_running
670670

671671
context "when not in development environment" do
672672
before do
673-
allow(described_class).to receive(:generated_assets_full_path)
673+
allow(described_class).to receive(:public_bundles_full_path)
674674
.and_return("/path/to/generated/assets")
675675
end
676676

@@ -690,7 +690,7 @@ def mock_dev_server_running
690690

691691
context "with different manifest file names" do
692692
before do
693-
allow(described_class).to receive(:generated_assets_full_path)
693+
allow(described_class).to receive(:public_bundles_full_path)
694694
.and_return("/path/to/generated/assets")
695695
end
696696

@@ -715,7 +715,7 @@ def mock_dev_server_running
715715
before do
716716
allow(ReactOnRails.configuration).to receive(:react_server_client_manifest_file)
717717
.and_return(nil)
718-
allow(described_class).to receive(:generated_assets_full_path)
718+
allow(described_class).to receive(:public_bundles_full_path)
719719
.and_return("/path/to/generated/assets")
720720
end
721721

0 commit comments

Comments
 (0)