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.
- data/CHANGELOG +59 -28
- data/MAINTAINERS +9 -17
- data/README +28 -20
- data/UPGRADE +6 -2
- data/app/controllers/accounts_controller.rb +1 -1
- data/app/controllers/admin/content_controller.rb +1 -1
- data/app/controllers/admin/feedback_controller.rb +3 -3
- data/app/controllers/admin/pages_controller.rb +2 -0
- data/app/controllers/application_controller.rb +6 -1
- data/app/controllers/articles_controller.rb +13 -1
- data/app/helpers/application_helper.rb +5 -2
- data/app/helpers/authors_helper.rb +14 -3
- data/app/models/article.rb +6 -4
- data/app/models/blog.rb +0 -4
- data/app/models/blog_sweeper.rb +1 -1
- data/app/models/content.rb +10 -5
- data/app/models/page_cache.rb +6 -7
- data/app/models/user.rb +1 -0
- data/app/views/admin/content/_form.html.erb +13 -11
- data/app/views/admin/content/_images.html.erb +1 -1
- data/app/views/admin/content/_simple_editor.html.erb +1 -0
- data/app/views/admin/content/_visual_editor.html.erb +1 -0
- data/app/views/admin/dashboard/_overview.html.erb +7 -7
- data/app/views/admin/pages/_form.html.erb +1 -0
- data/app/views/admin/pages/_images.html.erb +18 -0
- data/app/views/admin/pages/_simple_editor.html.erb +1 -2
- data/app/views/admin/pages/_visual_editor.html.erb +2 -1
- data/app/views/admin/pages/index.html.erb +1 -1
- data/app/views/admin/settings/feedback.html.erb +2 -1
- data/app/views/admin/tags/edit.html.erb +1 -1
- data/app/views/articles/_article.html.erb +17 -13
- data/app/views/articles/_article_content.html.erb +1 -0
- data/app/views/articles/_comment_box.html.erb +1 -1
- data/app/views/articles/_password_form.html.erb +10 -0
- data/app/views/articles/groupings.html.erb +1 -1
- data/app/views/articles/index.html.erb +1 -2
- data/app/views/articles/read.html.erb +1 -4
- data/app/views/articles/search.html.erb +1 -1
- data/app/views/layouts/administration.html.erb +1 -1
- data/app/views/shared/_search.html.erb +1 -1
- data/config/ckeditor.yml +14 -0
- data/config/environment.rb +13 -25
- data/config/environments/test.rb +1 -3
- data/config/filemanager.yml +16 -0
- data/config/initializers/access_rules.rb +5 -0
- data/config/routes.rb +5 -1
- data/db/migrate/004_add_sidebars.rb +3 -9
- data/db/migrate/089_drop_cache_information_table.rb +31 -0
- data/db/migrate/090_remove_keywords_from_posts.rb +9 -0
- data/db/migrate/091_adds_password_protection_to_posts.rb +9 -0
- data/doc/CACHE.SETUP.README +36 -0
- data/lang/de_DE.rb +6 -1
- data/lang/pl_PL.rb +221 -89
- data/lib/filemanager.rb +53 -0
- data/lib/filemanager/controller.rb +217 -0
- data/lib/i18n_interpolation_deprecation.rb +26 -0
- data/lib/rails_patch/active_support.rb +4 -0
- data/lib/tasks/release.rake +4 -131
- data/lib/typo_version.rb +1 -1
- data/public/.htaccess +6 -5
- data/public/filemanager/images/avi.gif +0 -0
- data/public/filemanager/images/box.gif +0 -0
- data/public/filemanager/images/bullet.gif +0 -0
- data/public/filemanager/images/close.gif +0 -0
- data/public/filemanager/images/closelabel.gif +0 -0
- data/public/filemanager/images/doc.gif +0 -0
- data/public/filemanager/images/donate-button.gif +0 -0
- data/public/filemanager/images/download-icon.gif +0 -0
- data/public/filemanager/images/folder.gif +0 -0
- data/public/filemanager/images/gif.gif +0 -0
- data/public/filemanager/images/htm.gif +0 -0
- data/public/filemanager/images/html.gif +0 -0
- data/public/filemanager/images/image-1.jpg +0 -0
- data/public/filemanager/images/image.gif +0 -0
- data/public/filemanager/images/jpg.gif +0 -0
- data/public/filemanager/images/loading.gif +0 -0
- data/public/filemanager/images/mov.gif +0 -0
- data/public/filemanager/images/nextlabel.gif +0 -0
- data/public/filemanager/images/pdf.gif +0 -0
- data/public/filemanager/images/png.gif +0 -0
- data/public/filemanager/images/ppt.gif +0 -0
- data/public/filemanager/images/prevlabel.gif +0 -0
- data/public/filemanager/images/rar.gif +0 -0
- data/public/filemanager/images/rm.gif +0 -0
- data/public/filemanager/images/rmvb.gif +0 -0
- data/public/filemanager/images/separator.gif +0 -0
- data/public/filemanager/images/spacer.gif +0 -0
- data/public/filemanager/images/swf.gif +0 -0
- data/public/filemanager/images/thumb-1.jpg +0 -0
- data/public/filemanager/images/tool_copy.gif +0 -0
- data/public/filemanager/images/tool_cut.gif +0 -0
- data/public/filemanager/images/tool_del.gif +0 -0
- data/public/filemanager/images/tool_folder.gif +0 -0
- data/public/filemanager/images/tool_imagemanager.gif +0 -0
- data/public/filemanager/images/tool_new.gif +0 -0
- data/public/filemanager/images/tool_paste.gif +0 -0
- data/public/filemanager/images/tool_props.gif +0 -0
- data/public/filemanager/images/tool_refresh.gif +0 -0
- data/public/filemanager/images/tool_unzip.gif +0 -0
- data/public/filemanager/images/tool_upload.gif +0 -0
- data/public/filemanager/images/tool_zip.gif +0 -0
- data/public/filemanager/images/txt.gif +0 -0
- data/public/filemanager/images/unknown.gif +0 -0
- data/public/filemanager/images/wmv.gif +0 -0
- data/public/filemanager/images/xls.gif +0 -0
- data/public/filemanager/images/zip.gif +0 -0
- data/public/filemanager/javascripts/filemanager.js +6 -0
- data/public/filemanager/javascripts/lang/en.js +31 -0
- data/public/filemanager/javascripts/lang/zh_CN.js +31 -0
- data/public/filemanager/javascripts/lightbox.js +497 -0
- data/public/filemanager/javascripts/translate.js +42 -0
- data/public/filemanager/resources/resources.txt +1 -0
- data/public/filemanager/stylesheets/filelist.css +147 -0
- data/public/filemanager/stylesheets/general.css +135 -0
- data/public/filemanager/stylesheets/lightbox.css +27 -0
- data/public/javascripts/prototype_ext.js +117 -0
- data/public/stylesheets/administration.css +19 -2
- data/themes/dirtylicious/views/articles/_article.html.erb +16 -12
- data/themes/dirtylicious/views/articles/_article_content.html.erb +1 -0
- data/themes/dirtylicious/views/articles/_password_form.html.erb +10 -0
- data/themes/scribbish/views/articles/_article.html.erb +18 -14
- data/themes/scribbish/views/articles/_article_content.html.erb +1 -0
- data/themes/scribbish/views/articles/_password_form.html.erb +10 -0
- data/themes/standard_issue/views/articles/_article.html.erb +16 -12
- data/themes/standard_issue/views/articles/_article_content.html.erb +1 -0
- data/themes/standard_issue/views/articles/_password_form.html.erb +10 -0
- data/themes/true-blue-3/helpers/theme_helper.rb +2 -2
- data/themes/true-blue-3/images/submit_form.jpg +0 -0
- data/themes/true-blue-3/stylesheets/style.css +27 -3
- data/themes/true-blue-3/views/articles/_article.html.erb +13 -8
- data/themes/true-blue-3/views/articles/_article_content.html.erb +1 -0
- data/themes/true-blue-3/views/articles/_comment_form.html.erb +1 -1
- data/themes/true-blue-3/views/articles/_password_form.html.erb +10 -0
- data/themes/true-blue-3/views/categories/_article.html.erb +5 -0
- data/themes/true-blue-3/views/tags/_article.html.erb +4 -0
- data/themes/typographic/views/articles/_article.html.erb +16 -12
- data/themes/typographic/views/articles/_article_content.html.erb +1 -0
- data/themes/typographic/views/articles/_password_form.html.erb +10 -0
- data/vendor/plugins/easy-ckeditor/app/controllers/ckeditor_controller.rb +2 -1
- data/vendor/plugins/easy-ckeditor/lib/ckeditor.rb +1 -20
- data/vendor/plugins/easy-ckeditor/{tasks → lib/tasks}/ckeditor_tasks.rake +0 -0
- data/vendor/plugins/filemanager/app/controllers/fm/filemanager_controller.rb +22 -0
- data/vendor/plugins/filemanager/app/views/fm/filemanager/index.html.erb +512 -0
- data/vendor/plugins/filemanager/app/views/fm/filemanager/view.html.erb +67 -0
- data/vendor/plugins/filemanager/filemanager.yml +16 -0
- data/vendor/plugins/static_sidebar/lib/static_sidebar.rb +4 -2
- data/vendor/plugins/typo_converter/{tasks → lib/tasks}/typo_converters_tasks.rake +0 -0
- data/vendor/plugins/typo_login_system/lib/access_control.rb +24 -1
- data/vendor/plugins/typo_textfilter_code/{tasks → lib/tasks}/typo_textfilter_code_tasks.rake +0 -0
- data/vendor/plugins/typo_textfilter_code/lib/typo_textfilter_code.rb +4 -3
- data/vendor/plugins/typo_textfilter_flickr/{tasks → lib/tasks}/typo_textfilter_flickr_tasks.rake +0 -0
- data/vendor/plugins/typo_textfilter_htmlfilter/{tasks → lib/tasks}/typo_textfilter_htmlfilter_tasks.rake +0 -0
- data/vendor/plugins/typo_textfilter_lightbox/{tasks → lib/tasks}/typo_textfilter_lightbox_tasks.rake +0 -0
- data/vendor/plugins/typo_textfilter_markdown/{tasks → lib/tasks}/typo_textfilter_markdown_tasks.rake +0 -0
- data/vendor/plugins/typo_textfilter_none/{tasks → lib/tasks}/typo_textfilter_none_tasks.rake +0 -0
- data/vendor/plugins/typo_textfilter_smartypants/{tasks → lib/tasks}/typo_textfilter_smartypants_tasks.rake +0 -0
- data/vendor/plugins/typo_textfilter_textile/{tasks → lib/tasks}/typo_textfilter_textile_tasks.rake +0 -0
- data/vendor/plugins/typo_textfilter_textile_and_markdown/{tasks → lib/tasks}/typo_textfilter_textile_and_markdown_tasks.rake +0 -0
- data/vendor/plugins/xml_sidebar/views/content.rhtml +1 -1
- metadata +190 -195
- data/app/controllers/admin/cache_controller.rb +0 -9
- data/app/models/cache_information.rb +0 -19
- data/db/schema.rb +0 -242
- data/doc/test_themes.rb +0 -50
- data/public/javascripts/ckeditor/config.js +0 -27
- data/spec/controllers/accounts_controller_spec.rb +0 -414
- data/spec/controllers/admin/cache_controller_spec.rb +0 -18
- data/spec/controllers/admin/categories_controller_spec.rb +0 -73
- data/spec/controllers/admin/content_controller_spec.rb +0 -443
- data/spec/controllers/admin/dashboard_controller_spec.rb +0 -13
- data/spec/controllers/admin/feedback_controller_spec.rb +0 -308
- data/spec/controllers/admin/pages_controller_spec.rb +0 -80
- data/spec/controllers/admin/profiles_controller_spec.rb +0 -22
- data/spec/controllers/admin/resources_controller_spec.rb +0 -53
- data/spec/controllers/admin/settings_controller_spec.rb +0 -80
- data/spec/controllers/admin/tags_controller_spec.rb +0 -64
- data/spec/controllers/admin/textfilters_controller_spec.rb +0 -20
- data/spec/controllers/admin/themes_controller_spec.rb +0 -30
- data/spec/controllers/admin/users_controller_spec.rb +0 -109
- data/spec/controllers/application_controller_spec.rb +0 -18
- data/spec/controllers/articles_controller_spec.rb +0 -440
- data/spec/controllers/authors_controller_spec.rb +0 -42
- data/spec/controllers/backend_controller_spec.rb +0 -337
- data/spec/controllers/categories_controller_spec.rb +0 -117
- data/spec/controllers/comments_controller_spec.rb +0 -137
- data/spec/controllers/routes/articles_routing_spec.rb +0 -31
- data/spec/controllers/routes/xml_routing_spec.rb +0 -71
- data/spec/controllers/setup_controller_spec.rb +0 -24
- data/spec/controllers/tags_controller_spec.rb +0 -147
- data/spec/controllers/textfilter_controller_spec.rb +0 -192
- data/spec/controllers/theme_controller_spec.rb +0 -39
- data/spec/controllers/xml_controller_spec.rb +0 -185
- data/spec/factories.rb +0 -69
- data/spec/helpers/application_helper_spec.rb +0 -25
- data/spec/helpers/content_helper_spec.rb +0 -28
- data/spec/lib/text_filter_plugin_spec.rb +0 -15
- data/spec/models/amazon_sidebar_spec.rb +0 -40
- data/spec/models/article_closing_spec.rb +0 -42
- data/spec/models/article_spec.rb +0 -515
- data/spec/models/blog_spec.rb +0 -116
- data/spec/models/cache_information_spec.rb +0 -42
- data/spec/models/cache_support_spec.rb +0 -51
- data/spec/models/category_spec.rb +0 -44
- data/spec/models/comment_spec.rb +0 -240
- data/spec/models/configuration_spec.rb +0 -91
- data/spec/models/content_state/feedback_states_spec.rb +0 -64
- data/spec/models/notification_spec.rb +0 -8
- data/spec/models/page_cache_spec.rb +0 -30
- data/spec/models/page_spec.rb +0 -91
- data/spec/models/ping_pinger_spec.rb +0 -33
- data/spec/models/ping_spec.rb +0 -154
- data/spec/models/redirect_spec.rb +0 -17
- data/spec/models/resource_spec.rb +0 -39
- data/spec/models/route_cache_spec.rb +0 -11
- data/spec/models/sidebar_spec.rb +0 -7
- data/spec/models/static_sidebar_spec.rb +0 -17
- data/spec/models/tag_spec.rb +0 -65
- data/spec/models/text_filter_spec.rb +0 -34
- data/spec/models/theme_spec.rb +0 -45
- data/spec/models/trackback_spec.rb +0 -60
- data/spec/models/trigger_spec.rb +0 -40
- data/spec/models/user_spec.rb +0 -198
- data/spec/rcov.opts +0 -2
- data/spec/spec.opts +0 -4
- data/spec/spec_helper.rb +0 -133
- data/spec/views/articles/index_spec.rb +0 -63
- data/spec/views/articles/read_spec.rb +0 -67
- data/spec/views/comments/html_sanitization_spec.rb +0 -119
- data/test/fixtures/blogs.yml +0 -27
- data/test/fixtures/categories.yml +0 -29
- data/test/fixtures/categorizations.yml +0 -31
- data/test/fixtures/contents.yml +0 -231
- data/test/fixtures/feedback.yml +0 -180
- data/test/fixtures/notification_mailer/article +0 -3
- data/test/fixtures/notification_mailer/comment +0 -3
- data/test/fixtures/notification_mailer/trackback +0 -3
- data/test/fixtures/notifications.yml +0 -0
- data/test/fixtures/page_caches.yml +0 -7
- data/test/fixtures/profiles.yml +0 -27
- data/test/fixtures/redirects.yml +0 -10
- data/test/fixtures/resources.yml +0 -21
- data/test/fixtures/sidebars.yml +0 -10
- data/test/fixtures/tags.yml +0 -10
- data/test/fixtures/text_filters.yml +0 -37
- data/test/fixtures/triggers.yml +0 -1
- data/test/fixtures/users.yml +0 -101
- data/test/mocks/test/dns_mock.rb +0 -13
- data/test/mocks/test/flickr_mock.rb +0 -30
- data/test/mocks/test/http_mock.rb +0 -39
- data/test/mocks/test/theme_mock.rb +0 -5
- data/test/mocks/test/xmlrpc_mock.rb +0 -28
- data/test/mocks/themes/123-numbers-in-path/about.markdown +0 -0
- data/test/mocks/themes/CamelCaseDirectory/about.markdown +0 -0
- data/test/mocks/themes/i-have-special-chars/about.markdown +0 -0
- data/test/mocks/themes/typographic/about.markdown +0 -7
- data/test/mocks/themes/typographic/images/Thumbs.db +0 -0
- data/test/mocks/themes/typographic/images/accept.png +0 -0
- data/test/mocks/themes/typographic/images/accept50.png +0 -0
- data/test/mocks/themes/typographic/images/bg_body.jpg +0 -0
- data/test/mocks/themes/typographic/images/bg_white.png +0 -0
- data/test/mocks/themes/typographic/images/bg_wrapper.jpg +0 -0
- data/test/mocks/themes/typographic/images/bullet_bottom.png +0 -0
- data/test/mocks/themes/typographic/images/bullet_right.png +0 -0
- data/test/mocks/themes/typographic/images/email_open.png +0 -0
- data/test/mocks/themes/typographic/images/email_open50.png +0 -0
- data/test/mocks/themes/typographic/images/meta.png +0 -0
- data/test/mocks/themes/typographic/images/page_edit.png +0 -0
- data/test/mocks/themes/typographic/images/page_edit50.png +0 -0
- data/test/mocks/themes/typographic/images/tag.png +0 -0
- data/test/mocks/themes/typographic/images/user.png +0 -0
- data/test/mocks/themes/typographic/images/user50.png +0 -0
- data/test/mocks/themes/typographic/images/world_link.png +0 -0
- data/test/mocks/themes/typographic/images/world_link50.png +0 -0
- data/test/mocks/themes/typographic/layouts/default.html.erb +0 -42
- data/test/mocks/themes/typographic/preview.png +0 -0
- data/test/mocks/themes/typographic/stylesheets/colors.css +0 -51
- data/test/mocks/themes/typographic/stylesheets/layout.css +0 -346
- data/test/mocks/themes/typographic/stylesheets/reset.css +0 -5
- data/test/mocks/themes/typographic/stylesheets/style.css +0 -36
- data/test/mocks/themes/typographic/views/articles/_article.html.erb +0 -41
- data/test/mocks/themes/typographic/views/articles/_comment.html.erb +0 -14
- data/test/mocks/themes/typographic/views/articles/_comment_form.html.erb +0 -48
- data/test/mocks/themes/typographic/views/articles/_comment_list.html.erb +0 -7
- data/test/mocks/themes/typographic/views/articles/_trackback.html.erb +0 -9
- data/test/mocks/themes/typographic/views/articles/comment_preview.html.erb +0 -10
- data/test/mocks/themes/typographic/views/articles/index.html.erb +0 -5
- data/test/mocks/themes/typographic/views/articles/read.html.erb +0 -42
- data/test/mocks/themes/typographic/views/shared/_search.html.erb +0 -17
- data/test/mocks/themes/typographic/views/theme/static_view_test.html.erb +0 -1
- data/test/test_helper.rb +0 -13
- data/themes/true-blue-3/images/frederic-de-villamil.jpg +0 -0
- 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
|