Useful for mocking in tests.
Last active
June 25, 2021 16:26
-
-
Save marian13/176e2a98695e81c8f0599d9e3e9ff52d 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
# An object that raises error on any method call. | |
Object.new.tap do |object| | |
object.define_singleton_method(:method_missing) do |*args| | |
raise 'Error raised from the object that raises error on any method call' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment