diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-08-09 15:45:56 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-08-09 15:45:56 +0200 |
| commit | 9d32458491d79f8e06a706375030c78282f4427b (patch) | |
| tree | 5eee208b844df39dfd66d9f0d1618fb5fa437fdb /test/controllers/revisions_controller_test.rb | |
| parent | ed3905b5409190c1e11c2c49c2163ac967c6d8b9 (diff) | |
Report every editorial attribute in the revision diff
diff_against gained external_url, published_at and user. The view renders
each metadata section only when that attribute changed, and says so once
when none did.
Metadata now precedes the locale pointer, which speaks only of translations:
above the metadata it read as "nothing changed" on a revision that had moved
the page.
Diffstat (limited to 'test/controllers/revisions_controller_test.rb')
| -rw-r--r-- | test/controllers/revisions_controller_test.rb | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/test/controllers/revisions_controller_test.rb b/test/controllers/revisions_controller_test.rb index 34f00a4f..d9f49e58 100644 --- a/test/controllers/revisions_controller_test.rb +++ b/test/controllers/revisions_controller_test.rb | |||
| @@ -151,19 +151,35 @@ class RevisionsControllerTest < ActionController::TestCase | |||
| 151 | assert_select "input[type='hidden'][name='end_revision'][value='draft']" | 151 | assert_select "input[type='hidden'][name='end_revision'][value='draft']" |
| 152 | end | 152 | end |
| 153 | 153 | ||
| 154 | test "diffing two revisions also shows tag, template, and asset changes" do | 154 | test "diffing shows tag, template, external URL and asset changes" do |
| 155 | login_as :quentin | 155 | login_as :quentin |
| 156 | find_or_create_draft(@node, @user) | 156 | find_or_create_draft(@node, @user) |
| 157 | @node.draft.tag_list = "update" | 157 | draft = @node.draft |
| 158 | @node.draft.save! | 158 | draft.tag_list = "update" |
| 159 | draft.template_name = "title_only" | ||
| 160 | draft.external_url = "https://example.org/" | ||
| 161 | draft.save! | ||
| 162 | draft.related_assets.create!(:asset => Asset.create!(:name => "diffed", | ||
| 163 | :upload_file_name => "diffed.png", | ||
| 164 | :upload_content_type => "image/png")) | ||
| 159 | 165 | ||
| 160 | post(:diff, params: { :node_id => @node.id, :start_revision => @node.pages.first.revision, :end_revision => @node.pages.last.revision }) | 166 | post(:diff, params: { :node_id => @node.id, :start_revision => @node.pages.first.revision, :end_revision => @node.pages.last.revision }) |
| 161 | assert_response :success | 167 | assert_response :success |
| 162 | assert_select "h3", Page.human_attribute_name(:tag_list) | 168 | assert_select "h3", Page.human_attribute_name(:tag_list) |
| 163 | assert_select "h3", Page.human_attribute_name(:template_name) | 169 | assert_select "h3", Page.human_attribute_name(:template_name) |
| 170 | assert_select "h3", Page.human_attribute_name(:external_url) | ||
| 164 | assert_select "h3", Page.human_attribute_name(:assets) | 171 | assert_select "h3", Page.human_attribute_name(:assets) |
| 165 | end | 172 | end |
| 166 | 173 | ||
| 174 | test "a diff with no metadata changes says so once" do | ||
| 175 | login_as :quentin | ||
| 176 | |||
| 177 | post(:diff, params: { :node_id => @node.id, :start_revision => @node.pages.first.revision, :end_revision => @node.pages.last.revision }) | ||
| 178 | assert_response :success | ||
| 179 | assert_select ".diff_meta .diff_unchanged" | ||
| 180 | assert_select ".diff_meta h3", false | ||
| 181 | end | ||
| 182 | |||
| 167 | test "revisions#index links back to the node" do | 183 | test "revisions#index links back to the node" do |
| 168 | login_as :quentin | 184 | login_as :quentin |
| 169 | get :index, params: { :node_id => @node.id } | 185 | get :index, params: { :node_id => @node.id } |
