Skip to content

Commit

Permalink
Refresh YAML specs
Browse files Browse the repository at this point in the history
This replaces some globals with constants

Upstream fix: ruby/spec#1118
  • Loading branch information
herwinw committed Dec 4, 2023
1 parent b5b8a75 commit f7fd69d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 34 deletions.
56 changes: 23 additions & 33 deletions spec/library/yaml/fixtures/strings.rb
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
$complex_key_1 = <<EOY
? # PLAY SCHEDULE
- Detroit Tigers
- Chicago Cubs
:
- 2001-07-23
module YAMLSpecs
COMPLEX_KEY_1 = <<~EOY
? # PLAY SCHEDULE
- Detroit Tigers
- Chicago Cubs
:
- 2001-07-23
? [ New York Yankees,
Atlanta Braves ]
: [ 2001-07-02, 2001-08-12,
2001-08-14 ]
EOY
? [ New York Yankees,
Atlanta Braves ]
: [ 2001-07-02, 2001-08-12,
2001-08-14 ]
EOY

$to_yaml_hash =
<<EOY
-
avg: 0.278
hr: 65
name: Mark McGwire
-
avg: 0.288
hr: 63
name: Sammy Sosa
EOY
MULTIDOCUMENT = <<~EOY
---
- Mark McGwire
- Sammy Sosa
- Ken Griffey
$multidocument = <<EOY
---
- Mark McGwire
- Sammy Sosa
- Ken Griffey
# Team ranking
---
- Chicago Cubs
- St Louis Cardinals
EOY
# Team ranking
---
- Chicago Cubs
- St Louis Cardinals
EOY
end
2 changes: 1 addition & 1 deletion spec/library/yaml/shared/load.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
Date.new( 2001, 8, 14 ) ]
}
NATFIXME 'Implement YAML.unsafe_load', exception: SpecFailedException do
YAML.send(@method, $complex_key_1).should == expected
YAML.send(@method, YAMLSpecs::COMPLEX_KEY_1).should == expected
end
end

Expand Down

0 comments on commit f7fd69d

Please sign in to comment.