Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1k
Respect RSpec default_path for generators#2508
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
vivekmiyani commented Jun 21, 2021 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
pirj commented Jun 21, 2021
Something failed |
vivekmiyani commented Jun 24, 2021
Hii, I've updated the branch. At the moment, rails installer does not support I'll work on it when get a chance. |
pirj commented Jun 24, 2021
Looks great, thank you. You may (completely optionally) add a feature to Just noticed that our Generators documentation is split into two, and the second one's name is misleading, Generator specs. It's a topic for another PR to bring them together, though. |
vivekmiyani commented Jun 25, 2021
@pirj Are we only going to test Forgive me if I misunderstood anything 😅 . |
pirj commented Jun 25, 2021
Yes, just your fix. Those features are published as documentation, and are end-to-end tests. No worries if you get stuck with it. Altering the default spec path is a pretty rare case. Also, with your fix it now works intuitively, so maybe documentation for it is redundant. Leaving it up to you to decide. |
vivekmiyani commented Jun 26, 2021
Okay I will update the PR. But while implementing the feature I am running into one issue.: I thought that It looks the blocker is the |
vivekmiyani commented Jun 26, 2021
We have to do something like, https://github.com/rspec/rspec-core/blob/main/lib/rspec/core/runner.rb#L132 (i.e. Any thoughts or suggestion? |
pirj commented Jun 26, 2021 via email • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
It's all kind of weird. If I'm not mistaken, the doc https://relishapp.com/rspec/rspec-core/v/3-9/docs/configuration/setting-the-default-spec-path says that `default_path` is not supported on `RSpec.configuration`, but it seems that it is. The reasoning is not exactly clear. Let me check later when I get back to the computer. |
pirj commented Jun 26, 2021
# RSpec.configure do |c|# c.default_path = 'behavior'and and what's more important: # @note Other scripts invoking `rspec` indirectly will ignore this# setting.which is exactly the case with generators. Though Can you please confirm that defining the default path in If it works, I suggest you to write the feature test in such a way that the default path is set in the |
pirj commented Jun 26, 2021
I think I have bad news. Options from files, |
vivekmiyani commented Jun 27, 2021
Yes that's what I exactly found. See my #2508 (comment) I've mentioned the line no. where I will try to find more and will update the PR. |
JonRowe commented Jun 28, 2021
I'd like to see a feature file demonstrating this behaviour so that its both documented and tested, the changes to the generator look fine but I'm not sure its sufficient to load |
vivekmiyani commented Jul 10, 2021
@JonRowe@pirj I will implement feature file. Can we initialize |
pirj commented Jul 10, 2021
I believe with those discoveries, adding a feature test becomes a necessity. |
vivekmiyani commented Jul 13, 2021
Hey, # Install rspec at custom directory (this will append `--default-path` option to `.rspec` file) $ rails generate rspec:install --default-path behaviourAlso look at 5f7b640 which implements the feature you've asked for!! |
vivekmiyani commented Jul 16, 2021
Uh oh!
There was an error while loading. Please reload this page.
pirj left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is copied over from rspec-core. It might be exposed as a public interface, but this may be postponed to a later version, and we can do this in rspec-core 4.0.1, and set the minimum dependent version to it.
Thank you!
vivekmiyani commented Jul 18, 2021 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@pirj Can we initialize |
pirj commented Jul 18, 2021
That's an option to consider, too. defself.configuration@configuration ||= RSpec::Core::Configuration.newendand there could be cases when it's necessary to run a suite with different options, e.g. filters. It would make I don't feel that this code duplication is a big issue, it just hints that something can be optimized. |
JonRowe left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delayed feedback, looking good but some more tweaks needed.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Code review notes addressed, proposed changes accepted
JonRowe left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes behaviour for all generators, yet is only tested against one generator. This needs the additional tests and scenarios.
vivekmiyani commented Nov 21, 2021 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Hello guys, Sorry for delayed response. I was super busy in some stuffs. As @JonRowe asked, I am writing feature tests for below items (List grabbed from
EDIT: Added the entry of generator feature in TODO list. |
vivekmiyani commented Nov 21, 2021
pirj commented Nov 21, 2021
Looks good to me 👍 |
vivekmiyani commented Nov 28, 2021 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Hey @pirj@JonRowe, Added more feature tests 🎉 . Below are not implemented as I couldn't figure how to tackle them 🤕 :
|
JonRowe commented Jan 18, 2022
@pirj can you review this? |
vivekmiyani commented Jun 17, 2022
pirj commented Jul 17, 2022
Thank you! |
Fixes#2507.
TODO
specdirectory todefault_path