aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/assertions/selector_assertions.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller/assertions/selector_assertions.rb')
-rw-r--r--actionpack/lib/action_controller/assertions/selector_assertions.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/assertions/selector_assertions.rb b/actionpack/lib/action_controller/assertions/selector_assertions.rb
index 05ca2bff15..7e9692be3f 100644
--- a/actionpack/lib/action_controller/assertions/selector_assertions.rb
+++ b/actionpack/lib/action_controller/assertions/selector_assertions.rb
@@ -66,6 +66,7 @@ module ActionController
raise ArgumentError, "First argument is either selector or element to select, but nil found. Perhaps you called assert_select with an element that does not exist?"
elsif @selected
matches = []
+
@selected.each do |selected|
subset = css_select(selected, HTML::Selector.new(arg.dup, args.dup))
subset.each do |match|
@@ -387,6 +388,7 @@ module ActionController
# any RJS statement.
if arg.is_a?(Symbol)
rjs_type = arg
+
if rjs_type == :insert
arg = args.shift
insertion = "insert_#{arg}".to_sym
@@ -433,6 +435,7 @@ module ActionController
""
end
end
+
if matches
if block_given? && !([:remove, :show, :hide, :toggle].include? rjs_type)
begin
@@ -563,9 +566,11 @@ module ActionController
# page, or from all the RJS statements, depending on the type of response.
def response_from_page_or_rjs()
content_type = @response.content_type
+
if content_type && content_type =~ /text\/javascript/
body = @response.body.dup
root = HTML::Node.new(nil)
+
while true
next if body.sub!(RJS_PATTERN_EVERYTHING) do |match|
html = unescape_rjs($3)
@@ -575,6 +580,7 @@ module ActionController
end
break
end
+
root
else
html_document.root
@@ -592,7 +598,6 @@ module ActionController
unescaped.gsub!(RJS_PATTERN_UNICODE_ESCAPED_CHAR) {|u| [$1.hex].pack('U*')}
unescaped
end
-
end
end
-end
+end \ No newline at end of file