Thinking on hiring me?

Please read

Fernando Guillén

a Freelance Web Developer

cabecera decorativa

software development as an artistic expression

Archive for Agosto, 2010

Miércoles, Agosto 25th, 2010

Ruby: DummyDropbox, mocking the Dropbox API calls.

Dummy Dropbox

Playing with the Dropbox API for an another experimental pet-project I needed to test how my mini-application was responding to different Dropbox contents. On the beginning I was configuring a real Dropbox account for testing but this was not agile and flexible. So this is because I decided to mock the dropbox ruby gem and this is because DummyDropbox has been born.

The working is simple: you point the gem to a local folder, all the dropbox API calls will think that this local folder is a real Dropbox account.

Example:

require 'dummy_dropbox'
DropboxDummy.root_path = "#{File.dirname(__FILE__)}/test/fixtures/dropbox"
session = Dropbox::Session.new('key', 'secret')
assert_equal(
  File.read( "#{File.dirname(__FILE__)}/test/fixtures/dropbox/file1.txt" ),
  session.download( '/file1.txt' ) 
)

Wondering if this could be helpful for someone.

Martes, Agosto 3rd, 2010

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.

 

Martes, Agosto 3rd, 2010

Lightning Talk about the OneOfZombies project

A few months ago I was on Krakow attending to the European Ruby Conference (aka EuRuKo).

There I had the opportunity to talk about one of my unfinished pet project OneOfZombies the Game.

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.