Closed faxm0dem closed 4 years ago
I'm migrating a unit test for a ruby type from an older rspec version. If I'm not mistaken, the following should be equivalent:
expect { described_type.new(name: 'test', force: 'nope') }.to raise_error(Puppet::Error)
expect {be_valid_type.with_set_attributes({:force => 'nope'})}.to raise_error(Puppet::Error)
However, while the former works as expected (test succeeds), the latter fails with:
Failure/Error: expect { be_valid_type.with_set_attributes({:force => 'nope'})}.to raise_error expected Exception but nothing was raised
Hi @faxm0dem,
That matcher does raise exceptions on invalid parameter values and is tested here (the fake type being tested can be viewed here). Can you provide a more complete example to reproduce the scenario you're seeing?
you can check travis for the above failure for more details:
https://travis-ci.org/ccin2p3/puppet-cpan/jobs/652374296?utm_medium=notification&utm_source=github_status
I guess I forgot the should statement (sorry, rspec is kind of black magic to me). Thanks for your quick answer which helped me solve the issue !
should
I'm migrating a unit test for a ruby type from an older rspec version. If I'm not mistaken, the following should be equivalent:
old style
new style
However, while the former works as expected (test succeeds), the latter fails with: