aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorrobertomiranda <rjmaltamar@gmail.com>2014-03-16 14:32:08 -0500
committerrobertomiranda <rjmaltamar@gmail.com>2014-03-16 14:32:08 -0500
commitce38a6b8b62e73596ec1062663e85726fbca8933 (patch)
treee0371ece727312fec94b873c2e34f6bbd2ff4ce5 /railties
parentf43421cb65da635988f2bb5341d519c3c2748b74 (diff)
downloadrails-ce38a6b8b62e73596ec1062663e85726fbca8933.tar.gz
rails-ce38a6b8b62e73596ec1062663e85726fbca8933.tar.bz2
rails-ce38a6b8b62e73596ec1062663e85726fbca8933.zip
Fix Shadowing extensions variable in Register Annotation Exentsions
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/source_annotation_extractor.rb4
-rw-r--r--railties/test/application/rake/notes_test.rb10
2 files changed, 7 insertions, 7 deletions
diff --git a/railties/lib/rails/source_annotation_extractor.rb b/railties/lib/rails/source_annotation_extractor.rb
index af6d90b5bd..201532d299 100644
--- a/railties/lib/rails/source_annotation_extractor.rb
+++ b/railties/lib/rails/source_annotation_extractor.rb
@@ -24,8 +24,8 @@ class SourceAnnotationExtractor
# Registers new Annotations File Extensions
# SourceAnnotationExtractor::Annotation.register_extensions("css", "scss", "sass", "less", "js") { |tag| /\/\/\s*(#{tag}):?\s*(.*)$/ }
- def self.register_extensions(*extensions, &block)
- self.extensions[/\.(#{extensions.join("|")})$/] = block
+ def self.register_extensions(*exts, &block)
+ extensions[/\.(#{exts.join("|")})$/] = block
end
register_extensions("builder", "rb", "rake", "yml", "yaml", "ruby") { |tag| /#\s*(#{tag}):?\s*(.*)$/ }
diff --git a/railties/test/application/rake/notes_test.rb b/railties/test/application/rake/notes_test.rb
index b6b1bd63f4..28efc84c57 100644
--- a/railties/test/application/rake/notes_test.rb
+++ b/railties/test/application/rake/notes_test.rb
@@ -25,7 +25,7 @@ module ApplicationTests
app_file "lib/tasks/task.rake", "# TODO: note in rake"
app_file 'app/views/home/index.html.builder', '# TODO: note in builder'
app_file 'config/locales/en.yml', '# TODO: note in yml'
- app_file 'config/locales/en.yaml', '# TODO: note in yml'
+ app_file 'config/locales/en.yaml', '# TODO: note in yaml'
app_file "app/views/home/index.ruby", "# TODO: note in ruby"
boot_rails
@@ -40,13 +40,13 @@ module ApplicationTests
lines = output.scan(/\[([0-9\s]+)\](\s)/)
assert_match(/note in erb/, output)
- assert_match(/note in ruby/, output)
assert_match(/note in js/, output)
assert_match(/note in css/, output)
assert_match(/note in rake/, output)
assert_match(/note in builder/, output)
assert_match(/note in yml/, output)
assert_match(/note in yaml/, output)
+ assert_match(/note in ruby/, output)
assert_equal 9, lines.size
@@ -170,9 +170,9 @@ module ApplicationTests
end
test 'register a new extension' do
- SourceAnnotationExtractor::Annotation.register_extensions(".test1", ".test2") { |tag| /#{tag}/ }
- assert SourceAnnotationExtractor::Annotation.extensions[/(\.test1|\.test2)/]
- assert_blank SourceAnnotationExtractor::Annotation.extensions[/(\.haml)/]
+ SourceAnnotationExtractor::Annotation.register_extensions("test1", "test2"){ |tag| /#{tag}/ }
+ assert_not_nil SourceAnnotationExtractor::Annotation.extensions[/\.(test1|test2)$/]
+ assert_nil SourceAnnotationExtractor::Annotation.extensions[/\.(haml)$/]
end
private