Closed MrSerth closed 2 weeks ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 94.78%. Comparing base (
a271eed
) to head (815c20a
). Report is 44 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Looks good, I am just wondering if we need
Label#to_s
? I could not find any usage and it is also not covered by the tests.
I knew you would point that out. It is not used, that's right. I found it helpful to have while debugging, since it replaced the magic object ID with the actual label name when printing. If you like, I can add a simple test for that.
The test is a bit silly :wink: but at least Codecov is happy now :+1:
The previous mechanism required newly-assigned TaskLabels to be saved before aiming to destroy dangling labels. However, there is one edge-case previously used in the tests which caused erroneous behavior:
Imagine, there is a dangling label (with no matching TaskLabel). Then, a task is assigned that dangling label through the
label_names=
mechanism. This will cause theLabel.find_or_initialize_by(name:)
method to return the dangling label and assign that to the task. However, when this assignment is not saved it (and noTaskLabel
record is created), the following call to destroy dangling labels also removed the one just assigned to a task.This caused errors in tests, when switching from
labels
tolabel_names
in the TaskController specs to remove the use of unpermitted parameters and transactional fixtures.The new mechanism will still remove dangling labels, but only those associated with a TaskLabel just removed. Through the transactional setting of destroy hooks, this still ensures there aren't any leftovers.