From a9a9ae2cbb2facd6910338ef3d3c50f4ebee11da Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sat, 10 Jan 2015 12:40:41 +0000 Subject: [PATCH] Updated for changes in rails HTML testing --- test/controllers/diary_entry_controller_test.rb | 4 ++-- test/lib/rich_text_test.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/controllers/diary_entry_controller_test.rb b/test/controllers/diary_entry_controller_test.rb index ae978e6f9..32cab96cb 100644 --- a/test/controllers/diary_entry_controller_test.rb +++ b/test/controllers/diary_entry_controller_test.rb @@ -170,7 +170,7 @@ class DiaryEntryControllerTest < ActionController::TestCase assert_template 'diary_entry/view' assert_select "title", :text => /Users' diaries | /, :count => 1 assert_select "div.content-heading", :count => 1 do - assert_select "h2", :text => /#{entry.user.display_name}'s diary/, :count => 1 + assert_select "h2", :text => /#{entry.user.display_name}'s diary/, :count => 1 end assert_select "div#content", :count => 1 do assert_select "div.post_heading", :text => /#{new_title}/, :count => 1 @@ -189,7 +189,7 @@ class DiaryEntryControllerTest < ActionController::TestCase assert_template 'diary_entry/view' assert_select "title", :text => /Users' diaries | /, :count => 1 assert_select "div.content-heading", :count => 1 do - assert_select "h2", :text => /#{users(:normal_user).display_name}'s diary/, :count => 1 + assert_select "h2", :text => /#{users(:normal_user).display_name}'s diary/, :count => 1 end assert_select "div#content", :count => 1 do assert_select "div.post_heading", :text => /#{new_title}/, :count => 1 diff --git a/test/lib/rich_text_test.rb b/test/lib/rich_text_test.rb index e99d594a4..14e6f2196 100644 --- a/test/lib/rich_text_test.rb +++ b/test/lib/rich_text_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class RichTextTest < ActiveSupport::TestCase - include ActionDispatch::Assertions::SelectorAssertions + include Rails::Dom::Testing::Assertions::SelectorAssertions def test_html_to_html r = RichText.new("html", "foo http://example.com/ bar") @@ -152,7 +152,7 @@ class RichTextTest < ActiveSupport::TestCase r = RichText.new("text", "foo < bar & baz > qux") assert_html r do - assert_select "p", "foo < bar & baz > qux" + assert_select "p", "foo < bar & baz > qux" end end @@ -161,7 +161,7 @@ private def assert_html(richtext, &block) html = richtext.to_html assert html.html_safe? - root = HTML::Document.new(richtext.to_html, false, true).root + root = Nokogiri::HTML::DocumentFragment.parse(html) assert_select root, "*" do yield block end -- 2.43.2