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,13 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- describe Admin::DashboardController do
4
- before do
5
- request.session = { :user => users(:tobi).id }
6
- end
7
-
8
- it "test_index" do
9
- get :index
10
- response.should render_template('index')
11
- end
12
-
13
- end
@@ -1,308 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- describe Admin::FeedbackController do
4
-
5
- integrate_views
6
-
7
- describe "destroy feedback with feedback from own article", :shared => true do
8
- it 'should destroy feedback' do
9
- lambda do
10
- post 'delete', :id => feedback_from_own_article.id
11
- end.should change(Feedback, :count)
12
- lambda do
13
- Feedback.find(feedback_from_own_article.id)
14
- end.should raise_error(ActiveRecord::RecordNotFound)
15
- end
16
-
17
- it 'should redirect to feedback from article' do
18
- post 'delete', :id => feedback_from_own_article.id
19
- response.should redirect_to(:controller => 'admin/feedback', :action => 'article', :id => feedback_from_own_article.article.id)
20
- end
21
-
22
- it 'should not delete feedback in get request' do
23
- lambda do
24
- get 'delete', :id => feedback_from_own_article.id
25
- end.should_not change(Feedback, :count)
26
- lambda do
27
- Feedback.find(feedback_from_own_article.id)
28
- end.should_not raise_error(ActiveRecord::RecordNotFound)
29
- response.should redirect_to(:controller => 'admin/feedback', :action => 'article', :id => feedback_from_own_article.article.id)
30
- end
31
- end
32
-
33
-
34
- describe 'logged in admin user' do
35
-
36
- def feedback_from_own_article
37
- feedback(:spam_comment)
38
- end
39
-
40
- def feedback_from_not_own_article
41
- feedback(:spam_comment)
42
- end
43
-
44
- before do
45
- request.session = { :user => users(:tobi).id }
46
- end
47
-
48
- describe 'delete action' do
49
-
50
- it_should_behave_like "destroy feedback with feedback from own article"
51
-
52
- it "should delete feedback from article doesn't own" do
53
- lambda do
54
- post 'delete', :id => feedback_from_not_own_article.id
55
- end.should change(Feedback, :count)
56
- lambda do
57
- Feedback.find(feedback_from_not_own_article.id)
58
- end.should raise_error(ActiveRecord::RecordNotFound)
59
- response.should redirect_to(:controller => 'admin/feedback', :action => 'article', :id => feedback_from_not_own_article.article.id)
60
- end
61
- end
62
-
63
- describe 'index action' do
64
-
65
- def should_success_with_index(response)
66
- response.should be_success
67
- response.should render_template('index')
68
- end
69
-
70
- it 'should success' do
71
- get :index
72
- should_success_with_index(response)
73
- #FIXME : Test is useless because the pagination is on 10. Now there are 11
74
- #feedback, so there are several feedback :(
75
- assert_equal 10, assigns(:feedback).size #Feedback.count, assigns(:feedback).size
76
- end
77
-
78
- it 'should view only confirmed feedback' do
79
- get :index, :confirmed => 'f'
80
- should_success_with_index(response)
81
- Feedback.count(:conditions => { :status_confirmed => false }).should == assigns(:feedback).size
82
- end
83
-
84
- it 'should view only spam feedback' do
85
- get :index, :published => 'f'
86
- should_success_with_index(response)
87
- Feedback.count(:conditions => { :published => false }).should == assigns(:feedback).size
88
- end
89
-
90
- it 'should view unconfirmed_spam' do
91
- get :index, :published => 'f', :confirmed => 'f'
92
- should_success_with_index(response)
93
- Feedback.count(:conditions => { :published => false, :status_confirmed => false }).should == assigns(:feedback).size
94
- end
95
-
96
- it 'should get page 1 if page params empty' do
97
- get :index, :page => ''
98
- should_success_with_index(response)
99
- end
100
-
101
- end
102
-
103
- describe 'article action' do
104
-
105
- def should_success_with_article_view(response)
106
- response.should be_success
107
- response.should render_template('article')
108
- end
109
-
110
- it 'should see all feedback on one article' do
111
- get :article, :id => contents(:article1).id
112
- should_success_with_article_view(response)
113
- assigns(:article).should == contents(:article1)
114
- assigns(:comments).size.should == 2
115
- end
116
-
117
- it 'should see only spam feedback on one article' do
118
- get :article, :id => contents(:article1).id, :spam => 'y'
119
- should_success_with_article_view(response)
120
- assigns(:article).should == contents(:article1)
121
- assigns(:comments).size.should == 1
122
- end
123
-
124
- it 'should see only ham feedback on one article' do
125
- get :article, :id => contents(:article1).id, :ham => 'y'
126
- should_success_with_article_view(response)
127
- assigns(:article).should == contents(:article1)
128
- assigns(:comments).size.should == 1
129
- end
130
-
131
- it 'should redirect_to index if bad article id' do
132
- lambda{
133
- get :article, :id => 102302
134
- }.should raise_error(ActiveRecord::RecordNotFound)
135
- end
136
-
137
- end
138
-
139
- describe 'create action' do
140
-
141
- def base_comment(options = {})
142
- {"body"=>"a new comment", "author"=>"Me", "url"=>"http://typosphere.org", "email"=>"dev@typosphere.org"}.merge(options)
143
- end
144
-
145
- describe 'by get access' do
146
- it "should raise ActiveRecordNotFound if article doesn't exist" do
147
- lambda {
148
- get 'create', :article_id => 120431, :comment => base_comment
149
- }.should raise_error(ActiveRecord::RecordNotFound)
150
- end
151
-
152
- it 'should not create comment' do
153
- assert_no_difference 'Comment.count' do
154
- get 'create', :article_id => contents(:article1).id, :comment => base_comment
155
- response.should redirect_to(:action => 'article', :id => contents(:article1).id)
156
- end
157
- end
158
-
159
- end
160
-
161
- describe 'by post access' do
162
- it "should raise ActiveRecordNotFound if article doesn't exist" do
163
- lambda {
164
- post 'create', :article_id => 123104, :comment => base_comment
165
- }.should raise_error(ActiveRecord::RecordNotFound)
166
- end
167
-
168
- it 'should create comment' do
169
- assert_difference 'Comment.count' do
170
- post 'create', :article_id => contents(:article1).id, :comment => base_comment
171
- response.should redirect_to(:action => 'article', :id => contents(:article1).id)
172
- end
173
- end
174
-
175
- it 'should create comment mark as ham' do
176
- assert_difference 'Comment.count(:conditions => {:state => "ham"})' do
177
- post 'create', :article_id => contents(:article1).id, :comment => base_comment
178
- response.should redirect_to(:action => 'article', :id => contents(:article1).id)
179
- end
180
- end
181
-
182
- end
183
-
184
- end
185
-
186
- describe 'edit action' do
187
-
188
- it 'should render edit form' do
189
- get 'edit', :id => feedback(:comment2).id
190
- assigns(:comment).should == feedback(:comment2)
191
- assigns(:article).should == contents(:article1)
192
- response.should be_success
193
- response.should render_template('edit')
194
- end
195
-
196
- end
197
-
198
- describe 'update action' do
199
-
200
- it 'should update comment if post request' do
201
- post 'update', :id => feedback(:comment2).id,
202
- :comment => {:author => 'Bob Foo2',
203
- :url => 'http://fakeurl.com',
204
- :body => 'updated comment'}
205
- response.should redirect_to(:action => 'article', :id => contents(:article1).id)
206
- feedback(:comment2).reload
207
- feedback(:comment2).body.should == 'updated comment'
208
- end
209
-
210
- it 'should not update comment if get request' do
211
- get 'update', :id => feedback(:comment2).id,
212
- :comment => {:author => 'Bob Foo2',
213
- :url => 'http://fakeurl.com',
214
- :body => 'updated comment'}
215
- response.should redirect_to(:action => 'edit', :id => feedback(:comment2).id)
216
- feedback(:comment2).reload
217
- feedback(:comment2).body.should_not == 'updated comment'
218
- end
219
-
220
-
221
- end
222
- end
223
-
224
- describe 'publisher access' do
225
-
226
- before :each do
227
- request.session = { :user => users(:user_publisher).id }
228
- end
229
-
230
-
231
- def feedback_from_own_article
232
- feedback(:comment_on_publisher_article)
233
- end
234
-
235
- def feedback_from_not_own_article
236
- feedback(:comment2)
237
- end
238
-
239
- describe 'delete action' do
240
-
241
- it_should_behave_like "destroy feedback with feedback from own article"
242
-
243
- it "should not delete feedback doesn't own" do
244
- lambda do
245
- post 'delete', :id => feedback_from_not_own_article.id
246
- end.should_not change(Feedback, :count)
247
- lambda do
248
- Feedback.find(feedbackfrom_not_own_article.id)
249
- end.should_not raise_error(ActiveRecord::RecordNotFound)
250
- response.should redirect_to(:controller => 'admin/feedback', :action => 'index')
251
- end
252
- end
253
-
254
- describe 'edit action' do
255
-
256
- it 'should not edit comment no own article' do
257
- get 'edit', :id => feedback_from_not_own_article.id
258
- response.should redirect_to(:action => 'index')
259
- end
260
-
261
- it 'should edit comment if own article' do
262
- get 'edit', :id => feedback_from_own_article.id
263
- response.should be_success
264
- response.should render_template('edit')
265
- assigns(:comment).should == feedback_from_own_article
266
- assigns(:article).should == feedback_from_own_article.article
267
- end
268
-
269
- end
270
-
271
- describe 'update action' do
272
-
273
- it 'should update comment if own article' do
274
- post 'update', :id => feedback_from_own_article.id,
275
- :comment => {:author => 'Bob Foo2',
276
- :url => 'http://fakeurl.com',
277
- :body => 'updated comment'}
278
- response.should redirect_to(:action => 'article', :id => feedback_from_own_article.article.id)
279
- feedback_from_own_article.reload
280
- feedback_from_own_article.body.should == 'updated comment'
281
- end
282
-
283
- it 'should not update comment if not own article' do
284
- post 'update', :id => feedback_from_not_own_article.id,
285
- :comment => {:author => 'Bob Foo2',
286
- :url => 'http://fakeurl.com',
287
- :body => 'updated comment'}
288
- response.should redirect_to(:action => 'index')
289
- feedback_from_not_own_article.reload
290
- feedback_from_not_own_article.body.should_not == 'updated comment'
291
- end
292
-
293
- end
294
-
295
- describe '#bulkops action' do
296
-
297
- before :each do
298
- post :bulkops, :bulkop_top => 'Delete all spam'
299
- end
300
-
301
- it 'should redirect to action' do
302
- @response.should redirect_to(:action => 'index')
303
- end
304
- end
305
-
306
- end
307
-
308
- end
@@ -1,80 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- describe Admin::PagesController do
4
- before do
5
- request.session = { :user => users(:tobi).id }
6
- end
7
-
8
-
9
- describe '#index' do
10
-
11
-
12
- it 'should response success' do
13
- get :index
14
- response.should be_success
15
- assert_template 'index'
16
- assert_not_nil assigns(:pages)
17
- end
18
-
19
- it 'should response success with :page args' do
20
- get :index, :page => 1
21
- response.should be_success
22
- assert_template 'index'
23
- assert_not_nil assigns(:pages)
24
- end
25
-
26
- end
27
-
28
- it "test_show" do
29
- get :show, :id => contents(:first_page).id
30
- assert_response :success
31
- assert_template "show"
32
- assert_not_nil assigns(:page)
33
- assert_equal contents(:first_page), assigns(:page)
34
- end
35
-
36
- it "test_new" do
37
- get :new
38
- assert_response :success
39
- assert_template "new"
40
- assert_not_nil assigns(:page)
41
-
42
- assert_equal users(:tobi), assigns(:page).user
43
- assert_equal TextFilter.find_by_name(this_blog.text_filter), assigns(:page).text_filter
44
-
45
- post :new, :page => { :name => "new_page", :title => "New Page Title",
46
- :body => "Emphasis _mine_, arguments *strong*" }
47
-
48
- new_page = Page.find(:first, :order => "id DESC")
49
-
50
- assert_equal "new_page", new_page.name
51
-
52
- assert_response :redirect, :action => "show", :id => new_page.id
53
-
54
- # XXX: The flash is currently being made available improperly to tests (scoop)
55
- #assert_equal "Page was successfully created.", flash[:notice]
56
- end
57
-
58
- it "test_edit" do
59
- get :edit, :id => contents(:markdown_page).id
60
- assert_response :success
61
- assert_template "edit"
62
- assert_not_nil assigns(:page)
63
-
64
- assert_equal contents(:markdown_page), assigns(:page)
65
-
66
- post :edit, :id => contents(:markdown_page).id, :page => { :name => "markdown-page", :title => "Markdown Page",
67
- :body => "Adding a [link](http://www.typosphere.org/) here" }
68
-
69
- assert_response :redirect, :action => "show", :id => contents(:markdown_page).id
70
-
71
- # XXX: The flash is currently being made available improperly to tests (scoop)
72
- #assert_equal "Page was successfully updated.", flash[:notice]
73
- end
74
-
75
- it "test_destroy" do
76
- post :destroy, :id => contents(:another_page).id
77
- assert_response :redirect, :action => "list"
78
- assert_raise(ActiveRecord::RecordNotFound) { Page.find(contents(:another_page).id) }
79
- end
80
- end
@@ -1,22 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- describe Admin::ProfilesController do
4
-
5
- describe "#index" do
6
- it 'should render index' do
7
- users(:tobi).profile.label.should == 'admin'
8
- request.session = { :user => users(:tobi).id }
9
- get :index
10
- response.should render_template('index')
11
- end
12
- end
13
-
14
- # TODO: Make RESTful
15
- describe "successful POST to index" do
16
- it "redirects to profile page" do
17
- request.session = { :user => users(:tobi).id }
18
- post :index, :user => {:email => 'foo@bar.com'}
19
- response.should render_template('index')
20
- end
21
- end
22
- end
@@ -1,53 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- describe Admin::ResourcesController do
4
- before do
5
- @request.session = { :user => users(:tobi).id }
6
- end
7
-
8
- it "test_index" do
9
- get :index
10
- assert_response :success
11
- assert_template 'index'
12
- assert_template_has 'resources'
13
- assert_not_nil assigns(:resources)
14
- end
15
-
16
- it "test_images" do
17
- get :images
18
- assert_response :success
19
- assert_template 'images'
20
- assert_template_has 'resources'
21
- assert_not_nil assigns(:resources)
22
- end
23
-
24
- it "test_destroy_image" do
25
- res_id = resources(:resource1).id
26
- assert_not_nil Resource.find(res_id)
27
-
28
- get :destroy, :id => res_id
29
- assert_response :success
30
- assert_template 'destroy'
31
- assert_not_nil assigns(:file)
32
-
33
- post :destroy, :id => res_id
34
- response.should redirect_to(:action => 'images')
35
- end
36
-
37
- it "test_destroy_regular_file" do
38
- res_id = resources(:resource3).id
39
- assert_not_nil Resource.find(res_id)
40
-
41
- get :destroy, :id => res_id
42
- assert_response :success
43
- assert_template 'destroy'
44
- assert_not_nil assigns(:file)
45
-
46
- post :destroy, :id => res_id
47
- response.should redirect_to(:action => 'index')
48
- end
49
-
50
- it "test_upload" do
51
- # unsure how to test upload constructs :'(
52
- end
53
- end