Commit 5c90b83
Fix Psych::DisallowedClass error for Rails 6.0 with Ruby 2.7+
Add Psych patch to allow loading Date, Time, DateTime classes from
YAML fixtures in Rails 6.0 test environment.
Rails 6.0 + Ruby 2.7 combination uses Psych 3.1+, which introduced
stricter security for YAML.load. The default safe_load behavior
rejects Date/Time/DateTime classes, causing test fixtures to fail.
Solution: Patch Psych.load to use unsafe_load in test environment.
This is safe since we're only loading trusted test fixture files.
Fixes error:
Psych::DisallowedClass: Tried to load unspecified class: Date
Test result: Rails 6.0.6 now passes all 674 tests ✅
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 44f9266 commit 5c90b83
1 file changed
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
81 | 100 | | |
82 | 101 | | |
83 | 102 | | |
| |||
0 commit comments