Skip to content

Commit

Permalink
Convert globals of YAML specs into scoped constants
Browse files Browse the repository at this point in the history
  • Loading branch information
herwinw authored and eregon committed Dec 4, 2023
1 parent fe7123e commit 3006e4a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
44 changes: 23 additions & 21 deletions library/yaml/fixtures/strings.rb
Original file line number Diff line number Diff line change
@@ -1,24 +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

$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

0 comments on commit 3006e4a

Please sign in to comment.