puppetlabs / rspec-puppet

RSpec tests for your Puppet manifests
https://puppetlabs.github.io/rspec-puppet/
MIT License
11 stars 18 forks source link

raise ruby version requirement to 2.7.4 #87

Closed UiP9AV6Y closed 7 months ago

UiP9AV6Y commented 8 months ago

the gemspec lists the minimum requirement for the gem release 4.0.0 as 2.7.0

the dynamic matcher implementation makes use of a feature introduced with 2.7.0 (according to the changelog)

however: loading the gem with ruby 2.7.0 leads to a syntax error:

$ ruby --version ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux] $ gem install --silent --version "~>7" puppet $ gem install --silent --version "~>4" rspec-puppet $ ruby -e "require 'rspec-puppet'" ... /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in require': /usr/local/bundle/gems/rspec-puppet-4.0.0/lib/rspec-puppet/matchers/dynamic_matchers.rb:29: syntax error, unexpected (... (SyntaxError) ... def method_missing(method, ...) ... ^~~ /usr/local/bundle/gems/rspec-puppet-4.0.0/lib/rspec-puppet/matchers/dynamic_matchers.rb:30: syntax error, unexpected ')' ...:CreateGeneric.new(method, ...) if method == :be_valid_type ... ^ /usr/local/bundle/gems/rspec-puppet-4.0.0/lib/rspec-puppet/matchers/dynamic_matchers.rb:35: syntax error, unexpectedend', expecting end-of-input

whereas loading the gem with ruby 2.7.4 succeeds:

$ ruby --version ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux] $ gem install --silent --version "~>7" puppet $ gem install --silent --version "~>4" rspec-puppet $ ruby -e "require 'rspec-puppet'" $ echo $? 0

i came across this issues, as ruby 2.7.0 is the version shipped with Ubuntu 20.04 (EOL in 2025)

ekohl commented 8 months ago

Looks like this was introduced in a16dc28e02c6fcdb786b719dd12ec5e947bffc14. I've opened https://github.com/puppetlabs/rspec-puppet/pull/88 to see if it can be reproduced by testing on 2.7.0 instead of 2.7.latest.

jordanbreen28 commented 7 months ago

Fixed and released as part of v4.0.2. gems will be published shortly Thanks both