From cdf861a23233afb955b3c722a73d9e6ac8de3942 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 10 Jul 2026 00:44:22 +0200 Subject: Fix stale assertions and escaped body in revisions#show MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The table-based markup revisions#show's own test was asserting against (, ) was retired when this view moved to the node_description/node_content pattern; updated the assertions to match. Found in the same pass: @page.body had no raw(), so any real markup in a revision's body rendered as escaped entities on this page — same bug class as revisions#diff, just not yet fixed here. --- app/views/revisions/show.html.erb | 2 +- test/controllers/revisions_controller_test.rb | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/app/views/revisions/show.html.erb b/app/views/revisions/show.html.erb index 4148096..92d959b 100644 --- a/app/views/revisions/show.html.erb +++ b/app/views/revisions/show.html.erb @@ -33,6 +33,6 @@
<%= @page.abstract %>
Body
-
<%= @page.body %>
+
<%= raw @page.body %>
diff --git a/test/controllers/revisions_controller_test.rb b/test/controllers/revisions_controller_test.rb index e2fc976..46fc220 100644 --- a/test/controllers/revisions_controller_test.rb +++ b/test/controllers/revisions_controller_test.rb @@ -28,21 +28,33 @@ class RevisionsControllerTest < ActionController::TestCase assert_response :success assert_select ".revision", 2 end - - test "showing one revision" do + + test "showing one revision" do login_as :quentin get :show, params: { :node_id => @node.id, :id => @node.pages.last.id } assert_response :success - assert_select "strong", "Body" - assert_select "td", {:count => 1, :text => "second"} + assert_select ".node_description", "Body" + assert_select ".node_content", {:count => 1, :text => "second"} end - + + test "showing a revision renders real markup in the body, not escaped entities" do + login_as :quentin + node = Node.root.children.create!(:slug => "show_markup_test") + draft = node.draft + draft.body = "

Hello

" + node.publish_draft! + + get :show, params: { :node_id => node.id, :id => node.head.id } + assert_response :success + assert_select ".node_content h3", "Hello" + end + test "diffing two revisions" do login_as :quentin post( :diff, params: { :node_id => @node.id, - :start_revision => @node.pages.first.revision, + :start_revision => @node.pages.first.revision, :end_revision => @node.pages.last.revision } ) -- cgit v1.3