You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not able to understand why this line using rightward assignment is reported as missing coverage:
It looks like it's treating the line as if it's a conditional without an else case, but as far as I'm aware there is no branching possible here. Ruby will throw an error if any of the properties are missing. You can see the behavior on this project. You should be able to clone it and run bundle && rake to produce coverage results.
The text was updated successfully, but these errors were encountered:
The missing branch is the one that raises NoMatchingPatternKeyError. You can treat that rightward assignment as a syntax sugar for something like this:
if%i[cardchecklistchecklist_items].all?{state.key?_1}# coveredcard,checklist,checklist_items= ...
else# uncoveredraiseNoMatchingPatternKeyError, ...
end
@viralpraxis thanks for the explanation. That strikes me as kind of odd, though. The way my code is structured, it is impossible for me to cover that case. I would have to stub some private behavior in my classes to return invalid data. There are lots of other places in Ruby that will cause an error if the shape of things is incorrect, but those don't report coverage failures. Things like passing keyword arguments to methods, or hash.fetch(:foo), which throws an error if the key is not present.
rake
I'm not able to understand why this line using rightward assignment is reported as missing coverage:
It looks like it's treating the line as if it's a conditional without an
else
case, but as far as I'm aware there is no branching possible here. Ruby will throw an error if any of the properties are missing. You can see the behavior on this project. You should be able to clone it and runbundle && rake
to produce coverage results.The text was updated successfully, but these errors were encountered: