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,18 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe Admin::CacheController, "rough port of the old functional test" do
|
|
4
|
-
|
|
5
|
-
before(:each) do
|
|
6
|
-
request.session = { :user => users(:tobi).id }
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
describe 'sweep_html action' do
|
|
10
|
-
|
|
11
|
-
it 'should redirect to setting index' do
|
|
12
|
-
get 'sweep_html'
|
|
13
|
-
response.should redirect_to(:controller => '/admin/settings')
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
end
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe Admin::CategoriesController do
|
|
4
|
-
integrate_views
|
|
5
|
-
|
|
6
|
-
before do
|
|
7
|
-
request.session = { :user => users(:tobi).id }
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it "test_index" do
|
|
11
|
-
get :index
|
|
12
|
-
assert_template 'index'
|
|
13
|
-
assert_template_has 'categories'
|
|
14
|
-
assert_tag :tag => "div",
|
|
15
|
-
:attributes => { :id => "category_container" }
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "test_create" do
|
|
19
|
-
assert_difference 'Category.count' do
|
|
20
|
-
post :edit, 'category' => { :name => "test category" }
|
|
21
|
-
assert_response :redirect, :action => 'index'
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
it "test_edit" do
|
|
26
|
-
get :edit, :id => categories(:software).id
|
|
27
|
-
assert_template 'new'
|
|
28
|
-
assert_template_has 'category'
|
|
29
|
-
assert assigns(:category).valid?
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it "test_update" do
|
|
33
|
-
post :edit, :id => categories(:software).id
|
|
34
|
-
assert_response :redirect, :action => 'index'
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
it "test_destroy" do
|
|
38
|
-
test_id = categories(:software).id
|
|
39
|
-
assert_not_nil Category.find(test_id)
|
|
40
|
-
|
|
41
|
-
get :destroy, :id => test_id
|
|
42
|
-
assert_response :success
|
|
43
|
-
assert_template 'destroy'
|
|
44
|
-
|
|
45
|
-
post :destroy, :id => test_id
|
|
46
|
-
assert_response :redirect, :action => 'index'
|
|
47
|
-
|
|
48
|
-
assert_raise(ActiveRecord::RecordNotFound) { Category.find(test_id) }
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
it "test_order" do
|
|
52
|
-
assert_equal categories(:software), Category.find(:first, :order => :position)
|
|
53
|
-
get :order, :category_list => [categories(:personal).id, categories(:hardware).id, categories(:software).id]
|
|
54
|
-
assert_response :success
|
|
55
|
-
assert_equal categories(:personal), Category.find(:first, :order => :position)
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
it "test_asort" do
|
|
59
|
-
assert_equal categories(:software), Category.find(:first, :order => :position)
|
|
60
|
-
get :asort
|
|
61
|
-
assert_response :success
|
|
62
|
-
assert_template "_categories"
|
|
63
|
-
assert_equal categories(:hardware), Category.find(:first, :order => :position)
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
it "test_reorder" do
|
|
67
|
-
get :reorder
|
|
68
|
-
assert_response :success
|
|
69
|
-
assert_template "reorder"
|
|
70
|
-
assert_select 'ul#category_list > li', Category.count
|
|
71
|
-
assert_select 'a', '(Done)'
|
|
72
|
-
end
|
|
73
|
-
end
|
|
@@ -1,443 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
-
|
|
3
|
-
require 'http_mock'
|
|
4
|
-
|
|
5
|
-
describe Admin::ContentController do
|
|
6
|
-
integrate_views
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
# Like it's a shared, need call everywhere
|
|
10
|
-
describe 'index action', :shared => true do
|
|
11
|
-
|
|
12
|
-
it 'should render template index' do
|
|
13
|
-
get 'index'
|
|
14
|
-
response.should render_template('index')
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it 'should see all published in index' do
|
|
18
|
-
get :index, :search => {:published => '0', :published_at => '2008-08', :user_id => '2'}
|
|
19
|
-
response.should render_template('index')
|
|
20
|
-
response.should be_success
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it 'should restrict only by searchstring' do
|
|
24
|
-
get :index, :search => {:searchstring => 'originally'}
|
|
25
|
-
assigns(:articles).should == [contents(:xmltest)]
|
|
26
|
-
response.should render_template('index')
|
|
27
|
-
response.should be_success
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it 'should restrict by searchstring and published_at' do
|
|
31
|
-
get :index, :search => {:searchstring => 'originally', :published_at => '2008-08'}
|
|
32
|
-
assigns(:articles).should be_empty
|
|
33
|
-
response.should render_template('index')
|
|
34
|
-
response.should be_success
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
describe 'autosave action', :shared => true do
|
|
40
|
-
it 'should save new article with draft status and link to other article if first autosave' do
|
|
41
|
-
lambda do
|
|
42
|
-
lambda do
|
|
43
|
-
post :autosave, :article => {:allow_comments => '1',
|
|
44
|
-
:body_and_extended => 'my draft in autosave',
|
|
45
|
-
:keywords => 'mientag',
|
|
46
|
-
:permalink => 'big-post',
|
|
47
|
-
:title => 'big post',
|
|
48
|
-
:text_filter => 'none',
|
|
49
|
-
:published => '1',
|
|
50
|
-
:published_at => 'December 23, 2009 03:20 PM'}
|
|
51
|
-
end.should change(Article, :count)
|
|
52
|
-
end.should change(Tag, :count)
|
|
53
|
-
result = Article.last
|
|
54
|
-
result.body.should == 'my draft in autosave'
|
|
55
|
-
result.title.should == 'big post'
|
|
56
|
-
result.permalink.should == 'big-post'
|
|
57
|
-
result.parent_id.should be_nil
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
describe "for a published article" do
|
|
61
|
-
before :each do
|
|
62
|
-
@article = contents(:article1)
|
|
63
|
-
@data = {:allow_comments => @article.allow_comments,
|
|
64
|
-
:body_and_extended => 'my draft in autosave',
|
|
65
|
-
:keywords => '',
|
|
66
|
-
:permalink => @article.permalink,
|
|
67
|
-
:title => @article.title,
|
|
68
|
-
:text_filter => @article.text_filter,
|
|
69
|
-
:published => '1',
|
|
70
|
-
:published_at => 'December 23, 2009 03:20 PM'}
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
it 'should create a draft article with proper attributes and existing article as a parent' do
|
|
74
|
-
lambda do
|
|
75
|
-
post :autosave, :id => @article.id, :article => @data
|
|
76
|
-
end.should change(Article, :count)
|
|
77
|
-
result = Article.last
|
|
78
|
-
result.body.should == 'my draft in autosave'
|
|
79
|
-
result.title.should == @article.title
|
|
80
|
-
result.permalink.should == @article.permalink
|
|
81
|
-
result.parent_id.should == @article.id
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
it 'should not create another draft article with parent_id if article has already a draft associated' do
|
|
85
|
-
draft = Article.create!(@article.attributes.merge(:guid => nil, :state => 'draft', :parent_id => @article.id))
|
|
86
|
-
lambda do
|
|
87
|
-
post :autosave, :id => @article.id, :article => @data
|
|
88
|
-
end.should_not change(Article, :count)
|
|
89
|
-
Article.last.parent_id.should == @article.id
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
it 'should create a draft with the same permalink even if the title has changed' do
|
|
93
|
-
@data[:title] = @article.title + " more stuff"
|
|
94
|
-
lambda do
|
|
95
|
-
post :autosave, :id => @article.id, :article => @data
|
|
96
|
-
end.should change(Article, :count)
|
|
97
|
-
result = Article.last
|
|
98
|
-
result.parent_id.should == @article.id
|
|
99
|
-
result.permalink.should == @article.permalink
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
describe 'insert_editor action' do
|
|
105
|
-
|
|
106
|
-
before do
|
|
107
|
-
@user = users(:tobi)
|
|
108
|
-
request.session = { :user => @user.id }
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
it 'should render _simple_editor' do
|
|
112
|
-
get(:insert_editor, :editor => 'simple')
|
|
113
|
-
response.should render_template('_simple_editor')
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
it 'should render _visual_editor' do
|
|
117
|
-
get(:insert_editor, :editor => 'visual')
|
|
118
|
-
response.should render_template('_visual_editor')
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
describe 'new action', :shared => true do
|
|
125
|
-
|
|
126
|
-
it 'should render new with get' do
|
|
127
|
-
get :new
|
|
128
|
-
response.should render_template('new')
|
|
129
|
-
assert_template_has 'article'
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
def base_article(options={})
|
|
133
|
-
{ :title => "posted via tests!",
|
|
134
|
-
:body => "A good body",
|
|
135
|
-
:keywords => "tagged",
|
|
136
|
-
:allow_comments => '1',
|
|
137
|
-
:allow_pings => '1' }.merge(options)
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
it 'should create article with no comments' do
|
|
141
|
-
post(:new, 'article' => base_article({:allow_comments => '0'}),
|
|
142
|
-
'categories' => [categories(:software).id])
|
|
143
|
-
assigns(:article).should_not be_allow_comments
|
|
144
|
-
assigns(:article).should be_allow_pings
|
|
145
|
-
assigns(:article).should be_published
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
it 'should create article with no pings' do
|
|
149
|
-
post(:new, 'article' => {:allow_pings => '0'},
|
|
150
|
-
'categories' => [categories(:software).id])
|
|
151
|
-
assigns(:article).should be_allow_comments
|
|
152
|
-
assigns(:article).should_not be_allow_pings
|
|
153
|
-
assigns(:article).should be_published
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
it 'should create' do
|
|
157
|
-
begin
|
|
158
|
-
u = users(:randomuser)
|
|
159
|
-
u.notify_via_email = true
|
|
160
|
-
u.notify_on_new_articles = true
|
|
161
|
-
u.save!
|
|
162
|
-
ActionMailer::Base.perform_deliveries = true
|
|
163
|
-
ActionMailer::Base.deliveries = []
|
|
164
|
-
category = Factory(:category)
|
|
165
|
-
emails = ActionMailer::Base.deliveries
|
|
166
|
-
|
|
167
|
-
assert_difference 'Article.count_published_articles' do
|
|
168
|
-
tags = ['foo', 'bar', 'baz bliz', 'gorp gack gar']
|
|
169
|
-
post :new,
|
|
170
|
-
'article' => base_article(:keywords => tags) ,
|
|
171
|
-
'categories' => [category.id]
|
|
172
|
-
assert_response :redirect, :action => 'show'
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
new_article = Article.last
|
|
176
|
-
assert_equal @user, new_article.user
|
|
177
|
-
assert_equal 1, new_article.categories.size
|
|
178
|
-
assert_equal [category], new_article.categories
|
|
179
|
-
assert_equal 4, new_article.tags.size
|
|
180
|
-
|
|
181
|
-
assert_equal(1, emails.size)
|
|
182
|
-
assert_equal('randomuser@example.com', emails.first.to[0])
|
|
183
|
-
ensure
|
|
184
|
-
ActionMailer::Base.perform_deliveries = false
|
|
185
|
-
end
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
it 'should create article in future' do
|
|
189
|
-
assert_no_difference 'Article.count_published_articles' do
|
|
190
|
-
post(:new,
|
|
191
|
-
:article => base_article(:published_at => Time.now + 1.hour) )
|
|
192
|
-
assert_response :redirect, :action => 'show'
|
|
193
|
-
assigns(:article).should_not be_published
|
|
194
|
-
end
|
|
195
|
-
assert_equal 1, Trigger.count
|
|
196
|
-
end
|
|
197
|
-
|
|
198
|
-
it 'should create a filtered article' do
|
|
199
|
-
body = "body via *markdown*"
|
|
200
|
-
extended="*foo*"
|
|
201
|
-
post :new, 'article' => { :title => "another test", :body => body, :extended => extended}
|
|
202
|
-
assert_response :redirect, :action => 'show'
|
|
203
|
-
|
|
204
|
-
new_article = Article.find(:first, :order => "created_at DESC")
|
|
205
|
-
assert_equal body, new_article.body
|
|
206
|
-
assert_equal extended, new_article.extended
|
|
207
|
-
assert_equal "markdown", new_article.text_filter.name
|
|
208
|
-
assert_equal "<p>body via <em>markdown</em></p>", new_article.html(:body)
|
|
209
|
-
assert_equal "<p><em>foo</em></p>", new_article.html(:extended)
|
|
210
|
-
end
|
|
211
|
-
|
|
212
|
-
end
|
|
213
|
-
|
|
214
|
-
describe 'destroy action', :shared => true do
|
|
215
|
-
|
|
216
|
-
it 'should_not destroy article by get' do
|
|
217
|
-
assert_no_difference 'Article.count' do
|
|
218
|
-
art_id = @article.id
|
|
219
|
-
assert_not_nil Article.find(art_id)
|
|
220
|
-
|
|
221
|
-
get :destroy, 'id' => art_id
|
|
222
|
-
response.should be_success
|
|
223
|
-
end
|
|
224
|
-
end
|
|
225
|
-
|
|
226
|
-
it 'should destroy article by post' do
|
|
227
|
-
assert_difference 'Article.count', -1 do
|
|
228
|
-
art_id = @article.id
|
|
229
|
-
post :destroy, 'id' => art_id
|
|
230
|
-
response.should redirect_to(:action => 'index')
|
|
231
|
-
|
|
232
|
-
lambda{
|
|
233
|
-
article = Article.find(art_id)
|
|
234
|
-
}.should raise_error(ActiveRecord::RecordNotFound)
|
|
235
|
-
end
|
|
236
|
-
end
|
|
237
|
-
|
|
238
|
-
end
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
describe 'with admin connection' do
|
|
242
|
-
|
|
243
|
-
before do
|
|
244
|
-
@user = users(:tobi)
|
|
245
|
-
@article = contents(:article1)
|
|
246
|
-
request.session = { :user => @user.id }
|
|
247
|
-
end
|
|
248
|
-
|
|
249
|
-
it_should_behave_like 'index action'
|
|
250
|
-
it_should_behave_like 'new action'
|
|
251
|
-
it_should_behave_like 'destroy action'
|
|
252
|
-
it_should_behave_like 'autosave action'
|
|
253
|
-
|
|
254
|
-
describe 'edit action' do
|
|
255
|
-
|
|
256
|
-
it 'should edit article' do
|
|
257
|
-
get :edit, 'id' => contents(:article1).id
|
|
258
|
-
response.should render_template('new')
|
|
259
|
-
assert_template_has 'article'
|
|
260
|
-
assigns(:article).should be_valid
|
|
261
|
-
response.should have_text(/body/)
|
|
262
|
-
response.should have_text(/extended content/)
|
|
263
|
-
end
|
|
264
|
-
|
|
265
|
-
it 'should update article by edit action' do
|
|
266
|
-
begin
|
|
267
|
-
ActionMailer::Base.perform_deliveries = true
|
|
268
|
-
emails = ActionMailer::Base.deliveries
|
|
269
|
-
emails.clear
|
|
270
|
-
|
|
271
|
-
art_id = contents(:article1).id
|
|
272
|
-
|
|
273
|
-
body = "another *textile* test"
|
|
274
|
-
post :edit, 'id' => art_id, 'article' => {:body => body, :text_filter => 'textile'}
|
|
275
|
-
assert_response :redirect, :action => 'show', :id => art_id
|
|
276
|
-
|
|
277
|
-
article = contents(:article1).reload
|
|
278
|
-
article.text_filter.name.should == "textile"
|
|
279
|
-
body.should == article.body
|
|
280
|
-
|
|
281
|
-
emails.size.should == 0
|
|
282
|
-
ensure
|
|
283
|
-
ActionMailer::Base.perform_deliveries = false
|
|
284
|
-
end
|
|
285
|
-
end
|
|
286
|
-
|
|
287
|
-
it 'should allow updating body_and_extended' do
|
|
288
|
-
article = contents(:article1)
|
|
289
|
-
post :edit, 'id' => article.id, 'article' => {
|
|
290
|
-
'body_and_extended' => 'foo<!--more-->bar<!--more-->baz'
|
|
291
|
-
}
|
|
292
|
-
assert_response :redirect
|
|
293
|
-
article.reload
|
|
294
|
-
article.body.should == 'foo'
|
|
295
|
-
article.extended.should == 'bar<!--more-->baz'
|
|
296
|
-
end
|
|
297
|
-
|
|
298
|
-
it 'should delete draft about this article if update' do
|
|
299
|
-
article = contents(:article1)
|
|
300
|
-
draft = Article.create!(article.attributes.merge(:state => 'draft', :parent_id => article.id, :guid => nil))
|
|
301
|
-
lambda do
|
|
302
|
-
post :edit, 'id' => article.id, 'article' => { 'title' => 'new'}
|
|
303
|
-
end.should change(Article, :count).by(-1)
|
|
304
|
-
Article.should_not be_exists({:id => draft.id})
|
|
305
|
-
end
|
|
306
|
-
|
|
307
|
-
it 'should delete all draft about this article if update not happen but why not' do
|
|
308
|
-
article = contents(:article1)
|
|
309
|
-
draft = Article.create!(article.attributes.merge(:state => 'draft', :parent_id => article.id, :guid => nil))
|
|
310
|
-
draft_2 = Article.create!(article.attributes.merge(:state => 'draft', :parent_id => article.id, :guid => nil))
|
|
311
|
-
lambda do
|
|
312
|
-
post :edit, 'id' => article.id, 'article' => { 'title' => 'new'}
|
|
313
|
-
end.should change(Article, :count).by(-2)
|
|
314
|
-
Article.should_not be_exists({:id => draft.id})
|
|
315
|
-
Article.should_not be_exists({:id => draft_2.id})
|
|
316
|
-
end
|
|
317
|
-
end
|
|
318
|
-
|
|
319
|
-
describe 'resource_add action' do
|
|
320
|
-
|
|
321
|
-
it 'should add resource' do
|
|
322
|
-
art_id = contents(:article1).id
|
|
323
|
-
get :resource_add, :id => art_id, :resource_id => resources(:resource1).id
|
|
324
|
-
|
|
325
|
-
response.should render_template('_show_resources')
|
|
326
|
-
assigns(:article).should be_valid
|
|
327
|
-
assigns(:resource).should be_valid
|
|
328
|
-
assert Article.find(art_id).resources.include?(resources(:resource1))
|
|
329
|
-
assert_not_nil assigns(:article)
|
|
330
|
-
assert_not_nil assigns(:resource)
|
|
331
|
-
assert_not_nil assigns(:resources)
|
|
332
|
-
end
|
|
333
|
-
|
|
334
|
-
end
|
|
335
|
-
|
|
336
|
-
describe 'resource_remove action' do
|
|
337
|
-
|
|
338
|
-
it 'should remove resource' do
|
|
339
|
-
art_id = contents(:article1).id
|
|
340
|
-
get :resource_remove, :id => art_id, :resource_id => resources(:resource1).id
|
|
341
|
-
|
|
342
|
-
response.should render_template('_show_resources')
|
|
343
|
-
assert assigns(:article).valid?
|
|
344
|
-
assert assigns(:resource).valid?
|
|
345
|
-
assert !Article.find(art_id).resources.include?(resources(:resource1))
|
|
346
|
-
assert_not_nil assigns(:article)
|
|
347
|
-
assert_not_nil assigns(:resource)
|
|
348
|
-
assert_not_nil assigns(:resources)
|
|
349
|
-
end
|
|
350
|
-
end
|
|
351
|
-
|
|
352
|
-
describe 'auto_complete_for_article_keywords action' do
|
|
353
|
-
it 'should return foo for keywords fo' do
|
|
354
|
-
get :auto_complete_for_article_keywords, :article => {:keywords => 'fo'}
|
|
355
|
-
response.should be_success
|
|
356
|
-
response.body.should == '<ul><li>foo</li></ul>'
|
|
357
|
-
end
|
|
358
|
-
|
|
359
|
-
it 'should return nothing for hello' do
|
|
360
|
-
get :auto_complete_for_article_keywords, :article => {:keywords => 'hello'}
|
|
361
|
-
response.should be_success
|
|
362
|
-
response.body.should == '<ul></ul>'
|
|
363
|
-
end
|
|
364
|
-
|
|
365
|
-
it 'should return bar and baz for ba keyword' do
|
|
366
|
-
get :auto_complete_for_article_keywords, :article => {:keywords => 'ba'}
|
|
367
|
-
response.should be_success
|
|
368
|
-
response.body.should == '<ul><li>bar</li><li>bazz</li></ul>'
|
|
369
|
-
end
|
|
370
|
-
end
|
|
371
|
-
|
|
372
|
-
end
|
|
373
|
-
|
|
374
|
-
describe 'with publisher connection' do
|
|
375
|
-
|
|
376
|
-
before :each do
|
|
377
|
-
@user = users(:user_publisher)
|
|
378
|
-
@article = contents(:publisher_article)
|
|
379
|
-
request.session = {:user => @user.id}
|
|
380
|
-
end
|
|
381
|
-
|
|
382
|
-
it_should_behave_like 'index action'
|
|
383
|
-
it_should_behave_like 'new action'
|
|
384
|
-
it_should_behave_like 'destroy action'
|
|
385
|
-
|
|
386
|
-
describe 'edit action' do
|
|
387
|
-
|
|
388
|
-
it "should redirect if edit article doesn't his" do
|
|
389
|
-
get :edit, :id => contents(:article1).id
|
|
390
|
-
response.should redirect_to(:action => 'index')
|
|
391
|
-
end
|
|
392
|
-
|
|
393
|
-
it 'should edit article' do
|
|
394
|
-
get :edit, 'id' => contents(:publisher_article).id
|
|
395
|
-
response.should render_template('new')
|
|
396
|
-
assert_template_has 'article'
|
|
397
|
-
assigns(:article).should be_valid
|
|
398
|
-
end
|
|
399
|
-
|
|
400
|
-
it 'should update article by edit action' do
|
|
401
|
-
begin
|
|
402
|
-
ActionMailer::Base.perform_deliveries = true
|
|
403
|
-
emails = ActionMailer::Base.deliveries
|
|
404
|
-
emails.clear
|
|
405
|
-
|
|
406
|
-
art_id = contents(:publisher_article).id
|
|
407
|
-
|
|
408
|
-
body = "another *textile* test"
|
|
409
|
-
post :edit, 'id' => art_id, 'article' => {:body => body, :text_filter => 'textile'}
|
|
410
|
-
response.should redirect_to(:action => 'index')
|
|
411
|
-
|
|
412
|
-
article = contents(:publisher_article).reload
|
|
413
|
-
article.text_filter.name.should == "textile"
|
|
414
|
-
body.should == article.body
|
|
415
|
-
|
|
416
|
-
emails.size.should == 0
|
|
417
|
-
ensure
|
|
418
|
-
ActionMailer::Base.perform_deliveries = false
|
|
419
|
-
end
|
|
420
|
-
end
|
|
421
|
-
end
|
|
422
|
-
|
|
423
|
-
describe 'destroy action can be access' do
|
|
424
|
-
|
|
425
|
-
it 'should redirect when want destroy article' do
|
|
426
|
-
assert_no_difference 'Article.count' do
|
|
427
|
-
get :destroy, :id => contents(:article1)
|
|
428
|
-
response.should redirect_to(:action => 'index')
|
|
429
|
-
end
|
|
430
|
-
end
|
|
431
|
-
|
|
432
|
-
it 'should redirect when want destroy article' do
|
|
433
|
-
assert_no_difference 'Article.count' do
|
|
434
|
-
post :destroy, :id => contents(:article1)
|
|
435
|
-
response.should redirect_to(:action => 'index')
|
|
436
|
-
end
|
|
437
|
-
end
|
|
438
|
-
|
|
439
|
-
end
|
|
440
|
-
|
|
441
|
-
end
|
|
442
|
-
|
|
443
|
-
end
|