Created
March 19, 2012 18:33
-
-
Save gumayunov/2123192 to your computer and use it in GitHub Desktop.
proxy_logger_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe AccessSchema::ProxyLogger do | |
describe ".debug" do | |
class DebugTestLogger | |
attr :output | |
def debug(message = nil, &blk) | |
@output = message || blk.call | |
end | |
end | |
before do | |
@logger = DebugTestLogger.new | |
@proxy = AccessSchema::ProxyLogger.new(@logger) | |
end | |
it "adds 'AccessSchema: ' prefix to passed message" do | |
@proxy.debug("message test") | |
@logger.output.should == "AccessSchema: message test" | |
end | |
it "adds the same prefix to message generated by passed block" do | |
@proxy.debug{ "block test" } | |
@logger.output.should == "AccessSchema: block test" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment