Don't use default separator in tagged logger #7084

Merged
merged 1 commit into from Jul 18, 2012
Jump to file or symbol
Failed to load files and symbols.
+14 −3
Diff settings

Always

Just for now

@@ -31,7 +31,7 @@ def current_tags
def tags_text
tags = current_tags
if tags.any?
- tags.collect { |tag| "[#{tag}] " }.join
+ tags.collect { |tag| "[#{tag}] " }.join('')
end
end
end
@@ -10,8 +10,13 @@ def flush(*)
end
setup do
- @output = StringIO.new
- @logger = ActiveSupport::TaggedLogging.new(MyLogger.new(@output))
+ @output = StringIO.new
+ @logger = ActiveSupport::TaggedLogging.new(MyLogger.new(@output))
+ @separator = $,
+ end
+
+ after do
+ $, = @separator
end
test "tagged once" do
@@ -69,4 +74,10 @@ def flush(*)
assert_equal "[BCX] [Jason] Funky time\n[BCX] Junky time!\n", @output.string
end
+
+ test "using the correct separator" do
+ $, = "_"
+ @logger.tagged("BCX", "BDX") { @logger.info "Funky time" }
+ assert_equal "[BCX] [BDX] Funky time\n", @output.string
+ end
end