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
data/spec/models/blog_spec.rb
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe "Given the first Blog fixture" do
|
|
4
|
-
before(:each) {
|
|
5
|
-
Blog.destroy_all
|
|
6
|
-
RouteCache.clear
|
|
7
|
-
@blog = Factory.create :blog
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
it ":blog_name == 'test blog'" do
|
|
11
|
-
@blog.blog_name.should == 'test blog'
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it "values boolify like Perl" do
|
|
15
|
-
{"0 but true" => true, "" => false,
|
|
16
|
-
"false" => false, 1 => true, 0 => false,
|
|
17
|
-
nil => false, 'f' => false }.each do |value, expected|
|
|
18
|
-
@blog.sp_global = value
|
|
19
|
-
@blog.sp_global.should == expected
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe "running in the host root" do
|
|
24
|
-
it ":base_url == 'http://myblog.net/'" do
|
|
25
|
-
@blog.base_url.should == 'http://myblog.net'
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
describe "blog.url_for" do
|
|
29
|
-
it "should return the correct URL for a hash argument" do
|
|
30
|
-
@blog.url_for(:controller => 'articles', :action => 'read', :id => 1).should == 'http://myblog.net/articles/read/1'
|
|
31
|
-
end
|
|
32
|
-
it "should return the correct URL for a hash argument with only_path" do
|
|
33
|
-
@blog.base_url.should == 'http://myblog.net'
|
|
34
|
-
@blog.url_for(:controller => 'articles', :action => 'read', :id => 1,
|
|
35
|
-
:only_path => true).should == '/articles/read/1'
|
|
36
|
-
end
|
|
37
|
-
it "should return the correct URL for a string argument" do
|
|
38
|
-
@blog.url_for('articles/read/1').should == 'http://myblog.net/articles/read/1'
|
|
39
|
-
end
|
|
40
|
-
it "should return the correct URL for a hash argument with only_path" do
|
|
41
|
-
@blog.url_for('articles/read/1', :only_path => true).should == '/articles/read/1'
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
describe "running in a sub-URI" do
|
|
47
|
-
before :each do
|
|
48
|
-
@blog.base_url = 'http://myblog.net/sub-uri'
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
describe "blog.url_for" do
|
|
52
|
-
it "should return the correct URL for a hash argument" do
|
|
53
|
-
@blog.url_for(:controller => 'articles', :action => 'read',
|
|
54
|
-
:id => 1).should == 'http://myblog.net/sub-uri/articles/read/1'
|
|
55
|
-
end
|
|
56
|
-
it "should return the correct URL for a hash argument with only_path" do
|
|
57
|
-
@blog.url_for(:controller => 'articles', :action => 'read', :id => 1,
|
|
58
|
-
:only_path => true).should == '/sub-uri/articles/read/1'
|
|
59
|
-
end
|
|
60
|
-
it "should return the correct URL for a string argument" do
|
|
61
|
-
@blog.url_for('articles/read/1'
|
|
62
|
-
).should == 'http://myblog.net/sub-uri/articles/read/1'
|
|
63
|
-
end
|
|
64
|
-
it "should return the correct URL for a hash argument with only_path" do
|
|
65
|
-
@blog.url_for('articles/read/1',
|
|
66
|
-
:only_path => true).should == '/sub-uri/articles/read/1'
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
it "should be the only blog allowed" do
|
|
71
|
-
Blog.new.should_not be_valid
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
describe "The default blog" do
|
|
76
|
-
it "should pick up updates after a cache clear" do
|
|
77
|
-
a = Blog.default
|
|
78
|
-
b = blogs(:default)
|
|
79
|
-
b.blog_name = "some other name"
|
|
80
|
-
c = Blog.default
|
|
81
|
-
c.blog_name.should == "some other name"
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
describe "Given no blogs" do
|
|
87
|
-
before(:each) { Blog.destroy_all }
|
|
88
|
-
|
|
89
|
-
it "should allow the creation of a valid default blog" do
|
|
90
|
-
Blog.new.should be_valid
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
describe "Valid permalink in blog" do
|
|
95
|
-
|
|
96
|
-
before :each do
|
|
97
|
-
@blog = blogs(:default)
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
['foo', 'year', 'day', 'month', 'title', '%title', 'title%', '/year/month/day/title', '%title%.html.atom', '%title%.html.rss'].each do |permalink_type|
|
|
101
|
-
it "not valid with #{permalink_type}" do
|
|
102
|
-
assert_raise ActiveRecord::RecordInvalid do
|
|
103
|
-
@blog.permalink_format = permalink_type
|
|
104
|
-
end
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
['%year%', '%day%', '%month%', '%title%', '%title%.html', '/hello/all/%year%/%title%', 'atom/%title%.html', 'ok/rss/%title%.html'].each do |permalink_type|
|
|
109
|
-
it "should be valid with only #{permalink_type}" do
|
|
110
|
-
assert_nothing_raised ActiveRecord::RecordInvalid do
|
|
111
|
-
@blog.permalink_format = permalink_type
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
end
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe CacheInformation do
|
|
4
|
-
|
|
5
|
-
def cache_information(options={})
|
|
6
|
-
CacheInformation.new({:path => '/index.html'}.merge(options))
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
it 'should have path attribute' do
|
|
10
|
-
CacheInformation.new.should respond_to(:path)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
it 'should be valid' do
|
|
14
|
-
cache_information.should be_valid
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it 'should not save without path' do
|
|
18
|
-
cache_information(:path => nil).should_not be_valid
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it 'should have path unique' do
|
|
22
|
-
cache_information.save
|
|
23
|
-
cache_information.should_not be_valid
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it 'should destroy file in path when destroy' do
|
|
27
|
-
file_path = create_file_in_spec_public_cache_directory('index.html')
|
|
28
|
-
CacheInformation.create!(:path => '/index.html').destroy
|
|
29
|
-
File.should_not be_exist(file_path)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it "should destroy himself if path doesn't exist" do
|
|
33
|
-
CacheInformation.create!(:path => '/index.html').destroy
|
|
34
|
-
CacheInformation.find_by_path('/index.html').should be_nil
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
it "should logged in warning the path if path doesn't exist" do
|
|
38
|
-
Rails.logger.should_receive(:warn).with("path : /index.html no more exist")
|
|
39
|
-
CacheInformation.create!(:path => '/index.html').destroy
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
end
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'Given a published article' do
|
|
4
|
-
before(:each) do
|
|
5
|
-
@article = contents(:article1)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it "An unchanged article does not invalidate the cache" do
|
|
9
|
-
@article.should_not be_invalidates_cache
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it 'changing the body smashes the cache' do
|
|
13
|
-
@article.body = "New Body"
|
|
14
|
-
@article.should be_invalidates_cache
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it 'withdrawing it smashes the cache' do
|
|
18
|
-
@article.withdraw!
|
|
19
|
-
@article.should be_invalidates_cache
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it 'destroying it smashes the cache' do
|
|
23
|
-
@article.destroy
|
|
24
|
-
@article.should be_invalidates_cache(true)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
it 'withdrawing, then destroying it smashes the cache' do
|
|
28
|
-
@article.withdraw
|
|
29
|
-
@article.destroy
|
|
30
|
-
@article.should be_invalidates_cache
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
describe "Given an unpublished article" do
|
|
35
|
-
before(:each) { @article = contents(:article4) }
|
|
36
|
-
|
|
37
|
-
it "publishing smashes the cache" do
|
|
38
|
-
@article.publish!
|
|
39
|
-
@article.should be_invalidates_cache
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it "changing it keeps the cache" do
|
|
43
|
-
@article.body = 'New body'
|
|
44
|
-
@article.should_not be_invalidates_cache
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it "destroying it keeps the cache" do
|
|
48
|
-
@article.destroy
|
|
49
|
-
@article.should_not be_invalidates_cache
|
|
50
|
-
end
|
|
51
|
-
end
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'Given the results of Category.find_all_with_article_counters' do
|
|
4
|
-
before(:each) { @cats = Category.find_all_with_article_counters }
|
|
5
|
-
|
|
6
|
-
it "Categories should be sorted by category.position" do
|
|
7
|
-
@cats.should == @cats.sort_by { |c| c.position }
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it "Counts should be correct" do
|
|
11
|
-
@cats.each do |cat|
|
|
12
|
-
cat.article_counter.should == cat.published_articles.size
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
describe 'Given the fixtures' do
|
|
18
|
-
it 'find gets the order right' do
|
|
19
|
-
cats = Category.find(:all)
|
|
20
|
-
cats.should == cats.sort_by { |c| c.position }
|
|
21
|
-
Category.reorder(cats.reverse.collect { |c| c.id })
|
|
22
|
-
Category.find(:all).should == cats.reverse
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
it 'can still override order in find' do
|
|
26
|
-
cats = Category.find(:all, :order => 'name ASC')
|
|
27
|
-
|
|
28
|
-
cats.should == cats.sort_by {|c| c.name}
|
|
29
|
-
Category.find(:all).should_not == cats
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it '.reorder_alpha puts categories in alphabetical order' do
|
|
33
|
-
Category.find(:all).should_not == Category.find(:all, :order => :name)
|
|
34
|
-
Category.reorder_alpha
|
|
35
|
-
Category.find(:all).should == Category.find(:all, :order => :name)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it 'A category knows its url' do
|
|
39
|
-
categories(:software).permalink_url.should ==
|
|
40
|
-
'http://myblog.net/category/software'
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
|
data/spec/models/comment_spec.rb
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + "/../spec_helper"
|
|
2
|
-
|
|
3
|
-
require 'dns_mock'
|
|
4
|
-
|
|
5
|
-
describe Comment do
|
|
6
|
-
|
|
7
|
-
def valid_comment(options={})
|
|
8
|
-
Comment.new({:author => 'Bob',
|
|
9
|
-
:article_id => contents(:article1).id,
|
|
10
|
-
:body => 'nice post',
|
|
11
|
-
:ip => '1.2.3.4'}.merge(options))
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
describe '#permalink_url' do
|
|
15
|
-
it 'should render permalink to comment in public part' do
|
|
16
|
-
c = feedback(:old_comment)
|
|
17
|
-
assert_equal "http://myblog.net/2004/05/01/inactive-article#comment-#{c.id}", c.permalink_url
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
describe '#edit_url' do
|
|
22
|
-
it 'should get a url where edit comment in admin' do
|
|
23
|
-
c = feedback(:old_comment)
|
|
24
|
-
assert_equal "http://myblog.net/admin/comments/edit/#{c.id}", c.edit_url
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
describe '#delete_url' do
|
|
29
|
-
it 'should get the delete url of comment in admin part' do
|
|
30
|
-
c = feedback(:old_comment)
|
|
31
|
-
assert_equal "http://myblog.net/admin/comments/destroy/#{c.id}", c.delete_url
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
describe '#save' do
|
|
36
|
-
|
|
37
|
-
it 'should save good comment' do
|
|
38
|
-
assert feedback(:comment2).save
|
|
39
|
-
assert_equal "http://www.google.com", feedback(:comment2).url
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it 'should save spam comment' do
|
|
43
|
-
assert feedback(:spam_comment).save
|
|
44
|
-
assert_equal "http://fakeurl.com", feedback(:spam_comment).url
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it 'should not save in invalid article' do
|
|
48
|
-
c = valid_comment(:author => "Old Spammer",
|
|
49
|
-
:body => "Old trackback body",
|
|
50
|
-
:article => contents(:inactive_article))
|
|
51
|
-
|
|
52
|
-
assert ! c.save
|
|
53
|
-
assert c.errors.invalid?('article_id')
|
|
54
|
-
|
|
55
|
-
c.article = contents(:article1)
|
|
56
|
-
|
|
57
|
-
assert c.save
|
|
58
|
-
assert c.errors.empty?
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
it 'should change old comment' do
|
|
62
|
-
c = contents(:inactive_article).comments.first
|
|
63
|
-
c.body = 'Comment body <em>italic</em> <strong>bold</strong>'
|
|
64
|
-
assert c.save
|
|
65
|
-
assert c.errors.empty?
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
it 'should save a valid comment' do
|
|
69
|
-
c = valid_comment # article created 2 days ago
|
|
70
|
-
c.save.should be_true
|
|
71
|
-
c.errors.should be_empty
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
it 'should not save with article not allow comment' do
|
|
75
|
-
b = Blog.default
|
|
76
|
-
b.sp_article_auto_close = 1
|
|
77
|
-
b.save
|
|
78
|
-
|
|
79
|
-
c = valid_comment # article created 2 days ago
|
|
80
|
-
c.save.should_not be_true
|
|
81
|
-
c.errors.should_not be_empty
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
describe '#create' do
|
|
87
|
-
|
|
88
|
-
it 'should create comment' do
|
|
89
|
-
c = valid_comment
|
|
90
|
-
assert c.save
|
|
91
|
-
assert c.guid.size > 15
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
describe '#spam?' do
|
|
97
|
-
it 'should reject spam rbl' do
|
|
98
|
-
c = valid_comment(:author => "Spammer",
|
|
99
|
-
:body => %{This is just some random text. <a href="http://chinaaircatering.com">without any senses.</a>. Please disregard.},
|
|
100
|
-
:url => "http://buy-computer.us")
|
|
101
|
-
should_be_spam(c)
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
it 'should not define spam a comment rbl with lookup succeeds' do
|
|
105
|
-
c = valid_comment(:author => "Not a Spammer",
|
|
106
|
-
:body => "Useful commentary!",
|
|
107
|
-
:url => "http://www.bofh.org.uk")
|
|
108
|
-
c.should_not be_spam
|
|
109
|
-
c.should_not be_status_confirmed
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
it 'should reject spam with uri limit' do
|
|
113
|
-
c = valid_comment(:author => "Yet Another Spammer",
|
|
114
|
-
:body => %{ <a href="http://www.one.com/">one</a> <a href="http://www.two.com/">two</a> <a href="http://www.three.com/">three</a> <a href="http://www.four.com/">four</a> },
|
|
115
|
-
:url => "http://www.uri-limit.com")
|
|
116
|
-
should_be_spam(c)
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
def should_be_spam(comment)
|
|
120
|
-
comment.should be_spam
|
|
121
|
-
comment.should_not be_status_confirmed
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
it 'should have good relation' do
|
|
127
|
-
assert feedback(:comment2).article
|
|
128
|
-
assert_equal contents(:article1), feedback(:comment2).article
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
describe 'reject xss' do
|
|
132
|
-
before(:each) do
|
|
133
|
-
@comment = Comment.new do |c|
|
|
134
|
-
c.body = "Test foo <script>do_evil();</script>"
|
|
135
|
-
c.author = 'Bob'
|
|
136
|
-
c.article_id = contents(:article1).id
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
['','textile','markdown','smartypants','markdown smartypants'].each do |filter|
|
|
140
|
-
it "should reject with filter #{filter}" do
|
|
141
|
-
Blog.default.comment_text_filter = filter
|
|
142
|
-
|
|
143
|
-
assert @comment.save
|
|
144
|
-
assert @comment.errors.empty?
|
|
145
|
-
|
|
146
|
-
assert @comment.html(:body) !~ /<script>/
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
describe 'change state' do
|
|
152
|
-
it 'should becomes withdraw' do
|
|
153
|
-
c = Comment.find(feedback(:comment2).id)
|
|
154
|
-
assert c.withdraw!
|
|
155
|
-
assert ! c.published?
|
|
156
|
-
assert c.spam?
|
|
157
|
-
assert c.status_confirmed?
|
|
158
|
-
c.reload
|
|
159
|
-
assert ! c.published?
|
|
160
|
-
assert c.spam?
|
|
161
|
-
assert c.status_confirmed?
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
it 'should becomes not published in article if withdraw' do
|
|
165
|
-
a = Article.new(:title => 'foo')
|
|
166
|
-
assert a.save
|
|
167
|
-
|
|
168
|
-
assert_equal 0, a.published_comments.size
|
|
169
|
-
c = a.comments.build(:body => 'foo', :author => 'bob', :published => true, :published_at => Time.now)
|
|
170
|
-
assert c.save
|
|
171
|
-
assert c.published?
|
|
172
|
-
c.reload
|
|
173
|
-
a.reload
|
|
174
|
-
|
|
175
|
-
assert_equal 1, a.published_comments.size
|
|
176
|
-
c.withdraw!
|
|
177
|
-
|
|
178
|
-
a = Article.new(:title => 'foo')
|
|
179
|
-
assert_equal 0, a.published_comments.size
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
it 'should becomes not confirmed in article if withdraw' do
|
|
183
|
-
a = contents(:spammed_article)
|
|
184
|
-
assert !a.comments[0].status_confirmed?
|
|
185
|
-
assert a.comments[1].status_confirmed?
|
|
186
|
-
|
|
187
|
-
a.reload
|
|
188
|
-
assert_equal 1,
|
|
189
|
-
a.comments.find_all_by_status_confirmed(true).size
|
|
190
|
-
assert_equal 1,
|
|
191
|
-
a.comments.find_all_by_status_confirmed(true).size
|
|
192
|
-
a.comments[0].withdraw!
|
|
193
|
-
assert_equal 2,
|
|
194
|
-
a.comments.find_all_by_status_confirmed(true).size
|
|
195
|
-
end
|
|
196
|
-
end
|
|
197
|
-
|
|
198
|
-
it 'should have good default filter' do
|
|
199
|
-
a = Comment.find(:first)
|
|
200
|
-
assert_equal 'markdown', a.default_text_filter.name
|
|
201
|
-
end
|
|
202
|
-
|
|
203
|
-
describe 'with feedback moderation enabled' do
|
|
204
|
-
before(:each) do
|
|
205
|
-
@blog = Blog.default
|
|
206
|
-
@blog.sp_global = false
|
|
207
|
-
@blog.default_moderate_comments = true
|
|
208
|
-
@blog.save!
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
it 'should save comment as presumably spam' do
|
|
212
|
-
comment = Comment.new do |c|
|
|
213
|
-
c.body = "Test foo"
|
|
214
|
-
c.author = 'Bob'
|
|
215
|
-
c.article_id = contents(:article1).id
|
|
216
|
-
end
|
|
217
|
-
assert comment.save!
|
|
218
|
-
|
|
219
|
-
assert ! comment.published?
|
|
220
|
-
assert comment.spam?
|
|
221
|
-
assert ! comment.status_confirmed?
|
|
222
|
-
end
|
|
223
|
-
|
|
224
|
-
it 'should save comment as confirmed ham' do
|
|
225
|
-
comment = Comment.new do |c|
|
|
226
|
-
c.body = "Test foo"
|
|
227
|
-
c.author = 'Bob'
|
|
228
|
-
c.article_id = contents(:article1).id
|
|
229
|
-
c.user_id = users(:tobi).id
|
|
230
|
-
end
|
|
231
|
-
assert comment.save!
|
|
232
|
-
|
|
233
|
-
assert comment.published?
|
|
234
|
-
assert comment.ham?
|
|
235
|
-
assert comment.status_confirmed?
|
|
236
|
-
|
|
237
|
-
end
|
|
238
|
-
end
|
|
239
|
-
|
|
240
|
-
end
|