From c5f4b202757473b8262aa2e6e6bcfca1da3d73d3 Mon Sep 17 00:00:00 2001 From: Anton Lindqvist Date: Thu, 22 Mar 2012 12:25:10 +0100 Subject: [PATCH] Fixed missing space bug introduces in rails/rails@9299bfdcd387253d83b645c205b8df477f2d0940. --- railties/lib/rails/source_annotation_extractor.rb | 2 +- railties/test/application/rake/notes_test.rb | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/railties/lib/rails/source_annotation_extractor.rb b/railties/lib/rails/source_annotation_extractor.rb index 9bfc2b16aba4e..4cd60fdc39672 100644 --- a/railties/lib/rails/source_annotation_extractor.rb +++ b/railties/lib/rails/source_annotation_extractor.rb @@ -22,7 +22,7 @@ class Annotation < Struct.new(:line, :tag, :text) # If +options+ has a flag :tag the tag is shown as in the example above. # Otherwise the string contains just line and text. def to_s(options={}) - s = "[#{line.to_s.rjust(options[:indent])}]" + s = "[#{line.to_s.rjust(options[:indent])}] " s << "[#{tag}] " if options[:tag] s << text end diff --git a/railties/test/application/rake/notes_test.rb b/railties/test/application/rake/notes_test.rb index b66433f64dd22..04abf9e3a181a 100644 --- a/railties/test/application/rake/notes_test.rb +++ b/railties/test/application/rake/notes_test.rb @@ -28,7 +28,7 @@ def teardown Dir.chdir(app_path) do output = `bundle exec rake notes` - lines = output.scan(/\[([0-9\s]+)\]/).flatten + lines = output.scan(/\[([0-9\s]+)\](\s)/) assert_match /note in erb/, output assert_match /note in haml/, output @@ -38,8 +38,9 @@ def teardown assert_equal 5, lines.size - lines.each do |line_number| - assert_equal 4, line_number.size + lines.each do |line| + assert_equal 4, line[0].size + assert_equal ' ', line[1] end end