function Cat(){ } Cat.meow = function() { return "meow"; }; Cat.lol = function() { return "I can haz"; } Screw.Unit(function() { describe("The stubbing process",function(){ it("--- well, 0 equals 0",function(){ expect(0).to(equal,0); }); }); describe("Cats",function(){ describe("lol method",function(){ it("should return 'I can haz'",function(){ expect(Cat.lol()).to(equal,"I can haz"); }); }); describe("meow method",function(){ it("should return 'meow'",function(){ expect(Cat.meow()).to(equal,"meow"); }); describe("when stubbed",function(){ before(function(){ stubbedCat = Smoke.Mock(Cat); stubbedCat.should_receive('meow').and_return("woof"); }); it("should return 'woof'",function(){ expect(stubbedCat.meow()).to(equal,"woof"); Smoke.checkExpectations(); }); it("should not affect lol method",function(){ expect(Cat.lol()).to(equal,"I can haz"); }); }); }); }); });