Skip to content

Rake notes compatibility in Rails 5.1.0 #1661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 9, 2016
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/rspec-rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ module RSpec
module Rails
# Railtie to hook into Rails.
class Railtie < ::Rails::Railtie

# As of Rails 5.1.0 you can register directories to work with `rake notes`
if Gem::Requirement.new(">= 5.1.0").satisfied_by?(Gem::Version.new(::Rails.version))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you switch this away from using rubygems please? It's generally a good idea to not assume it's present, a check on the rails version string is sufficient normally (e.g. ::Rails.version >= "5.1.0").

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can see our preferred form a few lines down in fact, so making this ::Rails::VERSION::STRING >= '5.1' would be preferred :)

SourceAnnotationExtractor::Annotation.register_directories("spec")
end

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build is breaking due to the whitespace inserted here, our convention is to not allow trailing whitespace in files, would you mind cleaning it up?

# Rails-3.0.1 requires config.app_generators instead of 3.0.0's config.generators
generators = config.respond_to?(:app_generators) ? config.app_generators : config.generators
generators.integration_tool :rspec
Expand Down Expand Up @@ -67,6 +73,7 @@ def supports_action_mailer_previews?(config)
# always return `true`.
config.respond_to?(:action_mailer) && ::Rails::VERSION::STRING > '4.1'
end

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you remind removing this? Adding extra spacing to existing code tends to cause git churn which we would like to avoid.

end
end
end