summaryrefslogtreecommitdiff
path: root/test/controllers/shared_previews_controller_test.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-30 04:41:07 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-30 04:41:07 +0200
commit36a4194ee3013dfa834aa8d4d57b0bfacf724a1a (patch)
tree3f46fb04e6d6b38a7d3bef4d3ba1c98fb098a347 /test/controllers/shared_previews_controller_test.rb
parent6c62d0c538e6b8baa416a7ed901a74a66de44348 (diff)
Emit per-page Open Graph metadata
Replaces one hardcoded German description and an unrenderable SVG with per-page title, description, canonical URL, locale and publication date, plus the card variant or a site-wide default.
Diffstat (limited to 'test/controllers/shared_previews_controller_test.rb')
-rw-r--r--test/controllers/shared_previews_controller_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/controllers/shared_previews_controller_test.rb b/test/controllers/shared_previews_controller_test.rb
index 4ebc785f..6d4588a8 100644
--- a/test/controllers/shared_previews_controller_test.rb
+++ b/test/controllers/shared_previews_controller_test.rb
@@ -32,4 +32,19 @@ class SharedPreviewsControllerTest < ActionController::TestCase
32 32
33 assert_redirected_to node.head.public_link 33 assert_redirected_to node.head.public_link
34 end 34 end
35
36 test "a shared preview emits no social metadata and is not indexable" do
37 node = Node.root.children.create!(:slug => "shared_preview_no_og_test")
38 node.draft.update!(:title => "Unveröffentlichter Entwurf")
39 node.draft.ensure_preview_token!
40
41 get :show, params: { :token => node.draft.preview_token }
42
43 assert_response :success
44
45 # An unfurled preview link would otherwise hand the draft's title,
46 # abstract and headline image to everyone in the chat room.
47 assert_select "meta[property^='og:']", false, "a preview must emit no og tags"
48 assert_select "meta[name=robots][content=?]", "noindex, nofollow"
49 end
35end 50end