# File lib/shoulda/assertions.rb, line 6 6: def assert_same_elements(a1, a2, msg = nil) 7: [:select, :inject, :size].each do |m| 8: [a1, a2].each {|a| assert_respond_to(a, m, "Are you sure that #{a.inspect} is an array? It doesn't respond to #{m}.") } 9: end 10: 11: assert a1h = a1.inject({}) { |h,e| h[e] = a1.select { |i| i == e }.size; h } 12: assert a2h = a2.inject({}) { |h,e| h[e] = a2.select { |i| i == e }.size; h } 13: 14: assert_equal(a1h, a2h, msg) 15: end