main
1require "spec_helper"
2
3describe Logger do
4 context "playtime" do
5 it "should log stuff" do
6 logger = Logger.new(STDOUT)
7 logger.level = Logger::DEBUG
8
9 #logger.debug("i am logged")
10 #logger.close
11 end
12 end
13end
14
15module Nasty
16 describe Log do
17 context "when logging stuff" do
18 let(:logger) { double("", debug: true) }
19 let(:log_factory) { double }
20
21 before :each do
22 log_factory.stub(:create_for).with(self).and_return(logger)
23 Log.bind_to(log_factory)
24 Log.for(self).debug("hi there")
25 end
26
27 after :each do
28 Log.unbind
29 end
30
31 it "should log to the bound logger" do
32 logger.should have_received(:debug).with("hi there")
33 end
34 end
35
36 context "logger" do
37 it "should be able to call the logger from anywhere" do
38 logger.debug("blah")
39 end
40 end
41 end
42end