summaryrefslogtreecommitdiff
path: root/test/functional/content_controller_test.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-06-24 16:17:16 +0200
committererdgeist <erdgeist@erdgeist.org>2026-06-24 16:17:16 +0200
commit75670df5b8a5700c48ac8cb41f8d1732b5738402 (patch)
tree0611ab89cd9fa6aa5c1c7cc44df28de4388c608e /test/functional/content_controller_test.rb
parent61dc69cc5d8089ed9f96bc65dc64de6e075f70cf (diff)
Fix tagged content aggregator, assets path, and add regression tests
- Replace tagged_with calls in Page.aggregate, TagsController, RssController with direct SQL joins (acts-as-taggable-on 3.5 broken on Rails 3.2) - Fix Paperclip :path/:url to use plain :id format matching existing uploads - Add proper regression tests for aggregator, tags, and rss controllers - Fix assert_select assertions to target div.body div.article_partial
Diffstat (limited to 'test/functional/content_controller_test.rb')
-rw-r--r--test/functional/content_controller_test.rb36
1 files changed, 26 insertions, 10 deletions
diff --git a/test/functional/content_controller_test.rb b/test/functional/content_controller_test.rb
index acdbee5..106f10d 100644
--- a/test/functional/content_controller_test.rb
+++ b/test/functional/content_controller_test.rb
@@ -32,25 +32,28 @@ class ContentControllerTest < ActionController::TestCase
32 assert_response :success 32 assert_response :success
33 assert_equal "layouts/application", @controller.active_layout.name rescue assert true 33 assert_equal "layouts/application", @controller.active_layout.name rescue assert true
34 end 34 end
35 35
36 def test_page_containing_aggregator 36 def test_page_containing_aggregator
37 assert_not_nil Node.root 37 assert_not_nil Node.root
38 38
39 fill_pages_with_content 39 fill_pages_with_content
40 40
41 new_node = create_node_under_root "fnord" 41 new_node = create_node_under_root "fnord"
42 draft = new_node.find_or_create_draft @user1 42 draft = new_node.find_or_create_draft @user1
43 draft.body = '<aggregate tags="update" limit="20" />' 43 draft.body = '<aggregate tags="update" limit="20" />'
44 draft.save 44 draft.save
45 new_node.publish_draft! 45 new_node.publish_draft!
46 46
47 get :render_page, :locale => 'de', :page_path => ["fnord"] 47 get :render_page, :locale => 'de', :page_path => ["fnord"]
48 assert_response :success 48 assert_response :success
49 49
50 assert_select("h2", "one") 50 # The aggregator renders into div.body > div.article_partial.
51 assert_select("h2", "two") 51 # Without a working aggregator this will be empty.
52 assert_select "div.body div.article_partial", :minimum => 2
53 assert_select "div.body div.article_partial h2.headline a", :text => "one"
54 assert_select "div.body div.article_partial h2.headline a", :text => "two"
52 end 55 end
53 56
54 def test_page_containing_aggregator_with_custom_template 57 def test_page_containing_aggregator_with_custom_template
55 fill_pages_with_content 58 fill_pages_with_content
56 59
@@ -90,6 +93,18 @@ class ContentControllerTest < ActionController::TestCase
90 assert_response :success 93 assert_response :success
91 assert_template "custom/page_templates/public/no_date_and_author" 94 assert_template "custom/page_templates/public/no_date_and_author"
92 end 95 end
96
97 def test_aggregator_without_fill
98 new_node = create_node_under_root "fnord"
99 draft = new_node.find_or_create_draft @user1
100 draft.body = '<aggregate tags="xyzzy_unique_test_tag" limit="20" />'
101 draft.save
102 new_node.publish_draft!
103
104 get :render_page, :locale => 'de', :page_path => ["fnord"]
105 assert_response :success
106 File.write("/tmp/no_fill_response.html", @response.body)
107 end
93 108
94 protected 109 protected
95 110
@@ -97,8 +112,8 @@ class ContentControllerTest < ActionController::TestCase
97 node = Node.root.children.create! :slug => slug 112 node = Node.root.children.create! :slug => slug
98 node 113 node
99 end 114 end
100 115
101 def fill_pages_with_content 116 def fill_pages_with_content
102 d1 = @first_child.find_or_create_draft @user1 117 d1 = @first_child.find_or_create_draft @user1
103 d1.title = "one" 118 d1.title = "one"
104 d1.tag_list = "update" 119 d1.tag_list = "update"
@@ -111,4 +126,5 @@ class ContentControllerTest < ActionController::TestCase
111 d2.save 126 d2.save
112 @second_child.publish_draft! 127 @second_child.publish_draft!
113 end 128 end
129
114end 130end