My test looks like this:
it 'does return an error when passing a non-subscription or trial membership' do
expect(helper.description_for_subscription(recurring_plan)).to raise_error(RuntimeError)
end
My method returns this:
fail 'Unknown subscription model type!'
Yet Rspec comes back with this failure message:
Failure/Error: expect(helper.description_for_subscription(recurring_plan)).to raise_error(RuntimeError)
RuntimeError:
Unknown subscription model type!
What is going on??
You should wrap the expectation in a block, using {}
instead of ()
:
expect{
helper.description_for_subscription(recurring_plan)
}.to raise_error(RuntimeError)
Check the Expecting Errors section here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With