You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I filed #618 a few minutes ago and realized that my other big need might actually solve the same issue.
Right now, I overuse any_instance because often the object that I want to stub is an ActiveRecord object, but the instance the code I am testing will run against is not one I can access and stub trivially. A really simple motivating example is ActiveJob - you often pass ID's there and let the job search by ID.
It would be really helpful if there was something like:
MyClass.instance_where(id: 5).expects(:foobar)
I don't care much on the instance_where syntax. An alternative would be to use matchers like:
I filed #618 a few minutes ago and realized that my other big need might actually solve the same issue.
Right now, I overuse
any_instance
because often the object that I want to stub is an ActiveRecord object, but the instance the code I am testing will run against is not one I can access and stub trivially. A really simple motivating example is ActiveJob - you often pass ID's there and let the job search by ID.It would be really helpful if there was something like:
I don't care much on the
instance_where
syntax. An alternative would be to use matchers like:ActiveRecord instances with the same id === each other (and == actually) and you could then use it other ways, like:
If I had that, I could do the "have one instance raise and the others not" needed for #618 too.
The text was updated successfully, but these errors were encountered: