typo 5.4.4 → 5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. data/CHANGELOG +59 -28
  2. data/MAINTAINERS +9 -17
  3. data/README +28 -20
  4. data/UPGRADE +6 -2
  5. data/app/controllers/accounts_controller.rb +1 -1
  6. data/app/controllers/admin/content_controller.rb +1 -1
  7. data/app/controllers/admin/feedback_controller.rb +3 -3
  8. data/app/controllers/admin/pages_controller.rb +2 -0
  9. data/app/controllers/application_controller.rb +6 -1
  10. data/app/controllers/articles_controller.rb +13 -1
  11. data/app/helpers/application_helper.rb +5 -2
  12. data/app/helpers/authors_helper.rb +14 -3
  13. data/app/models/article.rb +6 -4
  14. data/app/models/blog.rb +0 -4
  15. data/app/models/blog_sweeper.rb +1 -1
  16. data/app/models/content.rb +10 -5
  17. data/app/models/page_cache.rb +6 -7
  18. data/app/models/user.rb +1 -0
  19. data/app/views/admin/content/_form.html.erb +13 -11
  20. data/app/views/admin/content/_images.html.erb +1 -1
  21. data/app/views/admin/content/_simple_editor.html.erb +1 -0
  22. data/app/views/admin/content/_visual_editor.html.erb +1 -0
  23. data/app/views/admin/dashboard/_overview.html.erb +7 -7
  24. data/app/views/admin/pages/_form.html.erb +1 -0
  25. data/app/views/admin/pages/_images.html.erb +18 -0
  26. data/app/views/admin/pages/_simple_editor.html.erb +1 -2
  27. data/app/views/admin/pages/_visual_editor.html.erb +2 -1
  28. data/app/views/admin/pages/index.html.erb +1 -1
  29. data/app/views/admin/settings/feedback.html.erb +2 -1
  30. data/app/views/admin/tags/edit.html.erb +1 -1
  31. data/app/views/articles/_article.html.erb +17 -13
  32. data/app/views/articles/_article_content.html.erb +1 -0
  33. data/app/views/articles/_comment_box.html.erb +1 -1
  34. data/app/views/articles/_password_form.html.erb +10 -0
  35. data/app/views/articles/groupings.html.erb +1 -1
  36. data/app/views/articles/index.html.erb +1 -2
  37. data/app/views/articles/read.html.erb +1 -4
  38. data/app/views/articles/search.html.erb +1 -1
  39. data/app/views/layouts/administration.html.erb +1 -1
  40. data/app/views/shared/_search.html.erb +1 -1
  41. data/config/ckeditor.yml +14 -0
  42. data/config/environment.rb +13 -25
  43. data/config/environments/test.rb +1 -3
  44. data/config/filemanager.yml +16 -0
  45. data/config/initializers/access_rules.rb +5 -0
  46. data/config/routes.rb +5 -1
  47. data/db/migrate/004_add_sidebars.rb +3 -9
  48. data/db/migrate/089_drop_cache_information_table.rb +31 -0
  49. data/db/migrate/090_remove_keywords_from_posts.rb +9 -0
  50. data/db/migrate/091_adds_password_protection_to_posts.rb +9 -0
  51. data/doc/CACHE.SETUP.README +36 -0
  52. data/lang/de_DE.rb +6 -1
  53. data/lang/pl_PL.rb +221 -89
  54. data/lib/filemanager.rb +53 -0
  55. data/lib/filemanager/controller.rb +217 -0
  56. data/lib/i18n_interpolation_deprecation.rb +26 -0
  57. data/lib/rails_patch/active_support.rb +4 -0
  58. data/lib/tasks/release.rake +4 -131
  59. data/lib/typo_version.rb +1 -1
  60. data/public/.htaccess +6 -5
  61. data/public/filemanager/images/avi.gif +0 -0
  62. data/public/filemanager/images/box.gif +0 -0
  63. data/public/filemanager/images/bullet.gif +0 -0
  64. data/public/filemanager/images/close.gif +0 -0
  65. data/public/filemanager/images/closelabel.gif +0 -0
  66. data/public/filemanager/images/doc.gif +0 -0
  67. data/public/filemanager/images/donate-button.gif +0 -0
  68. data/public/filemanager/images/download-icon.gif +0 -0
  69. data/public/filemanager/images/folder.gif +0 -0
  70. data/public/filemanager/images/gif.gif +0 -0
  71. data/public/filemanager/images/htm.gif +0 -0
  72. data/public/filemanager/images/html.gif +0 -0
  73. data/public/filemanager/images/image-1.jpg +0 -0
  74. data/public/filemanager/images/image.gif +0 -0
  75. data/public/filemanager/images/jpg.gif +0 -0
  76. data/public/filemanager/images/loading.gif +0 -0
  77. data/public/filemanager/images/mov.gif +0 -0
  78. data/public/filemanager/images/nextlabel.gif +0 -0
  79. data/public/filemanager/images/pdf.gif +0 -0
  80. data/public/filemanager/images/png.gif +0 -0
  81. data/public/filemanager/images/ppt.gif +0 -0
  82. data/public/filemanager/images/prevlabel.gif +0 -0
  83. data/public/filemanager/images/rar.gif +0 -0
  84. data/public/filemanager/images/rm.gif +0 -0
  85. data/public/filemanager/images/rmvb.gif +0 -0
  86. data/public/filemanager/images/separator.gif +0 -0
  87. data/public/filemanager/images/spacer.gif +0 -0
  88. data/public/filemanager/images/swf.gif +0 -0
  89. data/public/filemanager/images/thumb-1.jpg +0 -0
  90. data/public/filemanager/images/tool_copy.gif +0 -0
  91. data/public/filemanager/images/tool_cut.gif +0 -0
  92. data/public/filemanager/images/tool_del.gif +0 -0
  93. data/public/filemanager/images/tool_folder.gif +0 -0
  94. data/public/filemanager/images/tool_imagemanager.gif +0 -0
  95. data/public/filemanager/images/tool_new.gif +0 -0
  96. data/public/filemanager/images/tool_paste.gif +0 -0
  97. data/public/filemanager/images/tool_props.gif +0 -0
  98. data/public/filemanager/images/tool_refresh.gif +0 -0
  99. data/public/filemanager/images/tool_unzip.gif +0 -0
  100. data/public/filemanager/images/tool_upload.gif +0 -0
  101. data/public/filemanager/images/tool_zip.gif +0 -0
  102. data/public/filemanager/images/txt.gif +0 -0
  103. data/public/filemanager/images/unknown.gif +0 -0
  104. data/public/filemanager/images/wmv.gif +0 -0
  105. data/public/filemanager/images/xls.gif +0 -0
  106. data/public/filemanager/images/zip.gif +0 -0
  107. data/public/filemanager/javascripts/filemanager.js +6 -0
  108. data/public/filemanager/javascripts/lang/en.js +31 -0
  109. data/public/filemanager/javascripts/lang/zh_CN.js +31 -0
  110. data/public/filemanager/javascripts/lightbox.js +497 -0
  111. data/public/filemanager/javascripts/translate.js +42 -0
  112. data/public/filemanager/resources/resources.txt +1 -0
  113. data/public/filemanager/stylesheets/filelist.css +147 -0
  114. data/public/filemanager/stylesheets/general.css +135 -0
  115. data/public/filemanager/stylesheets/lightbox.css +27 -0
  116. data/public/javascripts/prototype_ext.js +117 -0
  117. data/public/stylesheets/administration.css +19 -2
  118. data/themes/dirtylicious/views/articles/_article.html.erb +16 -12
  119. data/themes/dirtylicious/views/articles/_article_content.html.erb +1 -0
  120. data/themes/dirtylicious/views/articles/_password_form.html.erb +10 -0
  121. data/themes/scribbish/views/articles/_article.html.erb +18 -14
  122. data/themes/scribbish/views/articles/_article_content.html.erb +1 -0
  123. data/themes/scribbish/views/articles/_password_form.html.erb +10 -0
  124. data/themes/standard_issue/views/articles/_article.html.erb +16 -12
  125. data/themes/standard_issue/views/articles/_article_content.html.erb +1 -0
  126. data/themes/standard_issue/views/articles/_password_form.html.erb +10 -0
  127. data/themes/true-blue-3/helpers/theme_helper.rb +2 -2
  128. data/themes/true-blue-3/images/submit_form.jpg +0 -0
  129. data/themes/true-blue-3/stylesheets/style.css +27 -3
  130. data/themes/true-blue-3/views/articles/_article.html.erb +13 -8
  131. data/themes/true-blue-3/views/articles/_article_content.html.erb +1 -0
  132. data/themes/true-blue-3/views/articles/_comment_form.html.erb +1 -1
  133. data/themes/true-blue-3/views/articles/_password_form.html.erb +10 -0
  134. data/themes/true-blue-3/views/categories/_article.html.erb +5 -0
  135. data/themes/true-blue-3/views/tags/_article.html.erb +4 -0
  136. data/themes/typographic/views/articles/_article.html.erb +16 -12
  137. data/themes/typographic/views/articles/_article_content.html.erb +1 -0
  138. data/themes/typographic/views/articles/_password_form.html.erb +10 -0
  139. data/vendor/plugins/easy-ckeditor/app/controllers/ckeditor_controller.rb +2 -1
  140. data/vendor/plugins/easy-ckeditor/lib/ckeditor.rb +1 -20
  141. data/vendor/plugins/easy-ckeditor/{tasks → lib/tasks}/ckeditor_tasks.rake +0 -0
  142. data/vendor/plugins/filemanager/app/controllers/fm/filemanager_controller.rb +22 -0
  143. data/vendor/plugins/filemanager/app/views/fm/filemanager/index.html.erb +512 -0
  144. data/vendor/plugins/filemanager/app/views/fm/filemanager/view.html.erb +67 -0
  145. data/vendor/plugins/filemanager/filemanager.yml +16 -0
  146. data/vendor/plugins/static_sidebar/lib/static_sidebar.rb +4 -2
  147. data/vendor/plugins/typo_converter/{tasks → lib/tasks}/typo_converters_tasks.rake +0 -0
  148. data/vendor/plugins/typo_login_system/lib/access_control.rb +24 -1
  149. data/vendor/plugins/typo_textfilter_code/{tasks → lib/tasks}/typo_textfilter_code_tasks.rake +0 -0
  150. data/vendor/plugins/typo_textfilter_code/lib/typo_textfilter_code.rb +4 -3
  151. data/vendor/plugins/typo_textfilter_flickr/{tasks → lib/tasks}/typo_textfilter_flickr_tasks.rake +0 -0
  152. data/vendor/plugins/typo_textfilter_htmlfilter/{tasks → lib/tasks}/typo_textfilter_htmlfilter_tasks.rake +0 -0
  153. data/vendor/plugins/typo_textfilter_lightbox/{tasks → lib/tasks}/typo_textfilter_lightbox_tasks.rake +0 -0
  154. data/vendor/plugins/typo_textfilter_markdown/{tasks → lib/tasks}/typo_textfilter_markdown_tasks.rake +0 -0
  155. data/vendor/plugins/typo_textfilter_none/{tasks → lib/tasks}/typo_textfilter_none_tasks.rake +0 -0
  156. data/vendor/plugins/typo_textfilter_smartypants/{tasks → lib/tasks}/typo_textfilter_smartypants_tasks.rake +0 -0
  157. data/vendor/plugins/typo_textfilter_textile/{tasks → lib/tasks}/typo_textfilter_textile_tasks.rake +0 -0
  158. data/vendor/plugins/typo_textfilter_textile_and_markdown/{tasks → lib/tasks}/typo_textfilter_textile_and_markdown_tasks.rake +0 -0
  159. data/vendor/plugins/xml_sidebar/views/content.rhtml +1 -1
  160. metadata +190 -195
  161. data/app/controllers/admin/cache_controller.rb +0 -9
  162. data/app/models/cache_information.rb +0 -19
  163. data/db/schema.rb +0 -242
  164. data/doc/test_themes.rb +0 -50
  165. data/public/javascripts/ckeditor/config.js +0 -27
  166. data/spec/controllers/accounts_controller_spec.rb +0 -414
  167. data/spec/controllers/admin/cache_controller_spec.rb +0 -18
  168. data/spec/controllers/admin/categories_controller_spec.rb +0 -73
  169. data/spec/controllers/admin/content_controller_spec.rb +0 -443
  170. data/spec/controllers/admin/dashboard_controller_spec.rb +0 -13
  171. data/spec/controllers/admin/feedback_controller_spec.rb +0 -308
  172. data/spec/controllers/admin/pages_controller_spec.rb +0 -80
  173. data/spec/controllers/admin/profiles_controller_spec.rb +0 -22
  174. data/spec/controllers/admin/resources_controller_spec.rb +0 -53
  175. data/spec/controllers/admin/settings_controller_spec.rb +0 -80
  176. data/spec/controllers/admin/tags_controller_spec.rb +0 -64
  177. data/spec/controllers/admin/textfilters_controller_spec.rb +0 -20
  178. data/spec/controllers/admin/themes_controller_spec.rb +0 -30
  179. data/spec/controllers/admin/users_controller_spec.rb +0 -109
  180. data/spec/controllers/application_controller_spec.rb +0 -18
  181. data/spec/controllers/articles_controller_spec.rb +0 -440
  182. data/spec/controllers/authors_controller_spec.rb +0 -42
  183. data/spec/controllers/backend_controller_spec.rb +0 -337
  184. data/spec/controllers/categories_controller_spec.rb +0 -117
  185. data/spec/controllers/comments_controller_spec.rb +0 -137
  186. data/spec/controllers/routes/articles_routing_spec.rb +0 -31
  187. data/spec/controllers/routes/xml_routing_spec.rb +0 -71
  188. data/spec/controllers/setup_controller_spec.rb +0 -24
  189. data/spec/controllers/tags_controller_spec.rb +0 -147
  190. data/spec/controllers/textfilter_controller_spec.rb +0 -192
  191. data/spec/controllers/theme_controller_spec.rb +0 -39
  192. data/spec/controllers/xml_controller_spec.rb +0 -185
  193. data/spec/factories.rb +0 -69
  194. data/spec/helpers/application_helper_spec.rb +0 -25
  195. data/spec/helpers/content_helper_spec.rb +0 -28
  196. data/spec/lib/text_filter_plugin_spec.rb +0 -15
  197. data/spec/models/amazon_sidebar_spec.rb +0 -40
  198. data/spec/models/article_closing_spec.rb +0 -42
  199. data/spec/models/article_spec.rb +0 -515
  200. data/spec/models/blog_spec.rb +0 -116
  201. data/spec/models/cache_information_spec.rb +0 -42
  202. data/spec/models/cache_support_spec.rb +0 -51
  203. data/spec/models/category_spec.rb +0 -44
  204. data/spec/models/comment_spec.rb +0 -240
  205. data/spec/models/configuration_spec.rb +0 -91
  206. data/spec/models/content_state/feedback_states_spec.rb +0 -64
  207. data/spec/models/notification_spec.rb +0 -8
  208. data/spec/models/page_cache_spec.rb +0 -30
  209. data/spec/models/page_spec.rb +0 -91
  210. data/spec/models/ping_pinger_spec.rb +0 -33
  211. data/spec/models/ping_spec.rb +0 -154
  212. data/spec/models/redirect_spec.rb +0 -17
  213. data/spec/models/resource_spec.rb +0 -39
  214. data/spec/models/route_cache_spec.rb +0 -11
  215. data/spec/models/sidebar_spec.rb +0 -7
  216. data/spec/models/static_sidebar_spec.rb +0 -17
  217. data/spec/models/tag_spec.rb +0 -65
  218. data/spec/models/text_filter_spec.rb +0 -34
  219. data/spec/models/theme_spec.rb +0 -45
  220. data/spec/models/trackback_spec.rb +0 -60
  221. data/spec/models/trigger_spec.rb +0 -40
  222. data/spec/models/user_spec.rb +0 -198
  223. data/spec/rcov.opts +0 -2
  224. data/spec/spec.opts +0 -4
  225. data/spec/spec_helper.rb +0 -133
  226. data/spec/views/articles/index_spec.rb +0 -63
  227. data/spec/views/articles/read_spec.rb +0 -67
  228. data/spec/views/comments/html_sanitization_spec.rb +0 -119
  229. data/test/fixtures/blogs.yml +0 -27
  230. data/test/fixtures/categories.yml +0 -29
  231. data/test/fixtures/categorizations.yml +0 -31
  232. data/test/fixtures/contents.yml +0 -231
  233. data/test/fixtures/feedback.yml +0 -180
  234. data/test/fixtures/notification_mailer/article +0 -3
  235. data/test/fixtures/notification_mailer/comment +0 -3
  236. data/test/fixtures/notification_mailer/trackback +0 -3
  237. data/test/fixtures/notifications.yml +0 -0
  238. data/test/fixtures/page_caches.yml +0 -7
  239. data/test/fixtures/profiles.yml +0 -27
  240. data/test/fixtures/redirects.yml +0 -10
  241. data/test/fixtures/resources.yml +0 -21
  242. data/test/fixtures/sidebars.yml +0 -10
  243. data/test/fixtures/tags.yml +0 -10
  244. data/test/fixtures/text_filters.yml +0 -37
  245. data/test/fixtures/triggers.yml +0 -1
  246. data/test/fixtures/users.yml +0 -101
  247. data/test/mocks/test/dns_mock.rb +0 -13
  248. data/test/mocks/test/flickr_mock.rb +0 -30
  249. data/test/mocks/test/http_mock.rb +0 -39
  250. data/test/mocks/test/theme_mock.rb +0 -5
  251. data/test/mocks/test/xmlrpc_mock.rb +0 -28
  252. data/test/mocks/themes/123-numbers-in-path/about.markdown +0 -0
  253. data/test/mocks/themes/CamelCaseDirectory/about.markdown +0 -0
  254. data/test/mocks/themes/i-have-special-chars/about.markdown +0 -0
  255. data/test/mocks/themes/typographic/about.markdown +0 -7
  256. data/test/mocks/themes/typographic/images/Thumbs.db +0 -0
  257. data/test/mocks/themes/typographic/images/accept.png +0 -0
  258. data/test/mocks/themes/typographic/images/accept50.png +0 -0
  259. data/test/mocks/themes/typographic/images/bg_body.jpg +0 -0
  260. data/test/mocks/themes/typographic/images/bg_white.png +0 -0
  261. data/test/mocks/themes/typographic/images/bg_wrapper.jpg +0 -0
  262. data/test/mocks/themes/typographic/images/bullet_bottom.png +0 -0
  263. data/test/mocks/themes/typographic/images/bullet_right.png +0 -0
  264. data/test/mocks/themes/typographic/images/email_open.png +0 -0
  265. data/test/mocks/themes/typographic/images/email_open50.png +0 -0
  266. data/test/mocks/themes/typographic/images/meta.png +0 -0
  267. data/test/mocks/themes/typographic/images/page_edit.png +0 -0
  268. data/test/mocks/themes/typographic/images/page_edit50.png +0 -0
  269. data/test/mocks/themes/typographic/images/tag.png +0 -0
  270. data/test/mocks/themes/typographic/images/user.png +0 -0
  271. data/test/mocks/themes/typographic/images/user50.png +0 -0
  272. data/test/mocks/themes/typographic/images/world_link.png +0 -0
  273. data/test/mocks/themes/typographic/images/world_link50.png +0 -0
  274. data/test/mocks/themes/typographic/layouts/default.html.erb +0 -42
  275. data/test/mocks/themes/typographic/preview.png +0 -0
  276. data/test/mocks/themes/typographic/stylesheets/colors.css +0 -51
  277. data/test/mocks/themes/typographic/stylesheets/layout.css +0 -346
  278. data/test/mocks/themes/typographic/stylesheets/reset.css +0 -5
  279. data/test/mocks/themes/typographic/stylesheets/style.css +0 -36
  280. data/test/mocks/themes/typographic/views/articles/_article.html.erb +0 -41
  281. data/test/mocks/themes/typographic/views/articles/_comment.html.erb +0 -14
  282. data/test/mocks/themes/typographic/views/articles/_comment_form.html.erb +0 -48
  283. data/test/mocks/themes/typographic/views/articles/_comment_list.html.erb +0 -7
  284. data/test/mocks/themes/typographic/views/articles/_trackback.html.erb +0 -9
  285. data/test/mocks/themes/typographic/views/articles/comment_preview.html.erb +0 -10
  286. data/test/mocks/themes/typographic/views/articles/index.html.erb +0 -5
  287. data/test/mocks/themes/typographic/views/articles/read.html.erb +0 -42
  288. data/test/mocks/themes/typographic/views/shared/_search.html.erb +0 -17
  289. data/test/mocks/themes/typographic/views/theme/static_view_test.html.erb +0 -1
  290. data/test/test_helper.rb +0 -13
  291. data/themes/true-blue-3/images/frederic-de-villamil.jpg +0 -0
  292. data/themes/true-blue-3/images/textarea_bg.jpg +0 -0
