From 4c944e45332865ae8f2a17287268394b7a88cfdf Mon Sep 17 00:00:00 2001 From: Michael Grosser Date: Mon, 14 Mar 2016 22:18:06 -0700 Subject: [PATCH] fix assert_select wanting something to call .css on --- lib/prototype-rails/selector_assertions.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/prototype-rails/selector_assertions.rb b/lib/prototype-rails/selector_assertions.rb index c482fce..49703b1 100644 --- a/lib/prototype-rails/selector_assertions.rb +++ b/lib/prototype-rails/selector_assertions.rb @@ -126,9 +126,15 @@ def assert_select_rjs(*args, &block) if matches assert true # to count the assertion if block_given? && !([:remove, :show, :hide, :toggle].include? rjs_type) + to_select = if ActionPack::VERSION::STRING > "4.2.0" + Nokogiri::HTML(matches.map(&:to_s).join) + else + matches + end + begin @selected ||= nil - in_scope, @selected = @selected, matches + in_scope, @selected = @selected, to_select yield matches ensure @selected = in_scope @@ -146,7 +152,7 @@ def assert_select_rjs(*args, &block) flunk args.shift || flunk_message end end - + protected RJS_PATTERN_HTML = "\"((\\\\\"|[^\"])*)\""