提交 3b073ac1 编写于 作者: R robertomiranda

Rake notes should picked up new Extensions registered in the config/application.rb file

上级 6b4793b1
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册