ruby icon indicating copy to clipboard operation
ruby copied to clipboard

palindome-products: confusing test assertion

Open jdsutherland opened this issue 6 years ago • 2 comments

I started working on this exercise and noticed something fishy about the first test case: https://github.com/exercism/ruby/blob/66c5ebe6e30e740785de75fc5440588803a62a19/exercises/palindrome-products/palindrome_products_test.rb#L10

I haven't completed the exercise yet (so I don't have a worked out understanding of why this might have been done) but it seems odd that the products are repeated and this seems to differ from other tracks: javascript

python

go

jdsutherland avatar Mar 10 '19 04:03 jdsutherland

I originally overlooked that this is using an assert_includes (rather than equals). I'm guessing that this is failures due to array ordering. I'm not used to using minitest so maybe this is standard looking stuff.

I would argue that it's a bit confusing as it's the first test the reader is likely to see while in that initial state of trying to figure out what the problem output is expecting and it isn't immediately obvious that the array is repeated due to test framework details (IIRC, RSpec's match_array works independent of ordering).

Perhaps this confusion can be reduced by making this test work independent of array ordering similar to the other tracks?

jdsutherland avatar Mar 10 '19 10:03 jdsutherland

See #305 for some backstory.

kotp avatar Jun 14 '19 22:06 kotp

Palindrome Products is now a part of the problem-specifications (language-agnostic test instructions and test cases), here: https://github.com/exercism/problem-specifications/tree/main/exercises/palindrome-products

The exercise has undergone significant improvements in the past few years and this repository is up-to-date with the current changes as of this date.

I am going to go ahead and close this issue.

kytrinyx avatar Oct 12 '22 22:10 kytrinyx