-
-
Notifications
You must be signed in to change notification settings - Fork 730
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
Feature into system specs #8179
Feature into system specs #8179
Conversation
125cf57
to
9880c25
Compare
9880c25
to
02a10ed
Compare
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 is so much better, great! And the specs pass! 🎉
This is basically ready to go. There are just a few unnecessary changes. Otherwise I would have approved. 😄
describe ' | ||
As an administrator | ||
I want to create/update complex order cycles with a specific time | ||
', js: true do |
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.
These specs seem to be copied instead of moved.
describe ' | ||
As an administrator | ||
I want to create/update complex order cycles with a specific time | ||
', js: true do |
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.
Ah, now I see. These two commits should have been one.
require "system_helper" | ||
require "spec_helper" |
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 commit is what we call a "detour". You first did one change and then you undo it later. It makes reviewing slightly more confusing. Maybe you want to keep this in a WIP branch because you expect to change all feature specs at some point but for the purpose of this pull request, it would be nicer to squash these changes into the first commit.
describe ' | ||
feature ' |
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 change doesn't need to be reverted. You can actually rename all feature
to describe
. It's the same. Someone just had the idea that feature
sounds nicer and introduced it as an alias for describe
.
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.
I'm not so sure about this @mkllnk , lets take spec/features/admin/multilingual_spec.rb
as an example:
- with 'spec_helper' - using
feature
(L5) - usingbackground
(L11) - spec passes - with 'spec_helper' - using
describe
(L5) - usingbackground
(L11) - spec fails - with 'spec_helper' - using
describe
(L5) - usingbefore
(L11) - spec passes
It seems to make a difference.
describe "sorting of line items" do | ||
feature "sorting of line items" do |
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 line actually never said feature
. It was describe
before. 😉
@filipefurtad0 Sometimes showing is much easier than explaining. I created a new branch to show you how I would organise the commits for this pull request: master...mkllnk:feature-to-system-1-rebased The first commit will be helpful for all future work on this. And then, after moving specs from feature to system, I simply run this: git ls-files -- spec/system/ | xargs sed -i 's/spec_helper/system_helper/' That makes it easy to migrate specs in chunks without reverting anything. I also removed a commented line and fixed up some whitespace. Feel free to reset your branch to mine. 😜 |
I think I'll need help here @mkllnk , I'm not sure how to proceed on resetting my branch onto yours:
I got the commit hash from here: Not sure. Maybe I could revert that last commit in which I reverted describe -> feature. Let's have a quick call on it, if you fancy. |
Git is very confusing to start with and then very powerful. This seems to work for me: git checkout feature_into_system
git reset --hard 98c98e59e55b5bb08c48def9c235defd07a5e0af
# Then update your PR:
git push --force |
f77add9
to
628fac9
Compare
Indeed! 👍 That hash seems to lead to a missing commit:
I think I know what happened @mkllnk I tried to revert my last commit and since yours was on top of it, it might have gone deleted. This branch is now as it was before, except your commit is missing. I think you'd need to commit again, sorry for that! |
Ah, the problem is that the commit is in my repository but not in yours. You would have needed to fetch my branch from my repository first. But let's shortcut this. I'll just push my version. |
628fac9
to
98c98e5
Compare
The `feature` and `scenario` names are aliases only available in feature specs and not needed. It's confusing to have different names and we can easily move feature specs to system specs when using standard names.
98c98e5
to
a043fe6
Compare
There are now some spec failures. 😞 |
@@ -2,7 +2,7 @@ | |||
|
|||
require "spec_helper" | |||
|
|||
feature ' | |||
describe ' |
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.
I think we can't have specs using spec_helper
with describe
, as they will be run as system specs, but will break because they are not calling the necessary helper (system_helper
).
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.
I'm noticing this as the build is failing here, on background
:
Which passes on feature specs
but breaks system
specs -> replacing with before
fixes it.
Replaces 'background' with 'before' Replaces 'background' with 'before' in other files Fixes typo on products_spec.rb
5a8f9cd
to
81890a4
Compare
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.
Great, everything passes. I'm very happy with this pull request as is but the description doesn't fit any more. This is now only renaming spec blocks. There's no moving of specs left. That's okay. If we get this low-risk PR through, it will avoid a lot of merge conflicts in the future and we can do it step by step.
background do | ||
before do |
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.
Great find! I forgot about this syntax, another feature-spec specific naming that is not necessary.
Updated the description. Once this gets merged I'll move the files previously moved, and make the changes as we go 👍 |
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.
Nice work @filipefurtad0 👍
What? Why?
Replaces #8103.
Enables #7929.
There are quite a few ways to approach this problem :-)
Similar to #8103 but moves all feature specs into/system
as they are updated to pass. This is the opposite approach taken in #8103 in which the down side was that during the lifetime of this branch the updates made to specs were being missed and generating conflicts.The approach chosen here should allow rebasing and not missing any updates to specs, introduced by other PRs.We just is now only rename spec blocks, this sets up for the upcoming changes.
What should we test?
Green build.
Release notes
Changes feature specs into system specs
Changelog Category: Technical changes
Dependencies
Documentation updates