I’m adding unit tests to a large batch of code and am looking for a way to insert fake methods in for testing purposes. The problem is that, as far as I know in Ruby, to pass a method in one must use ClassName.method(:method_name), and then refactor the method I’m testing to use boo.call() instead of just boo(). Is there an easier way to do this than refactoring everything to use .method and .call?
I’m adding unit tests to a large batch of code and am looking for
Share
Why not just pass lambdas? I mean, lambda is just an anonymous method/function as you know it from other languages, so it should work fine. Eg:
You still need to call
.callthough