In the first Ruby example, if Items.abc returns [(“a”, 0.7), (“b”, 0.2), (“c”, 0.1)], then items.collect(&:weight) will not return [0.7, 0.2, 0.1] as the author seems to expect. I suspect that he modified some of the code at some point, but forgot to update all of it.
Ruby has Enumerable#map  as well as Enumberable#collect.
Ruby’s Expectation gem  seems to do something very similar to Scala’s “expect” method.
While the general concept of custom assertions is sensible, this example doesn’t seem very sensible to me. At the very least, I think the assert_items method name should make mention of weight order e.g. assert_items_in_weight_order. I would also probably only have a few tests that compare arrays of items that would care about the weight ordering - I wouldn’t want all tests that compare arrays of items to be so strict otherwise you end up with very brittle tests.
 http://ruby-doc.org/core/classes/Enumerable.html#M003128  http://expectations.rubyforge.org/