I haven't seen anything like this (prototype-based).
Unwrapping function is possible, but not in current Function#wrap
implementation. You could either store a reference to original
function as a property on a new (wrapped) one, or use a separate id-
based table for mapping one function to other ones. I find first
approach better. If every wrapped function has pointers to both
"previous" and "next" versions, you basically get a doubly-linked list
(and could easily walk in both directions)

- kangax

On Jun 23, 1:15 pm, "Justin Perkins" <[EMAIL PROTECTED]> wrote:
> I'm curious if anyone has written an add-on to unittest to support
> mocking-like behavior for functions so that we can write assertions
> that ensure a function is called within other functions.
>
> If this hasn't been done, I thought it'd be pretty straight forward to
> add a assertCall() method to the Test.Unit.Assertions class, which
> would just wrap a function, but then the question is: once I wrap a
> function, can I unwrap it?
>
> -justin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to