Update spec for Ruby 3 compatibility
What does this MR do and why?
This test fails when run against Ruby 3.2.1 because the class spy is mistakenly receiving a message that the commit response should be receiving (this passes when run against Ruby 2.7.7):
Failures:
1) ReleaseTools::ChangelogCompiler#compile compiles the changelog on the given branch and the default branch
Failure/Error: commit = @client.commit(@project, ref: branch).id
the ReleaseTools::GitlabClient class does not implement the class method: id
# ./lib/release_tools/changelog_compiler.rb:27:in `compile'
# ./spec/lib/release_tools/changelog_compiler_spec.rb:28:in `block (3 levels) in <top (required)>'
# ./spec/spec_helper.rb:48:in `block (3 levels) in <top (required)>'
# ./spec/spec_helper.rb:47:in `block (2 levels) in <top (required)>'
Finished in 0.00972 seconds (files took 1.34 seconds to load)
7 examples, 1 failure
Failed examples:
rspec ./spec/lib/release_tools/changelog_compiler_spec.rb:12 # ReleaseTools::ChangelogCompiler#compile compiles the changelog on the given branch and the default branch
In this MR, we update from a class_spy
to a class_double
to fix this problem in preparation for upgrading to Ruby 3.
By making this change while we are still running on Ruby 2.7.7, this proves that these changes are also compatible with our current version.
Author Check-list
- [-] Has documentation been updated?
Related to gitlab-com/gl-infra/delivery#2864 (closed)
Edited by Steve Abrams