Skip to content

Update docs for raising errors with required params

gitlab-qa-bot requested to merge github/fork/locofocos/patch-1 into master

Created by: locofocos

I would like to update the documentation for raising errors with required parameters. I have run into an issue multiple times where I've tried to raise an error class, but the class requires args for instantiation, like

expect(double).to receive(:msg).and_raise(ErrorWhichRequiresArgs)

without realizing the issue. Ruby gives an error message about "wrong number of arguments", which has repeatedly led me (personally) down the wrong path of troubleshooting other issues.

If we added this example, I think it would help us avoid this issue (or fix it faster). For justification that I'm not the only one with the issue, this question on StackOverflow has an accepted answer with 15 points: https://stackoverflow.com/questions/40775978/rspec-wrong-number-of-arguments-when-raising-error

Thanks!

Merge request reports