Jesús Gabriel y Galán wrote:
> One option would be to change the start method of Net::POP3 to do
> exactly what you describe

This is a good idea.

I can open the class Net::POP3 and redefine the method .start.

Now, how can I organize this to charge the redefinition of the method at 
the beginning of the test and revert it at the end of the test.

I mean, if I have a file that redefine the Net::POP3.start method I can 
'require' it but I don't know how to 'un-require' it.

Also I would like to simulate that the Net::POP3.start charges my mails 
array (different on every test) and if I redefine this method in a 
generic way I don't know how to use my mails array inside the redefined 
method.

Example, if I have my own redefinition of the method like:

[code]
    class Net::POP3
      def self.start( *, &block )

         (How can I put my mails array in here?)

      end
    end
[/code]

I think I need some kind of mocking tutorial or something, if you know 
any one and you can offer me the link it will be great.

Thanks

f.
-- 
Posted via http://www.ruby-forum.com/.