Skip to content

Commit

Permalink
[toptal#123] Update to Psych 4.0.x
Browse files Browse the repository at this point in the history
Psych.safe_load changed it's method signature and requires
keyword args for 'permitted_classes'

Update the calls to Psych.safe_load and add it as an explicit
gem dependency with a pessimistic lock on the version.
  • Loading branch information
MarkSiemers-msr committed Jan 9, 2022
1 parent 1a8448e commit f148155
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion crystalball.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'parser'
spec.add_development_dependency 'pry'
spec.add_development_dependency 'pry-byebug'
spec.add_development_dependency 'psych', '~> 4.0.0'
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency 'rubocop', ">= 0.56"
spec.add_development_dependency 'rubocop-rspec'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'sqlite3', "~> 1.3.13"
spec.add_development_dependency 'sqlite3', "~> 1.4.2"
spec.add_development_dependency 'yard'
end
2 changes: 1 addition & 1 deletion lib/crystalball/map_storage/yaml_storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def read_files(path)

paths.map do |file|
metadata, *example_groups = file.read.split("---\n").reject(&:empty?).map do |yaml|
YAML.safe_load(yaml, [Symbol])
YAML.safe_load(yaml, permitted_classes: [Symbol])
end
example_groups = example_groups.inject(&:merge!)

Expand Down
2 changes: 1 addition & 1 deletion lib/crystalball/rspec/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def config
@config ||= begin
config_src = if config_file
require 'yaml'
YAML.safe_load(config_file.read)
YAML.safe_load(config_file.read, permitted_classes: [Symbol])
else
{}
end
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
end

context 'with CRYSTALBALL_CONFIG env variable set' do
let(:expected_config) { YAML.safe_load(Pathname('spec/fixtures/crystalball.yml').read) }
let(:expected_config) { YAML.safe_load(Pathname('spec/fixtures/crystalball.yml').read, permitted_classes: [Symbol]) }

around do |example|
ENV['CRYSTALBALL_CONFIG'] = 'spec/fixtures/crystalball.yml'
Expand Down

0 comments on commit f148155

Please sign in to comment.