Skip to content
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

Pin rspec-expectations due to private API change #6

Merged
merged 4 commits into from
Feb 7, 2024

Conversation

joshuariojas
Copy link

Description

In this change, we are introducing a temporary version pin of the rspec-expectations gem to version v3.12.3.

As part of the v3.12.4/v3.13.0 releases, the private API class RSpec::Matchers::ExpectedsForMultipleDiffs was renamed to RSpec::Matchers::MultiMatcherDiff 1. chefspec does make use of this class in one instance.

A future change should be introduced to properly address this class dependency. Possible options include replicating a minimal replacement, or porting the class to equivalent custom matcher with the chefspec codebase.

Related Issue

Here is an example of a spec failing within a CD/CI pipeline that automatically pulls in the latest version of the chefspec gem. Note, that chefspec did not have a new release, but the permissive version matching against rspec now introduces this runtime error.

An error occurred while loading ./spec/_configure_yum_vars_cron_spec.rb.
Failure/Error: require 'chefspec'

LoadError:

  cannot load such file -- rspec/matchers/expecteds_for_multiple_diffs
# /usr/local/rvm/gems/ruby-2.7.6/gems/chefspec-9.3.6/lib/chefspec/matchers/resource_matcher.rb:1:in `require'
# /usr/local/rvm/gems/ruby-2.7.6/gems/chefspec-9.3.6/lib/chefspec/matchers/resource_matcher.rb:1:in `<top (required)>'
# /usr/local/rvm/gems/ruby-2.7.6/gems/chefspec-9.3.6/lib/chefspec/matchers.rb:9:in `require_relative'
# /usr/local/rvm/gems/ruby-2.7.6/gems/chefspec-9.3.6/lib/chefspec/matchers.rb:9:in `<module:Matchers>'
# /usr/local/rvm/gems/ruby-2.7.6/gems/chefspec-9.3.6/lib/chefspec/matchers.rb:2:in `<module:ChefSpec>'
# /usr/local/rvm/gems/ruby-2.7.6/gems/chefspec-9.3.6/lib/chefspec/matchers.rb:1:in `<top (required)>'
# /usr/local/rvm/gems/ruby-2.7.6/gems/chefspec-9.3.6/lib/chefspec.rb:66:in `require_relative'
# /usr/local/rvm/gems/ruby-2.7.6/gems/chefspec-9.3.6/lib/chefspec.rb:66:in `<top (required)>'
# ./spec/_configure_yum_vars_cron_spec.rb:1:in `require'
# ./spec/_configure_yum_vars_cron_spec.rb:1:in `<top (required)>'

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • If Gemfile.lock has changed, I have used --conservative to do it and included the full output in the Description above.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

In this change, we are introducing a temporary version pin
of the rspec-expectations gem to version v3.12.3

As part of the v3.12.4/v3.13.0 releases, the private API class
RSpec::Matchers::ExpectedsForMultipleDiffs was renamed to
RSpec::Matchers::MultiMatcherDiff [1]. chefspec does make use of this
class in one instance.

A future change should be introduced to properly address this
class dependency. Possible options include replicating a minimal
replacement, or porting the class to equivalent custom matcher
with the chefspec codebase.

[1]: rspec/rspec-expectations@d0bb212

Signed-off-by: Joshua Riojas <joshuariojas.psu@gmail.com>
chefspec.gemspec Outdated
@@ -27,4 +27,5 @@ Gem::Specification.new do |s|
s.add_dependency "chef-cli"
s.add_dependency "fauxhai-chef", ">= 9.3"
s.add_dependency "rspec", "~> 3.0"
s.add_dependency "rspec-expectations", "3.12.3"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
s.add_dependency "rspec-expectations", "3.12.3"
# temporary restriction to a version of rspec-expectations that includes the `RSpec::Matchers::ExpectedsForMultipleDiffs` class (renamed in 3.12.4)
s.add_dependency "rspec-expectations", "<= 3.12.3"

JR054505 added 3 commits February 7, 2024 10:56
Signed-off-by: Joshua Riojas <joshuariojas.psu@gmail.com>
- Merge branch 'main' of github.com:joshuariojas/chefspec
- Add new commit so DOC Signoff check passes

Signed-off-by: Joshua Riojas <joshuariojas.psu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants