Skip to content

rspec-mocks: Pin to < 3.13.3 #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ group(:test) do
gem "rspec", "~> 3.1", require: false
gem "rspec-expectations", ["~> 3.9", "!= 3.9.3"]
gem "rspec-its", "~> 1.1", require: false
gem 'rspec-mocks', '< 3.13.3', require: false # breaking change afterwards: https://github.com/rspec/rspec-mocks/pull/1596
gem 'vcr', '~> 5.0', require: false
gem 'webmock', '~> 3.0', require: false
gem 'webrick', '~> 1.7', require: false if RUBY_VERSION.to_f >= 3.0
Expand Down
10 changes: 9 additions & 1 deletion lib/puppet/face/facts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,15 @@

case result
when Array, Hash
Puppet::Util::Json.dump(result, :pretty => true)
# JSON < 2.8.0 would pretty print empty arrays and hashes with newlines
# Maintain that behavior for our users for now
if result.is_a?(Array) && result.empty?
"[\n\n]"
elsif result.is_a?(Hash) && result.empty?
"{\n}"
else
Puppet::Util::Json.dump(result, :pretty => true)
end
else # one of VALID_TYPES above
result
end
Expand Down
1 change: 1 addition & 0 deletions puppet.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency(%q<concurrent-ruby>, "~> 1.0")
spec.add_runtime_dependency(%q<deep_merge>, "~> 1.0")
spec.add_runtime_dependency(%q<scanf>, "~> 1.0")
spec.add_runtime_dependency(%q<json>, "< 2.9") # last known good version is 2.8.2

# For building platform specific puppet gems...the --platform flag is only supported in newer Ruby versions
platform = spec.platform.to_s
Expand Down
1 change: 1 addition & 0 deletions spec/unit/application/facts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@

{
"type_hash" => [{'a' => 2}, "{\n \"a\": 2\n}"],
"type_empty_hash" => [{}, "{\n}"],
"type_array" => [[], "[\n\n]"],
"type_string" => ["str", "str"],
"type_int" => [1, "1"],
Expand Down
8 changes: 7 additions & 1 deletion spec/unit/provider/package/puppetserver_gem_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@

it "raises if given an invalid URI" do
resource[:source] = 'h;ttp://rubygems.com'
expect { provider.install }.to raise_error(Puppet::Error, /Invalid source '': bad URI\(is not URI\?\)/)
# Older versions of URI don't have a space before the opening
# parenthesis in the error message, newer versions do
if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('3.0.0')
expect { provider.install }.to raise_error(Puppet::Error, /Invalid source '': bad URI\(is not URI\?\)/)
else
expect { provider.install }.to raise_error(Puppet::Error, /Invalid source '': bad URI \(is not URI\?\)/)
end
end
end
end
Expand Down
Loading