[rspec-users] Stubbing out method for all instances
aslak.hellesoy at gmail.com
Tue Mar 27 06:19:44 EDT 2007
On 3/27/07, David Smalley <david.smalley.lists at googlemail.com> wrote:
> I am using the acts_as_state_machine plugin to control state of an
> object in my app, however when testing this I need to be able to stub
> out the guard conditions so that state will change when I fire off an
> event without depending on other models.
> Guard conditions simply return true or false so I have an instance
> def encoded?
> <check state of other objects>
> return true or false
> However I cannot find a way to stub out this method properly. Ideally
> I wish to do something that I expect I could do with Test::Unit mocks
What's Test::Unit mocks?
> and just replace the encoded? instance method for all objects that
> might use it to just return true.
> Any ideas?
You can submit a feature request - ideally with a failing spec to
illustrate what you want.
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users