document_root_element need to be public

This commit is contained in:
Rafael Mendonça França 2014-11-17 16:37:17 -02:00
parent ed8dc23e8e
commit 5b7b98d590
3 changed files with 10 additions and 9 deletions

@ -15,6 +15,7 @@ gem 'jquery-rails', '~> 4.0.0.beta2'
gem 'coffee-rails', '~> 4.1.0' gem 'coffee-rails', '~> 4.1.0'
gem 'turbolinks' gem 'turbolinks'
gem 'arel', github: 'rails/arel' gem 'arel', github: 'rails/arel'
gem 'rails-dom-testing', path: '~/src/rails/rails-dom-testing'
# require: false so bcrypt is loaded only when has_secure_password is used. # require: false so bcrypt is loaded only when has_secure_password is used.
# This is to avoid ActiveModel (and by extension the entire framework) # This is to avoid ActiveModel (and by extension the entire framework)

@ -679,6 +679,10 @@ def build_response(klass)
klass.new klass.new
end end
def document_root_element
html_document
end
included do included do
include ActionController::TemplateAssertions include ActionController::TemplateAssertions
include ActionDispatch::Assertions include ActionDispatch::Assertions
@ -688,10 +692,6 @@ def build_response(klass)
private private
def document_root_element
html_document
end
def check_required_ivars def check_required_ivars
# Sanity check for required instance variables so we can give an # Sanity check for required instance variables so we can give an
# understandable error message. # understandable error message.

@ -125,6 +125,11 @@ def rendered_views
@_rendered_views ||= RenderedViewsCollection.new @_rendered_views ||= RenderedViewsCollection.new
end end
# Need to experiment if this priority is the best one: rendered => output_buffer
def document_root_element
Nokogiri::HTML::DocumentFragment.parse(@rendered.blank? ? @output_buffer : @rendered)
end
class RenderedViewsCollection class RenderedViewsCollection
def initialize def initialize
@rendered_views ||= Hash.new { |hash, key| hash[key] = [] } @rendered_views ||= Hash.new { |hash, key| hash[key] = [] }
@ -156,11 +161,6 @@ def view_rendered?(view, expected_locals)
private private
# Need to experiment if this priority is the best one: rendered => output_buffer
def document_root_element
Nokogiri::HTML::DocumentFragment.parse(@rendered.blank? ? @output_buffer : @rendered)
end
def say_no_to_protect_against_forgery! def say_no_to_protect_against_forgery!
_helpers.module_eval do _helpers.module_eval do
remove_possible_method :protect_against_forgery? remove_possible_method :protect_against_forgery?