Permalink
Browse files

words

  • Loading branch information...
1 parent 1d41ff1 commit a209886a3b5ba811d76119255c353c709b4de7d5 @dchelimsky committed Apr 6, 2009
Showing with 6 additions and 5 deletions.
  1. +1 −0 History.rdoc
  2. +5 −5 lib/spec/matchers/match_array.rb
View
@@ -23,6 +23,7 @@
* bug fixes
* support expectations on DelegateClass (Clifford T. Matthews). Closes #48.
+ * Fixed match_array blows up if elements can't be sorted (Jeff Dean). Closes #779.
=== Version 1.2.2 / 2009-03-22
@@ -16,10 +16,10 @@ def matches?(actual)
end
def failure_message_for_should
- message = "expected collection contained: #{safely_sort(@expected).inspect}\n"
- message += "actual collection contained: #{safely_sort(@actual).inspect}\n"
- message += "the missing elements were: #{safely_sort(@missing_items).inspect}\n" unless @missing_items.empty?
- message += "the extra elements were: #{safely_sort(@extra_items).inspect}\n" unless @extra_items.empty?
+ message = "expected collection contained: #{safe_sort(@expected).inspect}\n"
+ message += "actual collection contained: #{safe_sort(@actual).inspect}\n"
+ message += "the missing elements were: #{safe_sort(@missing_items).inspect}\n" unless @missing_items.empty?
+ message += "the extra elements were: #{safe_sort(@extra_items).inspect}\n" unless @extra_items.empty?
message
end
@@ -33,7 +33,7 @@ def description
private
- def safely_sort(array)
+ def safe_sort(array)
array.all?{|item| item.respond_to?(:<=>)} ? array.sort : array
end

0 comments on commit a209886

Please sign in to comment.