-
-
Save david-shockley-beeline/008ea9122e62b051b3614d07a36fae23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stub_const('Something', object_double(Something)) | |
unrenderable_exception = instance_double(Exception) | |
allow(unrenderable_exception).to receive(:my_custom_method_ive_added_to_exception).and_raise | |
allow(Something).to receive(:some_method).and_raise(unrenderable_exception) | |
# code that triggers the call to Something.some_method | |
# assertions that check for the result | |
# Essentially I have some custom exception handling logic in my_custom_method_ive_added_to_exception | |
# and want to test that if it goes wrong my 'fallback' exception handling kicks in. | |
# Unfortunately, the above doesn't seem to work. Instead of using my 'unrenderable_exception' mock object, | |
# I see a RuntimeError as the raised exception. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment