Class: Class
Relationships & Source Files | |
Inherits: | Object |
Defined in: | rspec-mocks/lib/rspec/mocks/syntax.rb |
Overview
The legacy ‘:should` syntax adds the #any_instance to Class
. We generally recommend you use the newer :expect
syntax instead, which allows you to stub any instance of a class using allow_any_instance_of(klass)
or mock any instance using expect_any_instance_of(klass)
.
Instance Method Summary
-
#any_instance ⇒ Recorder
Used to set stubs and message expectations on any instance of a given class.
Instance Method Details
#any_instance ⇒ Recorder
Note:
This is only available when you have enabled the ‘should` syntax.
Used to set stubs and message expectations on any instance of a given class. Returns a [Recorder](Recorder), which records messages like ‘stub` and #should_receive for later playback on instances of the class.