Skip to content

Instantly share code, notes, and snippets.

@gumayunov
Created March 19, 2012 18:33
Show Gist options
  • Save gumayunov/2123192 to your computer and use it in GitHub Desktop.
Save gumayunov/2123192 to your computer and use it in GitHub Desktop.
proxy_logger_spec.rb
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