-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Spec: Always include spec_helper #1201
Spec: Always include spec_helper #1201
Conversation
LGTM and 👍 for reducing redundancy! @olleolleolle What were the answers to the questions you asked yourself? :p |
One reason to have explicit dependencies is performance. If a unit test doesn't need to load It depends on what our spec does whether this will have significant impact or not. Nevertheless, I personally find it a good practice to minimise dependencies wherever possible. I've forgotten (and I'm on a phone so can't check) - what does our spec helper actually do? |
It requires a few files - # frozen_string_literal: true
ENV['CUCUMBER_COLORS'] = nil
$:.unshift(File.dirname(__FILE__))
# For Travis....
require 'cucumber/encoding'
require 'simplecov_setup'
require 'pry'
require 'cucumber'
RSpec.configure do |c|
c.before do
::Cucumber::Term::ANSIColor.coloring = true
end
end
module RSpec
module WorkInProgress
def pending_under(platforms, reason, &block)
if [platforms].flatten.map(&:to_s).include? RUBY_PLATFORM
pending "pending under #{platforms.inspect} because: #{reason}", &block
else
yield
end
end
end
end I'm happy to not merge this change, if that's your take on it. |
It sounds like a more fundamental question to ask is: Moving dependencies to |
What would be some examples of those different environments @Ben-Behar? |
Well, a trick that I have seen before is to have a |
I'll close this PR. Thanks for the interest in it. We'll manage! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
This PR does one thing: uses the options file
.rspec
to always includespec_helper
. Also: removes therequire 'spec_helper'
from each spec file which has it.Details
I was asking myself: "Do we pay any special cost for having the spec helper in each file?" and "Can we have one
require
instead of 30?"Motivation and Context
"Can we have one
require
instead of 30?"How Has This Been Tested?
Ran the test suite locally.
Types of changes