Skip to content

Commit 349e5ca

Browse files
johnnyshieldscomandeo-mongo
authored andcommitted
Use ::Utils.load_spec_yaml_file to fix unified spec test loading
Cherry-picked from 62e9725: RUBY-2859 Add GH Actions setup for ruby 3.1 (#2398) Co-authored-by: shields <shields@tablecheck.com> Co-authored-by: Dmitry Rybakov <dmitry.rybakov@mongodb.com>
1 parent 3e05bf8 commit 349e5ca

File tree

14 files changed

+44
-15
lines changed

14 files changed

+44
-15
lines changed

spec/runners/auth.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Spec
4848
attr_reader :tests
4949

5050
def initialize(test_path)
51-
@spec = YAML.load(File.read(test_path))
51+
@spec = ::Utils.load_spec_yaml_file(test_path)
5252
@description = File.basename(test_path)
5353
end
5454

spec/runners/change_streams/spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Spec
3232
#
3333
# @since 2.6.0
3434
def initialize(test_path)
35-
@spec = YAML.load(File.read(test_path))
35+
@spec = ::Utils.load_spec_yaml_file(test_path)
3636
@description = File.basename(test_path)
3737
@spec_tests = @spec['tests']
3838
@collection_name = @spec['collection_name']

spec/runners/cmap.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Spec
4040
#
4141
# @param [ String ] test_path The path to the file.
4242
def initialize(test_path)
43-
@test = YAML.load(File.read(test_path))
43+
@test = ::Utils.load_spec_yaml_file(test_path)
4444

4545
@description = @test['description']
4646
@pool_options = ::Utils.snakeize_hash(process_options(@test['poolOptions']))

spec/runners/command_monitoring.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class Spec
204204
#
205205
# @since 2.1.0
206206
def initialize(test_path)
207-
@spec = YAML.load(File.read(test_path))
207+
@spec = ::Utils.load_spec_yaml_file(test_path)
208208
@data = @spec['data']
209209
@tests = @spec['tests']
210210
end

spec/runners/connection_string.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class Spec
100100
#
101101
# @since 2.0.0
102102
def initialize(test_path)
103-
@spec = YAML.load(File.read(test_path))
103+
@spec = ::Utils.load_spec_yaml_file(test_path)
104104
@description = File.basename(test_path)
105105
end
106106

spec/runners/crud/spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ class Spec
1212
#
1313
# @since 2.0.0
1414
def initialize(test_path)
15-
contents = File.read(test_path)
16-
17-
@spec = YAML.load(contents)
15+
@spec = ::Utils.load_spec_yaml_file(test_path)
1816
@description = File.basename(test_path)
1917
@data = BSON::ExtJSON.parse_obj(@spec['data'])
2018
@tests = @spec['tests']

spec/runners/gridfs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class Spec
100100
#
101101
# @since 2.1.0
102102
def initialize(test_path)
103-
@spec = YAML.load(File.read(test_path))
103+
@spec = ::Utils.load_spec_yaml_file(test_path)
104104
@description = File.basename(test_path)
105105
@data = @spec['data']
106106
end

spec/runners/read_write_concern_document.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Spec
1313
#
1414
# @since 2.0.0
1515
def initialize(test_path)
16-
@spec = YAML.load(File.read(test_path))
16+
@spec = ::Utils.load_spec_yaml_file(test_path)
1717
@description = File.basename(test_path)
1818
end
1919

spec/runners/sdam.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class Spec
7777
#
7878
# @since 2.0.0
7979
def initialize(test_path)
80-
@test = YAML.load(File.read(test_path))
80+
@test = ::Utils.load_spec_yaml_file(test_path)
8181
@description = @test['description']
8282
@uri_string = @test['uri']
8383
@uri = URI.new(uri_string)

spec/runners/server_selection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class Spec
6464
#
6565
# @since 2.0.0
6666
def initialize(test_path)
67-
@test = YAML.load(File.read(test_path))
67+
@test = ::Utils.load_spec_yaml_file(test_path)
6868
@description = "#{@test['topology_description']['type']}: #{File.basename(test_path)}"
6969
@heartbeat_frequency = @test['heartbeatFrequencyMS'] / 1000 if @test['heartbeatFrequencyMS']
7070
@read_preference = @test['read_preference']

0 commit comments

Comments
 (0)