-
Notifications
You must be signed in to change notification settings - Fork 433
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
Validate presence of project on Staging::Workflow. #10603
Conversation
@@ -20,6 +20,11 @@ | |||
staging_workflow | |||
end | |||
|
|||
describe 'validations' do | |||
it { is_expected.to validate_presence_of(:managers_group) } | |||
it { is_expected.to validate_presence_of(:project) } |
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.
We usually don't test the (presence of) validations. Only if they contain logic.
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.
hm, i like the tests to make sure that the validation exists and wasn't disabled (i.e someone disable it to debug something else, and forget to enable it back) or removed by mistake.
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.
If it's not possible to create a staging workflow w/o associated project (via the UI) there might be no other way to test the validation.
Plus these tests are quite cheap, no need to hit the db either.
Codecov Report
@@ Coverage Diff @@
## master #10603 +/- ##
=======================================
Coverage 91.05% 91.05%
=======================================
Files 583 583
Lines 21481 21481
=======================================
Hits 19559 19559
Misses 1922 1922 |
I wonder if we would need a data migration in addition to the validation. There might be staging workflows without a valid project. I didn't check... |
Indeed there are, but they are not accessible anymore anyway as we route through the project. I don't think we need to do anything about them in this PR. |
In production:
|
Thank you for your contribution @bjoernalbers! |
This fixes #7175.
I've added one validation with corresponding tests.