Ruby 1.9 RR's any_instance_of problems
I've got this strange error, while porting a Rails app to 1.9:
Argument Error:
Wrong number of arguments (1 for 0)
Of course the offending method has the right arity, but at a certain point I found this in an RSpec' before block:
any_instance_of(Resolver, :resolve => ids)
It seems like RR redefines that method at the class level, by messing something with ObjectSpace. The solution is to use the block syntax:
any_instance_of(Resolver) {|r| stub(r).resolve {ids} }
Written by Luca Guidi
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#