This post is not about pork and coffee. So, stay clear, if google has landed you here thinking I am going to describe some sort of recipe for making nice mocha coffee with chunky bacons.
Its about using shiny new testing library called Bacon by Chris. Mocha is of course, venerable mocking library for Ruby and Rails.Here is a tiny bit of code that will make you started with bacon and mocha:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
require "rubygems" require "bacon" require "mocha/standalone" require "mocha/object" class Bacon::Context include Mocha::Standalone alias_method :old_it,:it def it description,&block mocha_setup old_it(description,&block) mocha_verify mocha_teardown end end
Thats it. Happy baking.