[rspec-users] stub! and stubs
scott at railsnewbie.com
Mon Oct 12 21:26:38 EDT 2009
On Oct 12, 2009, at 9:14 PM, David Chelimsky wrote:
> On Oct 12, 2009, at 9:37 PM, Sam Woodard wrote:
>> I have an interesting setup: I am using rspec for mocking but I have
>> mocha installed which give me access to any_instance, expects,
>> etc. The
>> problem that I am having is that I want to stub out a method for the
>> duration of a single example, throughout that example but only for
>> If I do,
>> this is not sufficient because valid is called more than once
>> If I do,
>> Goal.any_instance.stubs(:valid?).returns(true) then my tests are not
>> independent but dependent on one another.
>> Can anyone help?
> While mocha and rspec's mocks might be compatible for you in some
> cases, it is purely accidental. I'd strongly recommend you choose
> one or the other. If any_instance is important to you, I'd choose
> mocha. If not, choose whichever makes you happier.
Unless I'm incorrect, this is still a feature request on the
I don't see why we couldn't use something like this code:
to implement the mixin/mixout feature that we'd need to support
different frameworks per-example group.
>> Thanks in advance,
>> Posted via http://www.ruby-forum.com/.
>> rspec-users mailing list
>> rspec-users at rubyforge.org
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users