typo 5.4.4 → 5.5
Sign up to get free protection for your applications and to get access to all the features.
- 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,91 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
3
|
-
describe 'Given a new blog' do
|
4
|
-
before(:each) do
|
5
|
-
Blog.delete_all
|
6
|
-
@blog = Blog.new
|
7
|
-
end
|
8
|
-
|
9
|
-
# Must find a better name for this key!
|
10
|
-
it 'Global spam protection is not enabled' do
|
11
|
-
@blog.should_not be_sp_global
|
12
|
-
end
|
13
|
-
|
14
|
-
it '#blog_name should be My Shiny Weblog!' do
|
15
|
-
@blog.blog_name.should == 'My Shiny Weblog!'
|
16
|
-
end
|
17
|
-
|
18
|
-
it '#blog_subtitle should be ""' do
|
19
|
-
@blog.blog_subtitle.should == ''
|
20
|
-
end
|
21
|
-
|
22
|
-
it "#sp_article_auto_close should be 0" do
|
23
|
-
@blog.sp_article_auto_close.should == 0
|
24
|
-
end
|
25
|
-
|
26
|
-
it "#sp_url_limit should be 0" do
|
27
|
-
@blog.sp_url_limit.should == 0
|
28
|
-
end
|
29
|
-
|
30
|
-
it "#sp_akismet_key should be blank" do
|
31
|
-
@blog.sp_akismet_key.should == ''
|
32
|
-
end
|
33
|
-
|
34
|
-
it '#text_filter and #comment_text_filter should be markdown smartypants' do
|
35
|
-
@blog.text_filter.should == 'markdown smartypants'
|
36
|
-
@blog.comment_text_filter.should == 'markdown smartypants'
|
37
|
-
end
|
38
|
-
|
39
|
-
it '#limit_article_display and #limit_rss_display should be 10' do
|
40
|
-
@blog.limit_article_display.should == 10
|
41
|
-
@blog.limit_rss_display.should == 10
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'Pings should not be allowed by default' do
|
45
|
-
@blog.should_not be_default_allow_pings
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'Comments should be allowed by default' do
|
49
|
-
@blog.should be_default_allow_comments
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'Should not link to author' do
|
53
|
-
@blog.should_not be_link_to_author
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'Should show extended on rss' do
|
57
|
-
@blog.should be_show_extended_on_rss
|
58
|
-
end
|
59
|
-
|
60
|
-
it '#theme should be "typographic"' do
|
61
|
-
@blog.theme.should == 'true-blue-3'
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'should not use gravatar' do
|
65
|
-
@blog.should_not be_use_gravatar
|
66
|
-
end
|
67
|
-
|
68
|
-
# Another clumsy setting name
|
69
|
-
it '#global_pings_disable should be false' do
|
70
|
-
@blog.global_pings_disable.should == false
|
71
|
-
@blog.should_not be_global_pings_disable
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'should ping technorati, blog.gs and weblogs.com' do
|
75
|
-
@blog.ping_urls.should == "http://blogsearch.google.com/ping/RPC2\nhttp://rpc.technorati.com/rpc/ping\nhttp://ping.blo.gs/\nhttp://rpc.weblogs.com/RPC2"
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'should send outbound pings' do
|
79
|
-
@blog.should be_send_outbound_pings
|
80
|
-
end
|
81
|
-
|
82
|
-
it '#email_from should be typo@example.com' do
|
83
|
-
@blog.email_from.should == 'typo@example.com'
|
84
|
-
end
|
85
|
-
|
86
|
-
it '#is_okay should be false until #blog_name is explicitly set' do
|
87
|
-
@blog.should_not be_configured
|
88
|
-
@blog.blog_name = 'Specific blog name'
|
89
|
-
@blog.should be_configured
|
90
|
-
end
|
91
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
-
|
3
|
-
describe 'FeedbackStates from Test::Unit' do
|
4
|
-
before(:each) do
|
5
|
-
@comment = contents(:article1).comments.build(:author => 'Piers',
|
6
|
-
:body => 'Body')
|
7
|
-
end
|
8
|
-
|
9
|
-
it "test_ham_all_the_way" do
|
10
|
-
assert @comment.unclassified?
|
11
|
-
assert @comment.published?
|
12
|
-
assert @comment.just_published?
|
13
|
-
assert @comment.just_changed_published_status?
|
14
|
-
assert @comment.save
|
15
|
-
assert @comment.just_changed_published_status?
|
16
|
-
assert @comment.just_published?
|
17
|
-
@comment = Comment.find(@comment.id)
|
18
|
-
assert ! @comment.just_changed_published_status?
|
19
|
-
assert ! @comment.just_published?
|
20
|
-
@comment.confirm_classification
|
21
|
-
assert @comment.published?
|
22
|
-
assert ! @comment.just_published?
|
23
|
-
assert ! @comment.just_changed_published_status?
|
24
|
-
end
|
25
|
-
|
26
|
-
it "test_spam_all_the_way" do
|
27
|
-
class << @comment
|
28
|
-
def classify
|
29
|
-
:spam
|
30
|
-
end
|
31
|
-
end
|
32
|
-
assert @comment.unclassified?
|
33
|
-
assert ! @comment.published?
|
34
|
-
assert ! @comment.just_published?
|
35
|
-
assert ! @comment.just_changed_published_status?
|
36
|
-
assert @comment.save
|
37
|
-
assert ! @comment.published?
|
38
|
-
assert ! @comment.just_published?
|
39
|
-
assert ! @comment.just_changed_published_status?
|
40
|
-
@comment = Comment.find(@comment.id)
|
41
|
-
assert ! @comment.just_changed_published_status?
|
42
|
-
assert ! @comment.just_published?
|
43
|
-
@comment.confirm_classification
|
44
|
-
assert ! @comment.published?
|
45
|
-
assert ! @comment.just_published?
|
46
|
-
assert ! @comment.just_changed_published_status?
|
47
|
-
end
|
48
|
-
|
49
|
-
it "test_presumed_spam_marked_as_ham" do
|
50
|
-
@comment[:state] = 'presumed_spam'
|
51
|
-
@comment.mark_as_ham
|
52
|
-
assert @comment.published?
|
53
|
-
assert @comment.just_published?
|
54
|
-
assert @comment.just_changed_published_status?
|
55
|
-
end
|
56
|
-
|
57
|
-
it "test_presumed_ham_marked_as_spam" do
|
58
|
-
@comment[:state] = 'presumed_ham'
|
59
|
-
@comment.mark_as_spam
|
60
|
-
assert ! @comment.published?
|
61
|
-
assert ! @comment.just_published?
|
62
|
-
assert @comment.just_changed_published_status?
|
63
|
-
end
|
64
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
3
|
-
describe PageCache do
|
4
|
-
|
5
|
-
describe 'PageCache#self.sweep_all' do
|
6
|
-
|
7
|
-
before(:each) do
|
8
|
-
all_files = ['/index.html', '/articles.rss', '/sitemap.xml']
|
9
|
-
@all_paths = []
|
10
|
-
all_files.each do |path|
|
11
|
-
@all_paths << create_file_in_spec_public_cache_directory(path)
|
12
|
-
CacheInformation.create!(:path => path)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'should destroy all file in cache directory with path' do
|
17
|
-
PageCache.sweep_all
|
18
|
-
@all_paths.each do |path|
|
19
|
-
File.should_not be_exist(path)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should delete all CacheInformation' do
|
24
|
-
PageCache.sweep_all
|
25
|
-
CacheInformation.all.should be_empty
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
data/spec/models/page_spec.rb
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
3
|
-
describe 'Given the fixture :first_page' do
|
4
|
-
before(:each) do
|
5
|
-
@page = contents(:first_page)
|
6
|
-
end
|
7
|
-
|
8
|
-
it '#permalink_url should be: http://myblog.net/pages/page_one' do
|
9
|
-
@page.permalink_url.should == 'http://myblog.net/pages/page_one'
|
10
|
-
end
|
11
|
-
|
12
|
-
it '#edit_url should be: http://myblog.net/admin/pages/edit/<page_id>' do
|
13
|
-
@page.edit_url.should == "http://myblog.net/admin/pages/edit/#{@page.id}"
|
14
|
-
end
|
15
|
-
|
16
|
-
it '#delete_url should work too' do
|
17
|
-
@page.delete_url.should == "http://myblog.net/admin/pages/destroy/#{@page.id}"
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'Pages cannot have the same name' do
|
21
|
-
Page.new(:name => @page.name, :body => @page.body, :title => @page.title).should_not be_valid
|
22
|
-
Page.new(:name => @page.name, :body => 'body', :title => 'title').should_not be_valid
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
class Hash
|
27
|
-
def except(*keys)
|
28
|
-
self.reject { |k,v| keys.include? k.to_sym }
|
29
|
-
end
|
30
|
-
|
31
|
-
def only(*keys)
|
32
|
-
self.dup.reject { |k, v| !keys.include? k.to_sym }
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe "ValidPageHelper", :shared => true do
|
37
|
-
def valid_attributes
|
38
|
-
{ :name => 'name', :title => 'title', :body => 'body'}
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe 'Given no pages' do
|
43
|
-
it_should_behave_like "ValidPageHelper"
|
44
|
-
|
45
|
-
before(:each) do
|
46
|
-
Page.delete_all
|
47
|
-
@page = Page.new
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'An empty page is invalid' do
|
51
|
-
@page.should_not be_valid
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'A page is valid with name, title and body' do
|
55
|
-
@page.attributes = valid_attributes
|
56
|
-
@page.should be_valid
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'A page is invalid without a name' do
|
60
|
-
@page.attributes = valid_attributes.except(:name)
|
61
|
-
@page.should_not be_valid
|
62
|
-
@page.errors.on(:name).should == "can't be blank"
|
63
|
-
@page.name = 'somename'
|
64
|
-
@page.should be_valid
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'A page is invalid without a title' do
|
68
|
-
@page.attributes = valid_attributes.except(:title)
|
69
|
-
@page.should_not be_valid
|
70
|
-
@page.errors.on(:title).should == "can't be blank"
|
71
|
-
@page.title = 'sometitle'
|
72
|
-
@page.should be_valid
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'A page is invalid without a body' do
|
76
|
-
@page.attributes = valid_attributes.except(:body)
|
77
|
-
@page.should_not be_valid
|
78
|
-
@page.errors.on(:body).should == "can't be blank"
|
79
|
-
@page.body = 'somebody'
|
80
|
-
@page.should be_valid
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe 'Given a valid page' do
|
85
|
-
it_should_behave_like "ValidPageHelper"
|
86
|
-
|
87
|
-
it 'default filter should be fetched from the blog' do
|
88
|
-
@page = Page.new()
|
89
|
-
@page.default_text_filter.name.should == Blog.default.text_filter
|
90
|
-
end
|
91
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../spec_helper"
|
2
|
-
|
3
|
-
describe 'Ping::Pinger with Test::Unit' do
|
4
|
-
before do
|
5
|
-
# avoid mocking constructor until we need it for something
|
6
|
-
@pinger = Ping::Pinger.allocate
|
7
|
-
class << @pinger
|
8
|
-
attr_writer :response
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
it "test_pingback_url_nil" do
|
13
|
-
@pinger.response = mock('response')
|
14
|
-
@pinger.response.stub!(:body).and_return('')
|
15
|
-
@pinger.response.stub!(:[]).and_return(nil)
|
16
|
-
assert_nil @pinger.pingback_url
|
17
|
-
end
|
18
|
-
|
19
|
-
# TODO: why do we assume that we can XML attribute order?
|
20
|
-
it "test_pingback_url_from_body" do
|
21
|
-
@pinger.response = mock('response')
|
22
|
-
@pinger.response.stub!(:body).and_return('<link rel="pingback" href="foo" />')
|
23
|
-
@pinger.response.stub!(:[]).and_return(nil)
|
24
|
-
assert_equal 'foo', @pinger.pingback_url
|
25
|
-
end
|
26
|
-
|
27
|
-
it "test_pingback_url" do
|
28
|
-
@pinger.response = mock('response')
|
29
|
-
@pinger.response.stub!(:body).and_return('')
|
30
|
-
@pinger.response.stub!(:[]).and_return(:x_pingback)
|
31
|
-
assert_equal :x_pingback, @pinger.pingback_url
|
32
|
-
end
|
33
|
-
end
|
data/spec/models/ping_spec.rb
DELETED
@@ -1,154 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
3
|
-
describe 'Given a post which references a pingback enabled article' do
|
4
|
-
def pingback_target; 'http://anotherblog.org/xml-rpc'; end
|
5
|
-
def referenced_url; 'http://anotherblog.org/a-post'; end
|
6
|
-
def referrer_url; 'http://myblog.net/referring-post'; end
|
7
|
-
|
8
|
-
|
9
|
-
before(:each) do
|
10
|
-
@mock_response = mock('response')
|
11
|
-
@mock_xmlrpc_response = mock('xmlrpc_response')
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'Pingback sent to url found in referenced header' do
|
15
|
-
@mock_response.should_receive(:[]).with('X-Pingback').at_least(:once).and_return(pingback_target)
|
16
|
-
@mock_xmlrpc_response.should_receive(:call).with('pingback.ping', referrer_url, referenced_url)
|
17
|
-
make_and_send_ping
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'Pingback sent to url found in referenced body' do
|
21
|
-
@mock_response.should_receive(:[]).with('X-Pingback').at_least(:once).and_return(nil)
|
22
|
-
@mock_response.should_receive(:body).at_least(:once)\
|
23
|
-
.and_return(%{<link rel="pingback" href="http://anotherblog.org/xml-rpc" />})
|
24
|
-
@mock_xmlrpc_response.should_receive(:call).with('pingback.ping', referrer_url, referenced_url)
|
25
|
-
make_and_send_ping
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'Pingback sent when new article is saved' do
|
29
|
-
ActiveRecord::Base.observers.should include(:email_notifier)
|
30
|
-
ActiveRecord::Base.observers.should include(:web_notifier)
|
31
|
-
|
32
|
-
blog = Blog.default
|
33
|
-
|
34
|
-
blog.should_not be_send_outbound_pings
|
35
|
-
blog.send_outbound_pings = 1
|
36
|
-
blog.save!
|
37
|
-
blog.should be_send_outbound_pings
|
38
|
-
|
39
|
-
|
40
|
-
a = Article.new \
|
41
|
-
:body => '<a href="http://anotherblog.org/a-post">',
|
42
|
-
:title => 'Test the pinging',
|
43
|
-
:published => true
|
44
|
-
|
45
|
-
Net::HTTP.should_receive(:get_response).and_return(@mock_response)
|
46
|
-
XMLRPC::Client.should_receive(:new2).with(pingback_target).and_return(@mock_xmlrpc_response)
|
47
|
-
|
48
|
-
@mock_response.should_receive(:[]).with('X-Pingback').at_least(:once).and_return(pingback_target)
|
49
|
-
@mock_xmlrpc_response.should_receive(:call)\
|
50
|
-
.with('pingback.ping',
|
51
|
-
%r{http://myblog.net/\d{4}/\d{2}/\d{2}/test-the-pinging},
|
52
|
-
referenced_url)
|
53
|
-
|
54
|
-
|
55
|
-
a.should have(1).html_urls
|
56
|
-
a.save!
|
57
|
-
a.should be_just_published
|
58
|
-
a = Article.find(a.id)
|
59
|
-
a.should_not be_just_published
|
60
|
-
# Saving again will not resend the pings
|
61
|
-
a.save
|
62
|
-
end
|
63
|
-
|
64
|
-
def make_and_send_ping
|
65
|
-
Net::HTTP.should_receive(:get_response).and_return(@mock_response)
|
66
|
-
XMLRPC::Client.should_receive(:new2).with(pingback_target).and_return(@mock_xmlrpc_response)
|
67
|
-
|
68
|
-
ping = contents(:article1).pings.build("url" => referenced_url)
|
69
|
-
ping.should be_instance_of(Ping)
|
70
|
-
ping.url.should == referenced_url
|
71
|
-
ping.send_pingback_or_trackback(referrer_url)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe "An article links to another article, which contains a trackback URL" do
|
76
|
-
def referenced_url; 'http://anotherblog.org/a-post'; end
|
77
|
-
def trackback_url; "http://anotherblog.org/a-post/trackback"; end
|
78
|
-
|
79
|
-
|
80
|
-
it 'Trackback URL is detected and pinged' do
|
81
|
-
referrer_url = 'http://myblog.net/referring-post'
|
82
|
-
post = "title=Article+1%21&excerpt=body&url=http://myblog.net/referring-post&blog_name=test+blog"
|
83
|
-
make_and_send_ping(post, contents(:article1), referrer_url)
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'sends a trackback without html tag in excerpt' do
|
87
|
-
# TODO: Assert the following:
|
88
|
-
# contents(:xmltest).body = originally seen on <a href="http://blog.rubyonrails.org/">blog.rubyonrails.org</a>
|
89
|
-
|
90
|
-
post = "title=#{CGI.escape("Associations aren't :dependent => true anymore")}"
|
91
|
-
post << "&excerpt=#{CGI.escape("originally seen on blog.rubyonrails.org")}" # not original text see if normal ?
|
92
|
-
post << "&url=#{contents(:xmltest).permalink_url}"
|
93
|
-
post << "&blog_name=#{CGI.escape('test blog')}"
|
94
|
-
|
95
|
-
make_and_send_ping(post, contents(:xmltest), contents(:xmltest).permalink_url)
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'sends a trackback without markdown tag in excerpt' do
|
99
|
-
# TODO: Assert the following:
|
100
|
-
# contents(:markdown_article) #in markdown format\n * we\n * use\n [ok](http://blog.ok.com) to define a link
|
101
|
-
|
102
|
-
post = "title=#{CGI.escape("How made link with markdown")}"
|
103
|
-
post << "&excerpt=#{CGI.escape("in markdown format we use ok to define a link")}" # not original text see if normal ?
|
104
|
-
post << "&url=#{contents(:markdown_article).permalink_url}"
|
105
|
-
post << "&blog_name=#{CGI.escape('test blog')}"
|
106
|
-
|
107
|
-
make_and_send_ping(post, contents(:markdown_article), contents(:markdown_article).permalink_url)
|
108
|
-
end
|
109
|
-
|
110
|
-
def make_and_send_ping(post, article, article_url)
|
111
|
-
@mock = mock('html_response')
|
112
|
-
Net::HTTP.should_receive(:get_response).with(URI.parse(referenced_url)).and_return(@mock)
|
113
|
-
@mock.should_receive(:[]).with('X-Pingback').at_least(:once)
|
114
|
-
@mock.should_receive(:body).twice.and_return(referenced_body)
|
115
|
-
Net::HTTP.should_receive(:start).with(URI.parse(trackback_url).host, 80).and_yield(@mock)
|
116
|
-
|
117
|
-
@mock.should_receive(:post) \
|
118
|
-
.with('/a-post/trackback', post,
|
119
|
-
'Content-type' => 'application/x-www-form-urlencoded; charset=utf-8') \
|
120
|
-
.and_return(@mock)
|
121
|
-
|
122
|
-
ping = article.pings.build(:url => referenced_url)
|
123
|
-
ping.send_pingback_or_trackback(article_url)
|
124
|
-
end
|
125
|
-
|
126
|
-
def referenced_body
|
127
|
-
<<-eobody
|
128
|
-
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
129
|
-
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"
|
130
|
-
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
131
|
-
<rdf:Description
|
132
|
-
rdf:about=""
|
133
|
-
trackback:ping="http://anotherblog.org/a-post/trackback"
|
134
|
-
dc:title="Track me, track me!"
|
135
|
-
dc:identifier="http://anotherblog.org/a-post"
|
136
|
-
dc:description="Track me 'til I fart!'"
|
137
|
-
dc:creator="pdcawley"
|
138
|
-
dc:date="2006-03-01T04:31:00-05:00" />
|
139
|
-
</rdf:RDF>
|
140
|
-
eobody
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
describe 'Given a remote site to notify, eg technorati' do
|
145
|
-
it 'we can ping them correctly' do
|
146
|
-
mock = mock('response')
|
147
|
-
XMLRPC::Client.should_receive(:new2).with('http://rpc.technorati.com/rpc/ping').and_return(mock)
|
148
|
-
mock.should_receive(:call).with('weblogUpdates.ping', 'test blog',
|
149
|
-
'http://myblog.net', 'http://myblog.net/new-post')
|
150
|
-
|
151
|
-
ping = contents(:article1).pings.build("url" => "http://rpc.technorati.com/rpc/ping")
|
152
|
-
ping.send_weblogupdatesping('http://myblog.net', 'http://myblog.net/new-post')
|
153
|
-
end
|
154
|
-
end
|