Thinking on hiring me?

Please read

Fernando Guillén

a Freelance Web Developer

cabecera decorativa

software development as an artistic expression

Ruby: FibberMailman, mocking the Net::POP3.start

 

 

 

Fibber MailmanLately I’m involved on projects that do a very intensive use of email accounts as input of information.

The use of mail in an automatic process is always a pain in the ass because of the huge casuistic and also for the difficulty to test it.

Nothing we can do with the first problem but for the second one here is my propose of a very simple Ruby Gem to mock the Net::POP3.start petition so you can simulate the emails that a real POP3 petition could find:

FibberMailman the mock for the Net::POP3.start.

Just charge a bunch of raw mails in an strings array and send them to the FibberMailman.lie_to_me method like this:

require 'fibber_mailman'
 
raw_mails = [
  File.read( "/fixtures/mail1.raw_mail" ) ),
  File.read( "/fixtures/mail2.raw_mail" ) ),
]
 
FibberMailman.lie_to_me( raw_mails ) do
  <your code that uses the Net::POP3.start on any point>
end

Every petition to the Net::POP3.start method into the inside block will be feed with fake emails built from the raw mail strings.

 

9 Comments to “Ruby: FibberMailman, mocking the Net::POP3.start”
  1. OldChangKee Says:

    […]The information mentioned in the article are some of the best available […]……

    […]The information mentioned in the article are some of the greatest available […]……

  2. Flynn Says:

    You actually make it seem so easy with your presentation but I
    find this topic to be really something which I think I would
    never understand. It seems too complicated and extremely broad for me.
    I am looking forward for your next post, I will try to get the hang of it!

    Feel free to surf to my homepage personalized home decor,
    Flynn,

  3. http://www.chaseclocks.com/ Says:

    click here for the top auto set clocks around

  4. antique clock Says:

    get the top learn more available

  5. Copas Mundial Says:

    Actually, ceramic is approximately 60% lighter than steel and
    is harder too. Those ROTC members made the run and passed the ball onto Wyoming’s ROTC contingent,
    and this great picture by CSU Media Relations Director Paul Kirk shows the scale of the tradition. Both of
    them will surely make a way in helping the players reach
    their goal of mastering the skills from these drills and in the long run be able
    to use it in their game.

  6. www.herbalistic.net Says:

    see here for the top http://www.herbalistic.net/ info around

  7. drop shipping Says:

    Hello, after reading this amazing piece of writing
    i am as well happy to share my know-how here with colleagues.

  8. corte con laser Says:

    Es difícil encontrar a blogers con conocimientos sobre este tema , pero creo que sabes de lo que estás hablando. Gracias compartir un tema como este.

  9. corte metales madrid Says:

    Os adrezco el compartir con todos nosotros toda esta practica información. Con estos granitos de arena hacemos màs grande la montaña Internet. Enhorabuena por este blog.

    Saludos

Leave a comment

a Freelance Web Developer is proudly powered by WordPress
Entries (RSS) and Comments (RSS).

Creative Commons License
Fernando Guillen's blog by Fernando Guillen is licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License.