@@ -1,116 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe "Given the first Blog fixture" do
4
- before(:each) {
5
- Blog.destroy_all
6
- RouteCache.clear
7
- @blog = Factory.create :blog
8
- }
9
-
10
- it ":blog_name == 'test blog'" do
11
- @blog.blog_name.should == 'test blog'
12
- end
13
-
14
- it "values boolify like Perl" do
15
- {"0 but true" => true, "" => false,
16
- "false" => false, 1 => true, 0 => false,
17
- nil => false, 'f' => false }.each do |value, expected|
18
- @blog.sp_global = value
19
- @blog.sp_global.should == expected
20
- end
21
- end
22
-
23
- describe "running in the host root" do
24
- it ":base_url == 'http://myblog.net/'" do
25
- @blog.base_url.should == 'http://myblog.net'
26
- end
27
-
28
- describe "blog.url_for" do
29
- it "should return the correct URL for a hash argument" do
30
- @blog.url_for(:controller => 'articles', :action => 'read', :id => 1).should == 'http://myblog.net/articles/read/1'
31
- end
32
- it "should return the correct URL for a hash argument with only_path" do
33
- @blog.base_url.should == 'http://myblog.net'
34
- @blog.url_for(:controller => 'articles', :action => 'read', :id => 1,
35
- :only_path => true).should == '/articles/read/1'
36
- end
37
- it "should return the correct URL for a string argument" do
38
- @blog.url_for('articles/read/1').should == 'http://myblog.net/articles/read/1'
39
- end
40
- it "should return the correct URL for a hash argument with only_path" do
41
- @blog.url_for('articles/read/1', :only_path => true).should == '/articles/read/1'
42
- end
43
- end
44
- end
45
-
46
- describe "running in a sub-URI" do
47
- before :each do
48
- @blog.base_url = 'http://myblog.net/sub-uri'
49
- end
50
-
51
- describe "blog.url_for" do
52
- it "should return the correct URL for a hash argument" do
53
- @blog.url_for(:controller => 'articles', :action => 'read',
54
- :id => 1).should == 'http://myblog.net/sub-uri/articles/read/1'
55
- end
56
- it "should return the correct URL for a hash argument with only_path" do
57
- @blog.url_for(:controller => 'articles', :action => 'read', :id => 1,
58
- :only_path => true).should == '/sub-uri/articles/read/1'
59
- end
60
- it "should return the correct URL for a string argument" do
61
- @blog.url_for('articles/read/1'
62
- ).should == 'http://myblog.net/sub-uri/articles/read/1'
63
- end
64
- it "should return the correct URL for a hash argument with only_path" do
65
- @blog.url_for('articles/read/1',
66
- :only_path => true).should == '/sub-uri/articles/read/1'
67
- end
68
- end
69
- end
70
- it "should be the only blog allowed" do
71
- Blog.new.should_not be_valid
72
- end
73
- end
74
-
75
- describe "The default blog" do
76
- it "should pick up updates after a cache clear" do
77
- a = Blog.default
78
- b = blogs(:default)
79
- b.blog_name = "some other name"
80
- c = Blog.default
81
- c.blog_name.should == "some other name"
82
- end
83
- end
84
-
85
-
86
- describe "Given no blogs" do
87
- before(:each) { Blog.destroy_all }
88
-
89
- it "should allow the creation of a valid default blog" do
90
- Blog.new.should be_valid
91
- end
92
- end
93
-
94
- describe "Valid permalink in blog" do
95
-
96
- before :each do
97
- @blog = blogs(:default)
98
- end
99
-
100
- ['foo', 'year', 'day', 'month', 'title', '%title', 'title%', '/year/month/day/title', '%title%.html.atom', '%title%.html.rss'].each do |permalink_type|
101
- it "not valid with #{permalink_type}" do
102
- assert_raise ActiveRecord::RecordInvalid do
103
- @blog.permalink_format = permalink_type
104
- end
105
- end
106
- end
107
-
108
- ['%year%', '%day%', '%month%', '%title%', '%title%.html', '/hello/all/%year%/%title%', 'atom/%title%.html', 'ok/rss/%title%.html'].each do |permalink_type|
109
- it "should be valid with only #{permalink_type}" do
110
- assert_nothing_raised ActiveRecord::RecordInvalid do
111
- @blog.permalink_format = permalink_type
112
- end
113
- end
114
- end
115
-
116
- end
@@ -1,42 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe CacheInformation do
4
-
5
- def cache_information(options={})
6
- CacheInformation.new({:path => '/index.html'}.merge(options))
7
- end
8
-
9
- it 'should have path attribute' do
10
- CacheInformation.new.should respond_to(:path)
11
- end
12
-
13
- it 'should be valid' do
14
- cache_information.should be_valid
15
- end
16
-
17
- it 'should not save without path' do
18
- cache_information(:path => nil).should_not be_valid
19
- end
20
-
21
- it 'should have path unique' do
22
- cache_information.save
23
- cache_information.should_not be_valid
24
- end
25
-
26
- it 'should destroy file in path when destroy' do
27
- file_path = create_file_in_spec_public_cache_directory('index.html')
28
- CacheInformation.create!(:path => '/index.html').destroy
29
- File.should_not be_exist(file_path)
30
- end
31
-
32
- it "should destroy himself if path doesn't exist" do
33
- CacheInformation.create!(:path => '/index.html').destroy
34
- CacheInformation.find_by_path('/index.html').should be_nil
35
- end
36
-
37
- it "should logged in warning the path if path doesn't exist" do
38
- Rails.logger.should_receive(:warn).with("path : /index.html no more exist")
39
- CacheInformation.create!(:path => '/index.html').destroy
40
- end
41
-
42
- end
@@ -1,51 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe 'Given a published article' do
4
- before(:each) do
5
- @article = contents(:article1)
6
- end
7
-
8
- it "An unchanged article does not invalidate the cache" do
9
- @article.should_not be_invalidates_cache
10
- end
11
-
12
- it 'changing the body smashes the cache' do
13
- @article.body = "New Body"
14
- @article.should be_invalidates_cache
15
- end
16
-
17
- it 'withdrawing it smashes the cache' do
18
- @article.withdraw!
19
- @article.should be_invalidates_cache
20
- end
21
-
22
- it 'destroying it smashes the cache' do
23
- @article.destroy
24
- @article.should be_invalidates_cache(true)
25
- end
26
-
27
- it 'withdrawing, then destroying it smashes the cache' do
28
- @article.withdraw
29
- @article.destroy
30
- @article.should be_invalidates_cache
31
- end
32
- end
33
-
34
- describe "Given an unpublished article" do
35
- before(:each) { @article = contents(:article4) }
36
-
37
- it "publishing smashes the cache" do
38
- @article.publish!
39
- @article.should be_invalidates_cache
40
- end
41
-
42
- it "changing it keeps the cache" do
43
- @article.body = 'New body'
44
- @article.should_not be_invalidates_cache
45
- end
46
-
47
- it "destroying it keeps the cache" do
48
- @article.destroy
49
- @article.should_not be_invalidates_cache
50
- end
51
- end
@@ -1,44 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe 'Given the results of Category.find_all_with_article_counters' do
4
- before(:each) { @cats = Category.find_all_with_article_counters }
5
-
6
- it "Categories should be sorted by category.position" do
7
- @cats.should == @cats.sort_by { |c| c.position }
8
- end
9
-
10
- it "Counts should be correct" do
11
- @cats.each do |cat|
12
- cat.article_counter.should == cat.published_articles.size
13
- end
14
- end
15
- end
16
-
17
- describe 'Given the fixtures' do
18
- it 'find gets the order right' do
19
- cats = Category.find(:all)
20
- cats.should == cats.sort_by { |c| c.position }
21
- Category.reorder(cats.reverse.collect { |c| c.id })
22
- Category.find(:all).should == cats.reverse
23
- end
24
-
25
- it 'can still override order in find' do
26
- cats = Category.find(:all, :order => 'name ASC')
27
-
28
- cats.should == cats.sort_by {|c| c.name}
29
- Category.find(:all).should_not == cats
30
- end
31
-
32
- it '.reorder_alpha puts categories in alphabetical order' do
33
- Category.find(:all).should_not == Category.find(:all, :order => :name)
34
- Category.reorder_alpha
35
- Category.find(:all).should == Category.find(:all, :order => :name)
36
- end
37
-
38
- it 'A category knows its url' do
39
- categories(:software).permalink_url.should ==
40
- 'http://myblog.net/category/software'
41
- end
42
- end
43
-
44
-
@@ -1,240 +0,0 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
2
-
3
- require 'dns_mock'
4
-
5
- describe Comment do
6
-
7
- def valid_comment(options={})
8
- Comment.new({:author => 'Bob',
9
- :article_id => contents(:article1).id,
10
- :body => 'nice post',
11
- :ip => '1.2.3.4'}.merge(options))
12
- end
13
-
14
- describe '#permalink_url' do
15
- it 'should render permalink to comment in public part' do
16
- c = feedback(:old_comment)
17
- assert_equal "http://myblog.net/2004/05/01/inactive-article#comment-#{c.id}", c.permalink_url
18
- end
19
- end
20
-
21
- describe '#edit_url' do
22
- it 'should get a url where edit comment in admin' do
23
- c = feedback(:old_comment)
24
- assert_equal "http://myblog.net/admin/comments/edit/#{c.id}", c.edit_url
25
- end
26
- end
27
-
28
- describe '#delete_url' do
29
- it 'should get the delete url of comment in admin part' do
30
- c = feedback(:old_comment)
31
- assert_equal "http://myblog.net/admin/comments/destroy/#{c.id}", c.delete_url
32
- end
33
- end
34
-
35
- describe '#save' do
36
-
37
- it 'should save good comment' do
38
- assert feedback(:comment2).save
39
- assert_equal "http://www.google.com", feedback(:comment2).url
40
- end
41
-
42
- it 'should save spam comment' do
43
- assert feedback(:spam_comment).save
44
- assert_equal "http://fakeurl.com", feedback(:spam_comment).url
45
- end
46
-
47
- it 'should not save in invalid article' do
48
- c = valid_comment(:author => "Old Spammer",
49
- :body => "Old trackback body",
50
- :article => contents(:inactive_article))
51
-
52
- assert ! c.save
53
- assert c.errors.invalid?('article_id')
54
-
55
- c.article = contents(:article1)
56
-
57
- assert c.save
58
- assert c.errors.empty?
59
- end
60
-
61
- it 'should change old comment' do
62
- c = contents(:inactive_article).comments.first
63
- c.body = 'Comment body <em>italic</em> <strong>bold</strong>'
64
- assert c.save
65
- assert c.errors.empty?
66
- end
67
-
68
- it 'should save a valid comment' do
69
- c = valid_comment # article created 2 days ago
70
- c.save.should be_true
71
- c.errors.should be_empty
72
- end
73
-
74
- it 'should not save with article not allow comment' do
75
- b = Blog.default
76
- b.sp_article_auto_close = 1
77
- b.save
78
-
79
- c = valid_comment # article created 2 days ago
80
- c.save.should_not be_true
81
- c.errors.should_not be_empty
82
- end
83
-
84
- end
85
-
86
- describe '#create' do
87
-
88
- it 'should create comment' do
89
- c = valid_comment
90
- assert c.save
91
- assert c.guid.size > 15
92
- end
93
-
94
- end
95
-
96
- describe '#spam?' do
97
- it 'should reject spam rbl' do
98
- c = valid_comment(:author => "Spammer",
99
- :body => %{This is just some random text. &lt;a href="http://chinaaircatering.com"&gt;without any senses.&lt;/a&gt;. Please disregard.},
100
- :url => "http://buy-computer.us")
101
- should_be_spam(c)
102
- end
103
-
104
- it 'should not define spam a comment rbl with lookup succeeds' do
105
- c = valid_comment(:author => "Not a Spammer",
106
- :body => "Useful commentary!",
107
- :url => "http://www.bofh.org.uk")
108
- c.should_not be_spam
109
- c.should_not be_status_confirmed
110
- end
111
-
112
- it 'should reject spam with uri limit' do
113
- c = valid_comment(:author => "Yet Another Spammer",
114
- :body => %{ <a href="http://www.one.com/">one</a> <a href="http://www.two.com/">two</a> <a href="http://www.three.com/">three</a> <a href="http://www.four.com/">four</a> },
115
- :url => "http://www.uri-limit.com")
116
- should_be_spam(c)
117
- end
118
-
119
- def should_be_spam(comment)
120
- comment.should be_spam
121
- comment.should_not be_status_confirmed
122
- end
123
-
124
- end
125
-
126
- it 'should have good relation' do
127
- assert feedback(:comment2).article
128
- assert_equal contents(:article1), feedback(:comment2).article
129
- end
130
-
131
- describe 'reject xss' do
132
- before(:each) do
133
- @comment = Comment.new do |c|
134
- c.body = "Test foo <script>do_evil();</script>"
135
- c.author = 'Bob'
136
- c.article_id = contents(:article1).id
137
- end
138
- end
139
- ['','textile','markdown','smartypants','markdown smartypants'].each do |filter|
140
- it "should reject with filter #{filter}" do
141
- Blog.default.comment_text_filter = filter
142
-
143
- assert @comment.save
144
- assert @comment.errors.empty?
145
-
146
- assert @comment.html(:body) !~ /<script>/
147
- end
148
- end
149
- end
150
-
151
- describe 'change state' do
152
- it 'should becomes withdraw' do
153
- c = Comment.find(feedback(:comment2).id)
154
- assert c.withdraw!
155
- assert ! c.published?
156
- assert c.spam?
157
- assert c.status_confirmed?
158
- c.reload
159
- assert ! c.published?
160
- assert c.spam?
161
- assert c.status_confirmed?
162
- end
163
-
164
- it 'should becomes not published in article if withdraw' do
165
- a = Article.new(:title => 'foo')
166
- assert a.save
167
-
168
- assert_equal 0, a.published_comments.size
169
- c = a.comments.build(:body => 'foo', :author => 'bob', :published => true, :published_at => Time.now)
170
- assert c.save
171
- assert c.published?
172
- c.reload
173
- a.reload
174
-
175
- assert_equal 1, a.published_comments.size
176
- c.withdraw!
177
-
178
- a = Article.new(:title => 'foo')
179
- assert_equal 0, a.published_comments.size
180
- end
181
-
182
- it 'should becomes not confirmed in article if withdraw' do
183
- a = contents(:spammed_article)
184
- assert !a.comments[0].status_confirmed?
185
- assert a.comments[1].status_confirmed?
186
-
187
- a.reload
188
- assert_equal 1,
189
- a.comments.find_all_by_status_confirmed(true).size
190
- assert_equal 1,
191
- a.comments.find_all_by_status_confirmed(true).size
192
- a.comments[0].withdraw!
193
- assert_equal 2,
194
- a.comments.find_all_by_status_confirmed(true).size
195
- end
196
- end
197
-
198
- it 'should have good default filter' do
199
- a = Comment.find(:first)
200
- assert_equal 'markdown', a.default_text_filter.name
201
- end
202
-
203
- describe 'with feedback moderation enabled' do
204
- before(:each) do
205
- @blog = Blog.default
206
- @blog.sp_global = false
207
- @blog.default_moderate_comments = true
208
- @blog.save!
209
- end
210
-
211
- it 'should save comment as presumably spam' do
212
- comment = Comment.new do |c|
213
- c.body = "Test foo"
214
- c.author = 'Bob'
215
- c.article_id = contents(:article1).id
216
- end
217
- assert comment.save!
218
-
219
- assert ! comment.published?
220
- assert comment.spam?
221
- assert ! comment.status_confirmed?
222
- end
223
-
224
- it 'should save comment as confirmed ham' do
225
- comment = Comment.new do |c|
226
- c.body = "Test foo"
227
- c.author = 'Bob'
228
- c.article_id = contents(:article1).id
229
- c.user_id = users(:tobi).id
230
- end
231
- assert comment.save!
232
-
233
- assert comment.published?
234
- assert comment.ham?
235
- assert comment.status_confirmed?
236
-
237
- end
238
- end
239
-
240
- end