instance method response_from_page_or_rjs

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

response_from_page_or_rjs()

assert_select and css_select call this to obtain the content in the HTML page, or from all the RJS statements, depending on the type of response.

Source
# File actionpack/lib/action_controller/assertions/selector_assertions.rb, line 590
        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_STATEMENTS[:any]) do |match|
                html = unescape_rjs(match)
                matches = HTML::Document.new(html).root.children.select { |n| n.tag? }
                root.children.concat matches
                ""
              end
              break
            end

            root
          else
            html_document.root
          end
        end

Defined in actionpack/lib/action_controller/assertions/selector_assertions.rb line 590 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionController::Assertions::SelectorAssertions

Type at least 2 characters to search.

↑↓ navigate · open · esc close