Add require: false
to Gemfile example
#101
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
RSpec has the ability to automatically load custom formatter that follows the naming conventions properly, so there is no need to have
Bundler.require
load it for you.Adding this
require: false
makes it more profitable to have it loaded only when needed (e.g. only in CI if you use this formatter only in CI).I don't think many people want to output JUnit format files locally, so it will cut down on unnecessary loading in many cases. Also, this README Gemfile example is probably close to the example used in a typical Rails app, so many Rails users will benefit from this.
This change also eliminates another problem. If you run
require 'rspec/core'
before the appropriate time,Kernel.#context
will be defined and you will get a warning when you load irb. The following Issue provides more information on this issue.Since rspec_junit_formatter executes
require 'rspec/core'
when loaded, it causes this problem when loaded withBundler.require
. Thisrequire: false
also resolves this problem.rspec_junit_formatter/lib/rspec_junit_formatter.rb
Line 6 in 02c1756