Currently we have tests of the form it { is_expected.to raise_error Puppet::Error }. These worked up until this morning when we started seeing the following errors:
Failure/Error: it { is_expected.to raise_error Puppet::Error }
ArgumentError:
wrong number of arguments (given 1, expected 2)
# /.../vendor/bundle/gems/rspec-puppet-2.7.10/lib/rspec-puppet/matchers/raise_error.rb:20:in `new'
# /.../vendor/bundle/gems/rspec-puppet-2.7.10/lib/rspec-puppet/matchers/raise_error.rb:20:in `raise_error'
The method in question is this:
# rspec-puppet/matchers/raise_error.rb
def raise_error(*args, &block)
RaiseError.new(*args, &block)
end
It appears that rspec just released version 3.10.0, which changes the initialize method on RaiseError to have 2 required parameters (link). This was been done so that the base rspec raise_error matcher can detect an explicit nil passed to the first parameter and raise a warning (link).
Our current workaround is just to explicitly pass both the exception type and message to raise_error, but I would expect to continue to be able to use the original tests.
I'm not sure what a straightforward fix is. You can change the raise_error matcher to pass in args explicitly instead of using a splat which will resolve the error, but rspec 3.10.0 will now start issuing warnings when it receives nil for the first parameter. You could explicitly pass in the new default value (RSpec::Matchers::BuiltIn::RaiseError::UndefinedValue), but that doesn't exist prior to 3.10.0.
Currently we have tests of the form
it { is_expected.to raise_error Puppet::Error }
. These worked up until this morning when we started seeing the following errors:The method in question is this:
It appears that rspec just released version 3.10.0, which changes the
initialize
method onRaiseError
to have 2 required parameters (link). This was been done so that the base rspecraise_error
matcher can detect an explicitnil
passed to the first parameter and raise a warning (link).Our current workaround is just to explicitly pass both the exception type and message to
raise_error
, but I would expect to continue to be able to use the original tests.I'm not sure what a straightforward fix is. You can change the
raise_error
matcher to pass in args explicitly instead of using a splat which will resolve the error, but rspec 3.10.0 will now start issuing warnings when it receivesnil
for the first parameter. You could explicitly pass in the new default value (RSpec::Matchers::BuiltIn::RaiseError::UndefinedValue
), but that doesn't exist prior to 3.10.0.