-
Notifications
You must be signed in to change notification settings - Fork 0
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
Make --require spec_helper
the default unless otherwise specified
#35
Comments
It's in the default |
I understand your point of view. It's just that every project has this file, with basically just this one line, and if it's not there things break, so it seems like a defacto standard. It also forces every project to have a |
Except the ones that don't, or the ones that choose to
It doesn't, it is a connivence to allow you to omit it from your spec files. You also don't have to have a |
All fair points.
Understood. But at least in this very specific case, shouldn't be an issue since this isn't
IMHO, these users are the exception, they shouldn't use
It is convenient, but it's also required in cases where it's setup that way. i.e. a missing Maybe this is a strong argument for putting
That sounds very risky :p I'm happy for you to close this issue if you don't think there is merit in considering it further. However, to me, this is an established convention, and it would be good to thing about how we can make |
I sort of see your point, after all we have a couple of magic files, (home folder I'm leaving this open for community feedback, I wouldn't change this until RSpec 4 however, as it is a change in behaviour I feel could catch people out, which is fair enough on a major version change, less so on a minor.
Totally irrelevant aside, I found this amusing, how to make the default configuration file more default? 🙃 |
So, I guess Firstly, I don't like manipulating
So you'd have:
The while true
path = File.dirname(spec_path)
rspec_path = File.join(path, "rspec.rb")
if File.exist?(rspec_path)
return rspec_path
end
spec_path = File.dirname(spec_path)
break if path == spec_path
end However that introduces potential mutable state as you execute specs... so maybe another option would be to consider if |
Another question I have is how If I'm in a different directory, e.g.
Will it load |
Just my 2c. Orthogonal to the above, more an alternative to |
Not only that, but it would also unburden users from figuring out their own bespoke solutions. |
It loads I'm really not keen on having spec folder specific config, that seems like a headache waiting to happen. Especially as we can't mutate running config, especially with plans to go parallel... |
why would you need to mutate the running config? |
Because the reason why |
Its much easier to do things before we load spec files. |
I think that's part of my suggestion though - to make a canonical way to load that before running specs. |
You can't have that and have folder level config files, we don't know they exist until we load specs. |
Config files can also add spec files, meaning you have an ever expanding matrix of files and trees to load config from... |
In my opinion if you want a canonical autoloaded config file it's |
How about replacing Simpler than the status quo (1 location to look for configuration instead of 2). Simpler than directory specific config file (for users and for maintainers). Similar to other projects, e.g. puma's configuration file. Addresses this specific issue, Is there anything that wouldn't support? |
Not necessarily all projects do have a Global For specs, this opens an incredible opportunity™: it will be possible to omit the
|
I'm really not keen on co-locating config with spec files, I suspect it would very surprising to longer term rspec'ers, in addition it raises questions of how we handle conflicting spec config... Currently we have a spec config that applies once across the entire suite run... If we allowed per folder spec config are we saying we're going to merge config together? If so in what order? What takes precedence? If we say we're going to apply that config only to those specs we're going to have to build a way to merge configs and restore the previous, which makes no sense when we're dealing with global configuration. In short that is going to be a maintenance nightmare for very little benefit... The original point of this issue was to reduce boilerplate by autoloading a file if present, I support that for RSpec 4, but I'm heavily favouring the existing |
I've worked through this issue for my own test framework, sus. I decided to load
it's okay, they can create it if they want default config. I don't see any problem with that? |
Would it make sense to make
--require spec_helper
the default unless otherwise specified? It's such a common pattern.The text was updated successfully, but these errors were encountered: