Skip to content

Commit 73b742c

Browse files
johnmeehanJonRowe
authored andcommitted
Rake notes compatibility in Rails 5.1.0 (#1661)
* As of Rails 5.1.0 gems can register a directories with the Rails `SourceAnnotationExtractor` which means when we run `rake notes` it will now also list out any todos in the `/spec` folder. This was added in this PR: rails/rails#25692 Resulting in: ```bash $ rake notes app/spec/models/article_spec.rb: * [2] [TODO] add more specs * [3] [FIXME] Spec A is broken * [4] [OPTIMIZE] improve this test ``` * In this commit: * just fixed the railtie As of Rails 5.1.0 gems can register a directories to work with `rake notes` In this case we can tell Rails it to now look in the `/spec` folder when searching for annotations like `# TODO:` `# FIXME` etc. This was added in this PR: rails/rails#25692 Resulting in: ```bash $ rake notes app/spec/models/article_spec.rb: * [2] [TODO] add more specs * [3] [FIXME] Spec A is broken * [4] [OPTIMIZE] improve this test ```
1 parent 585f70f commit 73b742c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/rspec-rails.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ module RSpec
88
module Rails
99
# Railtie to hook into Rails.
1010
class Railtie < ::Rails::Railtie
11+
# As of Rails 5.1.0 you can register directories to work with `rake notes`
12+
if ::Rails::VERSION::STRING >= '5.1'
13+
SourceAnnotationExtractor::Annotation.register_directories("spec")
14+
end
1115
# Rails-3.0.1 requires config.app_generators instead of 3.0.0's config.generators
1216
generators = config.respond_to?(:app_generators) ? config.app_generators : config.generators
1317
generators.integration_tool :rspec

0 commit comments

Comments
 (0)