Ruby: FibberMailman, mocking the Net::POP3.start
Lately 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.
Marzo 28th, 2012 at 6:48 am
[…]The information mentioned in the article are some of the best available […]……
[…]The information mentioned in the article are some of the greatest available […]……
Septiembre 25th, 2014 at 5:34 am
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,
Junio 11th, 2015 at 1:58 am
click here for the top auto set clocks around
Junio 25th, 2015 at 4:39 pm
get the top learn more available
Julio 3rd, 2015 at 6:16 pm
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.
Julio 5th, 2015 at 12:15 am
see here for the top http://www.herbalistic.net/ info around
Julio 17th, 2015 at 9:37 am
Hello, after reading this amazing piece of writing
i am as well happy to share my know-how here with colleagues.
Abril 13th, 2016 at 1:40 pm
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.
Enero 16th, 2017 at 12:17 pm
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