Skip to content

Commit

Permalink
Rake notes should picked up new Extensions registered in the config/a…
Browse files Browse the repository at this point in the history
…pplication.rb file
  • Loading branch information
robertomiranda committed Mar 17, 2014
1 parent 6b4793b commit 3b073ac
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions railties/test/application/rake/notes_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,25 @@ def teardown
end

test 'register a new extension' do
SourceAnnotationExtractor::Annotation.register_extensions("test1", "test2"){ |tag| /#{tag}/ }
assert_not_nil SourceAnnotationExtractor::Annotation.extensions[/\.(test1|test2)$/]
assert_nil SourceAnnotationExtractor::Annotation.extensions[/\.(haml)$/]
add_to_config %q{ config.annotations.register_extensions("scss", "sass") { |annotation| /\/\/\s*(#{annotation}):?\s*(.*)$/ } }
app_file "app/assets/stylesheets/application.css.scss", "// TODO: note in scss"
app_file "app/assets/stylesheets/application.css.sass", "// TODO: note in sass"

boot_rails

require 'rake'
require 'rdoc/task'
require 'rake/testtask'

Rails.application.load_tasks

Dir.chdir(app_path) do
output = `bundle exec rake notes`
lines = output.scan(/\[([0-9\s]+)\]/).flatten
assert_match(/note in scss/, output)
assert_match(/note in sass/, output)
assert_equal 2, lines.size
end
end

private
Expand Down

0 comments on commit 3b073ac

Please sign in to comment.