Commit 847edcd
Improve validation skip documentation and test coverage (#1924)
* Improve validation skip documentation and test coverage
Addresses feedback from PR #1923:
1. Enhanced documentation:
- Added comprehensive method-level docs explaining ENV variable approach
- Documented why ENV is preferred over ARGV (Rails modifies ARGV during init)
- Added thread safety notes explaining process-global ENV scope
- Cross-referenced engine.rb and install_generator.rb for clarity
2. Improved test coverage:
- Added tests verifying ENV variable takes precedence over other checks
- Tests confirm ENV check short-circuits before package.json/ARGV checks
- Added 4 new test cases covering precedence scenarios
3. Thread safety documentation:
- Documented that generators run in single process (not a concern)
- Added note about parallel test scenarios (separate processes)
- Clarified ENV cleanup in ensure block
Changes:
- lib/react_on_rails/engine.rb: Enhanced skip_validation? docs
- lib/generators/react_on_rails/install_generator.rb: Added run_generators docs
- spec/react_on_rails/engine_spec.rb: Added 4 precedence tests
All specs pass (21 examples, 0 failures)
RuboCop clean
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Refine documentation and test structure per code review
Addresses additional code review suggestions:
1. Edge Case Documentation:
- Added @note about manual ENV variable setting
- Documented use case for debugging/setup scenarios
- Warned against bypassing validation in production
2. Improved Test Structure:
- Refactored precedence tests to use nested contexts
- Changed structure: "with other skip conditions also present"
-> "when package.json exists and ARGV indicates generator"
-> "when package.json is missing"
- More descriptive test names focusing on behavior
- Better organization showing ENV precedence clearly
3. Simplified Comments:
- Reduced redundancy in install_generator.rb ensure block
- Changed from 2 lines to 1 concise line
- Removed redundant statement about concurrent generators
Changes maintain all functionality while improving readability
and addressing edge cases in documentation.
All specs pass (21 examples, 0 failures)
RuboCop clean
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>1 parent ae5425b commit 847edcd
File tree
3 files changed
+74
-0
lines changed- lib
- generators/react_on_rails
- react_on_rails
- spec/react_on_rails
3 files changed
+74
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
39 | 52 | | |
40 | 53 | | |
41 | 54 | | |
| 55 | + | |
42 | 56 | | |
43 | 57 | | |
44 | 58 | | |
| |||
59 | 73 | | |
60 | 74 | | |
61 | 75 | | |
| 76 | + | |
62 | 77 | | |
63 | 78 | | |
64 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
21 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
22 | 38 | | |
23 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
24 | 43 | | |
25 | 44 | | |
26 | 45 | | |
| |||
33 | 52 | | |
34 | 53 | | |
35 | 54 | | |
| 55 | + | |
36 | 56 | | |
37 | 57 | | |
38 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
34 | 73 | | |
35 | 74 | | |
36 | 75 | | |
| |||
0 commit comments