I saw the official discouragement of using expect_any_instance_of 
and allow_any_instance_of on the page:

https://relishapp.com/rspec/rspec-mocks/docs/working-with-legacy-code/any-instance

So, what should I do when I have a method which calls new to get a new 
object of a class,
and then calls a method on that new object?  I want to stub the method 
call, 
because it does some complicated things which external resources,
and I want to have an expectation that the method is called.

  def self.create_from_vendor(epoch, vendor)
    new(vendor).create(epoch)
  end

Is there a way I need to rewrite my code to test this better?
Is this a smell?

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/60034cee-8d5d-4053-ba10-1816a6c4ef03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to