Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert globals in YAML specs to constants #1118

Merged
merged 2 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 23 additions & 33 deletions 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 library/yaml/shared/each_document.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe :yaml_each_document, shared: true do
it "calls the block on each successive document" do
documents = []
YAML.send(@method, $multidocument) do |doc|
YAML.send(@method, YAMLSpecs::MULTIDOCUMENT) do |doc|
documents << doc
end
documents.should == [["Mark McGwire", "Sammy Sosa", "Ken Griffey"],
Expand Down
2 changes: 1 addition & 1 deletion library/yaml/shared/load.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
Date.new( 2001, 8, 12 ),
Date.new( 2001, 8, 14 ) ]
}
YAML.send(@method, $complex_key_1).should == expected
YAML.send(@method, YAMLSpecs::COMPLEX_KEY_1).should == expected
end

describe "with iso8601 timestamp" do
Expand Down