From 0ebae1dbc59c34f6b5ae87bf96b8848051a0254c Mon Sep 17 00:00:00 2001 From: Vishal Lal Date: Sat, 22 Mar 2014 22:50:55 +0000 Subject: [PATCH] Swapped parameters of assert_equal in assert_select --- actionpack/CHANGELOG.md | 7 +++++++ .../lib/action_dispatch/testing/assertions/selector.rb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index 59460cbe82ebe..fe5b38d29f064 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -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. diff --git a/actionpack/lib/action_dispatch/testing/assertions/selector.rb b/actionpack/lib/action_dispatch/testing/assertions/selector.rb index 3253a3d424c91..8a128427bf2aa 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/selector.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/selector.rb @@ -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