Skip to content

Remove EnumWithNil concern

Igor Drozdov requested to merge id-remove-enum-with-nil into master

What does this MR do?

With Rails version less than 6.1, we had the following behavior:

For the enum failure_reason: { unknown_failure: nil }, when failure_reason is nil, we got:

object.failure_reason # => nil

while we expected

object.failure_reason # => "unknown_failure"

That's why EnumWithNil has been implemented.

With Rails 6.1 we have the expected behaviour out-of-box, that's why we can remove EnumWithNil.

The behaviour is tested implicitly in many places, we also have explicit tests: https://gitlab.com/gitlab-org/gitlab/blob/7b06f6bc577ab7b92af42f684ce81240d5707048/spec/models/commit_status_spec.rb#L686, so the coverage should be fine

Merge request reports

Loading