Skip to content

Commit bab6c26

Browse files
authored
Merge pull request #207 from puppet-bootstrap/issue_206
Fix compatibility with Ruby 2.7
2 parents 99cfa9b + 10af9b9 commit bab6c26

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/rspec-puppet-facts.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ def self.facter_version_for_puppet_version(puppet_version)
397397
return Facter.version
398398
end
399399

400-
version_map = JSON.load_file(json_path).map do |puppet, facter|
400+
version_map = JSON.parse(File.read(json_path)).map do |puppet, facter|
401401
[Gem::Version.new(puppet), facter]
402402
end
403403

spec/rspec_puppet_facts_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060

6161
context 'when the component JSON file is unparseable' do
6262
before do
63-
allow(JSON).to receive(:load_file).with(component_json_path).and_raise(JSON::ParserError)
63+
allow(File).to receive(:read).with(component_json_path).and_return('not json')
6464
allow(described_class).to receive(:warning)
6565
end
6666

0 commit comments

Comments
 (0)