Permalink
Browse files

Merge pull request #14450 from vlal/vlal-rails

Incorrect values being printed by assert_select.
  • Loading branch information...
2 parents 9d44b3f + 0ebae1d commit bcf3a82f939075b4f4d63adc4b103a0cc8b0a76d @chancancode chancancode committed Mar 23, 2014
Showing with 8 additions and 1 deletion.
  1. +7 −0 actionpack/CHANGELOG.md
  2. +1 −1 actionpack/lib/action_dispatch/testing/assertions/selector.rb
@@ -1,3 +1,10 @@
+* Swapped the parameters of assert_equal in `assert_select` so that the
+ proper values were printed correctly
+
+ Fixes #14422.
+
+ *Vishal Lal*
+
* The method `shallow?` returns false if the parent resource is a singleton so
we need to check if we're not inside a nested scope before copying the :path
and :as options to their shallow equivalents.
@@ -291,7 +291,7 @@ def assert_select(*args, &block)
# so is this custom message really needed?
message = message || %(Expected #{count_description(min, max, count)} matching "#{selector.to_s}", found #{matches.size}.)
if count
- assert_equal matches.size, count, message
+ assert_equal count, matches.size, message
else
assert_operator matches.size, :>=, min, message if min
assert_operator matches.size, :<=, max, message if max

0 comments on commit bcf3a82

Please sign in to comment.