Skip to content

Commit 6fc60c9

Browse files
committed
Publicize document_root_element.
1 parent ebb988c commit 6fc60c9

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lib/rails/dom/testing/assertions/selector_assertions.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,14 @@ def assert_select_email(&block)
258258
end
259259
end
260260

261+
def document_root_element
262+
raise NotImplementedError, 'Implementing document_root_element makes ' \
263+
'assert_select work without needing to specify an element to select from.'
264+
end
265+
261266
private
262267
include CountDescripable
263268

264-
def document_root_element
265-
raise NotImplementedError, 'Implementing document_root_element makes ' \
266-
'assert_select work without needing to specify an element to select from.'
267-
end
268-
269269
# +equals+ must contain :minimum, :maximum and :count keys
270270
def assert_size_match!(size, equals, css_selector, message = nil)
271271
min, max, count = equals[:minimum], equals[:maximum], equals[:count]

lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def extract_root(rootable, previous_selection)
6363
elsif previous_selection
6464
previous_selection
6565
else
66-
rootable.send :document_root_element
66+
rootable.document_root_element
6767
end
6868
end
6969

test/selector_assertions_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,10 @@ def test_body_not_present_in_empty_document
284284
assert_select 'body', 0
285285
end
286286

287+
def document_root_element
288+
@html_document
289+
end
290+
287291
protected
288292
def render_html(html)
289293
fake_render(:html, html)
@@ -300,8 +304,4 @@ def fake_render(content_type, content)
300304
Nokogiri::HTML::DocumentFragment.parse(content)
301305
end
302306
end
303-
304-
def document_root_element
305-
@html_document
306-
end
307307
end

0 commit comments

Comments
 (0)