I have a class called X that writes to disk. For this reason, the
class is hard to test.  If it wrote to a hash instead, I could test
it.

So I made a new class called X in test/mocks.  In that class, I
overrode the methods that wrote to disk.

But I didn't want to copy ALL the methods from the real X into the
mock X - only the ones that were being over-ridden.

My idea was to subclass the mock X from the real X and only define/
cripple the poisonous file-based methods.

However, it doesn't work :-D

The problem is that I don't know how to subclass from the real X:

def X < X
...
end

...doesn't cut it!   Assuming the real X lives in (proj)/lib/this/
that, how can I subclass from it?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to