Skip to content

Commit 3006e4a

Browse files
herwinweregon
authored andcommitted
Convert globals of YAML specs into scoped constants
1 parent fe7123e commit 3006e4a

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

library/yaml/fixtures/strings.rb

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
$complex_key_1 = <<EOY
2-
? # PLAY SCHEDULE
3-
- Detroit Tigers
4-
- Chicago Cubs
5-
:
6-
- 2001-07-23
1+
module YAMLSpecs
2+
COMPLEX_KEY_1 = <<~EOY
3+
? # PLAY SCHEDULE
4+
- Detroit Tigers
5+
- Chicago Cubs
6+
:
7+
- 2001-07-23
78
8-
? [ New York Yankees,
9-
Atlanta Braves ]
10-
: [ 2001-07-02, 2001-08-12,
11-
2001-08-14 ]
12-
EOY
9+
? [ New York Yankees,
10+
Atlanta Braves ]
11+
: [ 2001-07-02, 2001-08-12,
12+
2001-08-14 ]
13+
EOY
1314

14-
$multidocument = <<EOY
15-
---
16-
- Mark McGwire
17-
- Sammy Sosa
18-
- Ken Griffey
15+
MULTIDOCUMENT = <<~EOY
16+
---
17+
- Mark McGwire
18+
- Sammy Sosa
19+
- Ken Griffey
1920
20-
# Team ranking
21-
---
22-
- Chicago Cubs
23-
- St Louis Cardinals
24-
EOY
21+
# Team ranking
22+
---
23+
- Chicago Cubs
24+
- St Louis Cardinals
25+
EOY
26+
end

library/yaml/shared/each_document.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
describe :yaml_each_document, shared: true do
22
it "calls the block on each successive document" do
33
documents = []
4-
YAML.send(@method, $multidocument) do |doc|
4+
YAML.send(@method, YAMLSpecs::MULTIDOCUMENT) do |doc|
55
documents << doc
66
end
77
documents.should == [["Mark McGwire", "Sammy Sosa", "Ken Griffey"],

library/yaml/shared/load.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
Date.new( 2001, 8, 12 ),
107107
Date.new( 2001, 8, 14 ) ]
108108
}
109-
YAML.send(@method, $complex_key_1).should == expected
109+
YAML.send(@method, YAMLSpecs::COMPLEX_KEY_1).should == expected
110110
end
111111

112112
describe "with iso8601 timestamp" do

0 commit comments

Comments
 (0)