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,42 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
3
|
-
describe AuthorsController do
|
4
|
-
integrate_views
|
5
|
-
|
6
|
-
describe 'show action' do
|
7
|
-
before :each do
|
8
|
-
get 'show', :id => 'tobi'
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should be render template index' do
|
12
|
-
response.should render_template(:show)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should assigns articles' do
|
16
|
-
assigns[:author].should_not be_nil
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should have good link feed rss' do
|
20
|
-
response.should have_tag('head>link[href=?]','http://test.host/author/tobi.rss')
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should have good link feed atom' do
|
24
|
-
response.should have_tag('head>link[href=?]','http://test.host/author/tobi.atom')
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
specify "/author/tobi.atom => an atom feed" do
|
29
|
-
get 'show', :id => 'tobi', :format => 'atom'
|
30
|
-
response.should be_success
|
31
|
-
response.should render_template("articles/_atom_feed")
|
32
|
-
assert_feedvalidator @response.body
|
33
|
-
end
|
34
|
-
|
35
|
-
specify "/author/tobi.rss => a rss feed" do
|
36
|
-
get 'show', :id => 'tobi', :format => 'rss'
|
37
|
-
response.should be_success
|
38
|
-
response.should render_template("articles/_rss20_feed")
|
39
|
-
response.should have_tag('link', 'http://myblog.net')
|
40
|
-
assert_feedvalidator @response.body
|
41
|
-
end
|
42
|
-
end
|
@@ -1,337 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
require 'action_web_service/test_invoke'
|
3
|
-
require 'backend_controller'
|
4
|
-
require 'blogger_service'
|
5
|
-
require 'meta_weblog_service'
|
6
|
-
require 'app/apis/movable_type_service.rb'
|
7
|
-
require 'digest/sha1'
|
8
|
-
require 'base64'
|
9
|
-
|
10
|
-
User.salt = 'change-me'
|
11
|
-
|
12
|
-
BackendController.class_eval do
|
13
|
-
include ActionWebService::Protocol::XmlRpc
|
14
|
-
end
|
15
|
-
|
16
|
-
describe BackendController do
|
17
|
-
before do
|
18
|
-
@protocol = :xmlrpc
|
19
|
-
end
|
20
|
-
|
21
|
-
# BloggerApi Tests
|
22
|
-
it "test_blogger_delete_post" do
|
23
|
-
args = [ 'foo', contents(:article3).id, 'tobi', 'whatever', 1 ]
|
24
|
-
|
25
|
-
result = invoke_layered :blogger, :deletePost, *args
|
26
|
-
assert_raise(ActiveRecord::RecordNotFound) { Article.find(contents(:article3).id) }
|
27
|
-
end
|
28
|
-
|
29
|
-
it "test_blogger_get_users_blogs" do
|
30
|
-
args = [ 'foo', 'tobi', 'whatever' ]
|
31
|
-
|
32
|
-
result = invoke_layered :blogger, :getUsersBlogs, *args
|
33
|
-
assert_equal 'test blog', result.first['blogName']
|
34
|
-
end
|
35
|
-
|
36
|
-
it "test_blogger_get_user_info" do
|
37
|
-
args = [ 'foo', 'tobi', 'whatever' ]
|
38
|
-
|
39
|
-
result = invoke_layered :blogger, :getUserInfo, *args
|
40
|
-
assert_equal 'tobi', result['userid']
|
41
|
-
end
|
42
|
-
|
43
|
-
it "test_blogger_new_post" do
|
44
|
-
args = [ 'foo', '1', 'tobi', 'whatever', '<title>new post title</title>new post *body*', 1]
|
45
|
-
|
46
|
-
result = invoke_layered :blogger, :newPost, *args
|
47
|
-
assert_not_nil result
|
48
|
-
new_post = Article.find(result)
|
49
|
-
assert_equal "new post title", new_post.title
|
50
|
-
assert_equal "new post *body*", new_post.body
|
51
|
-
assert_equal "<p>new post <strong>body</strong></p>", new_post.html(:body)
|
52
|
-
assert_equal "textile", new_post.text_filter.name
|
53
|
-
assert_equal users(:tobi), new_post.user
|
54
|
-
assert new_post.published?
|
55
|
-
assert new_post[:published_at]
|
56
|
-
end
|
57
|
-
|
58
|
-
it "test_blogger_new_post_no_title" do
|
59
|
-
args = [ 'foo', '1', 'tobi', 'whatever', 'new post body for post without title but with a lenghty body', 1]
|
60
|
-
|
61
|
-
result = invoke_layered :blogger, :newPost, *args
|
62
|
-
assert_not_nil result
|
63
|
-
new_post = Article.find(result)
|
64
|
-
assert_equal "new post body for post without", new_post.title
|
65
|
-
assert_equal "new post body for post without title but with a lenghty body", new_post.body
|
66
|
-
assert_equal "<p>new post body for post without title but with a lenghty body</p>", new_post.html(:body)
|
67
|
-
end
|
68
|
-
|
69
|
-
it "test_blogger_new_post_with_categories" do
|
70
|
-
args = [ 'foo', '1', 'tobi', 'whatever', '<title>new post title</title><category>Software, Hardware</category>new post body', 1]
|
71
|
-
|
72
|
-
result = invoke_layered :blogger, :newPost, *args
|
73
|
-
assert_not_nil result
|
74
|
-
new_post = Article.find(result)
|
75
|
-
assert_equal "new post title", new_post.title
|
76
|
-
assert_equal "new post body", new_post.body
|
77
|
-
assert_equal [categories(:software), categories(:hardware)].sort_by(&:id), new_post.categories.sort_by { |c| c.id }
|
78
|
-
assert new_post.published?
|
79
|
-
end
|
80
|
-
|
81
|
-
it "test_blogger_new_post_with_non_existing_categories" do
|
82
|
-
args = [ 'foo', '1', 'tobi', 'whatever', '<title>new post title</title><category>Idontexist, Hardware</category>new post body', 1]
|
83
|
-
|
84
|
-
result = invoke_layered :blogger, :newPost, *args
|
85
|
-
assert_not_nil result
|
86
|
-
new_post = Article.find(result)
|
87
|
-
assert_equal [categories(:hardware)], new_post.categories
|
88
|
-
end
|
89
|
-
|
90
|
-
it "test_blogger_fail_authentication" do
|
91
|
-
args = [ 'foo', 'tobi', 'using a wrong password' ]
|
92
|
-
# This will be a little more useful with the upstream changes in [1093]
|
93
|
-
assert_raise(XMLRPC::FaultException) { invoke_layered :blogger, :getUsersBlogs, *args }
|
94
|
-
end
|
95
|
-
|
96
|
-
# Meta Weblog Tests
|
97
|
-
it "test_meta_weblog_get_categories" do
|
98
|
-
args = [ 1, 'tobi', 'whatever' ]
|
99
|
-
|
100
|
-
result = invoke_layered :metaWeblog, :getCategories, *args
|
101
|
-
assert_equal 'Software', result.first
|
102
|
-
end
|
103
|
-
|
104
|
-
it "test_meta_weblog_get_post" do
|
105
|
-
args = [ contents(:article1).id, 'tobi', 'whatever' ]
|
106
|
-
|
107
|
-
result = invoke_layered :metaWeblog, :getPost, *args
|
108
|
-
assert_equal result['title'], contents(:article1).title
|
109
|
-
end
|
110
|
-
|
111
|
-
it "test_meta_weblog_get_recent_posts" do
|
112
|
-
args = [ 1, 'tobi', 'whatever', 2 ]
|
113
|
-
|
114
|
-
result = invoke_layered :metaWeblog, :getRecentPosts, *args
|
115
|
-
assert_equal result.size, 2
|
116
|
-
assert_equal result.last['title'], Article.find(:first, :offset => 1, :order => 'created_at desc').title
|
117
|
-
end
|
118
|
-
|
119
|
-
it "test_meta_weblog_delete_post" do
|
120
|
-
art_id = contents(:article2).id
|
121
|
-
args = [ 1, art_id, 'tobi', 'whatever', 1 ]
|
122
|
-
|
123
|
-
result = invoke_layered :metaWeblog, :deletePost, *args
|
124
|
-
assert_raise(ActiveRecord::RecordNotFound) { Article.find(art_id) }
|
125
|
-
end
|
126
|
-
|
127
|
-
it "test_meta_weblog_edit_post" do
|
128
|
-
art_id = contents(:article1).id
|
129
|
-
article = Article.find(art_id)
|
130
|
-
article.title = "Modified!"
|
131
|
-
article.body = "this is a *test*"
|
132
|
-
article.text_filter = TextFilter.find_by_name("textile")
|
133
|
-
article.published_at = Time.now.utc.midnight
|
134
|
-
|
135
|
-
args = [ art_id, 'tobi', 'whatever', MetaWeblogService.new(@controller).article_dto_from(article), 1 ]
|
136
|
-
|
137
|
-
result = invoke_layered :metaWeblog, :editPost, *args
|
138
|
-
assert result
|
139
|
-
|
140
|
-
new_article = Article.find(art_id)
|
141
|
-
|
142
|
-
assert_equal article.title, new_article.title
|
143
|
-
assert_equal article.body, new_article.body
|
144
|
-
assert_equal "<p>this is a <strong>test</strong></p>", new_article.html(:body)
|
145
|
-
assert_equal article.published_at, new_article.published_at.utc
|
146
|
-
end
|
147
|
-
|
148
|
-
# TODO: Work out what the correct response is when a post can't be saved...
|
149
|
-
it "test_meta_weblog_new_post_fails" do
|
150
|
-
@article = Article.new(:title => 'test', :body => 'body', :extended => 'extended',
|
151
|
-
:text_filter => TextFilter.find_by_name('textile'),
|
152
|
-
:published_at => Time.now.utc.midnight)
|
153
|
-
@article.errors.add_to_base('test error')
|
154
|
-
@article.should_receive(:save).and_return(false)
|
155
|
-
Article.stub!(:new).and_return(@article)
|
156
|
-
args = [1, 'tobi', 'whatever', MetaWeblogService.new(@controller).article_dto_from(@article), 1]
|
157
|
-
lambda { invoke_layered :metaWeblog , :newPost, *args }.should \
|
158
|
-
raise_error(XMLRPC::FaultException,
|
159
|
-
'Internal server error (exception raised)')
|
160
|
-
end
|
161
|
-
|
162
|
-
it "test_meta_weblog_new_post" do
|
163
|
-
article = Article.new
|
164
|
-
article.title = "Posted via Test"
|
165
|
-
article.body = "body"
|
166
|
-
article.extended = "extend me"
|
167
|
-
article.text_filter = TextFilter.find_by_name("textile")
|
168
|
-
article.published_at = Time.now.utc.midnight
|
169
|
-
|
170
|
-
args = [ 1, 'tobi', 'whatever', MetaWeblogService.new(@controller).article_dto_from(article), 1 ]
|
171
|
-
|
172
|
-
result = invoke_layered :metaWeblog, :newPost, *args
|
173
|
-
assert result
|
174
|
-
new_post = Article.find(result)
|
175
|
-
|
176
|
-
assert_equal "Posted via Test", new_post.title
|
177
|
-
assert_equal "textile", new_post.text_filter.name
|
178
|
-
assert_equal article.body, new_post.body
|
179
|
-
assert_equal "<p>body</p>", new_post.html(:body)
|
180
|
-
assert_equal article.extended, new_post.extended
|
181
|
-
assert_equal "<p>extend me</p>", new_post.html(:extended)
|
182
|
-
assert_equal article.published_at, new_post.published_at.utc
|
183
|
-
end
|
184
|
-
|
185
|
-
it "test_meta_weblog_new_unpublished_post_with_blank_creation_date" do
|
186
|
-
dto = MetaWeblogStructs::Article.new(
|
187
|
-
:description => "Some text",
|
188
|
-
:title => "A Title"
|
189
|
-
)
|
190
|
-
|
191
|
-
args = [ 1, 'tobi', 'whatever', dto, 0 ]
|
192
|
-
|
193
|
-
result = invoke_layered :metaWeblog, :newPost, *args
|
194
|
-
assert result
|
195
|
-
new_post = Article.find(result)
|
196
|
-
assert !new_post.published?
|
197
|
-
end
|
198
|
-
|
199
|
-
it "test_meta_weblog_edit_unpublished_post_with_old_creation_date" do
|
200
|
-
article = Article.new
|
201
|
-
article.title = "Posted via Test"
|
202
|
-
article.body = "body"
|
203
|
-
article.extended = "extend me"
|
204
|
-
article.text_filter = TextFilter.find_by_name("textile")
|
205
|
-
article.published_at = Time.now - 1.days
|
206
|
-
|
207
|
-
args = [ 1, 'tobi', 'whatever', MetaWeblogService.new(@controller).article_dto_from(article), 0 ]
|
208
|
-
|
209
|
-
result = invoke_layered :metaWeblog, :newPost, *args
|
210
|
-
assert result
|
211
|
-
new_post = Article.find(result)
|
212
|
-
assert !new_post.published?
|
213
|
-
end
|
214
|
-
|
215
|
-
it "test_meta_weblog_new_media_object" do
|
216
|
-
media_object = MetaWeblogStructs::MediaObject.new(
|
217
|
-
"name" => Digest::SHA1.hexdigest("upload-test--#{Time.now}--") + ".gif",
|
218
|
-
"type" => "image/gif",
|
219
|
-
"bits" => Base64.encode64(File.open(File.expand_path(RAILS_ROOT) + "/public/images/powered.gif", "rb") { |f| f.read })
|
220
|
-
)
|
221
|
-
|
222
|
-
args = [ 1, 'tobi', 'whatever', media_object ]
|
223
|
-
|
224
|
-
result = invoke_layered :metaWeblog, :newMediaObject, *args
|
225
|
-
assert result['url'] =~ /#{media_object['name']}/
|
226
|
-
assert File.unlink(File.expand_path(RAILS_ROOT) + "/public/files/#{media_object['name']}")
|
227
|
-
end
|
228
|
-
|
229
|
-
it "test_meta_weblog_fail_authentication" do
|
230
|
-
args = [ 1, 'tobi', 'using a wrong password', 2 ]
|
231
|
-
# This will be a little more useful with the upstream changes in [1093]
|
232
|
-
assert_raise(XMLRPC::FaultException) { invoke_layered :metaWeblog, :getRecentPosts, *args }
|
233
|
-
end
|
234
|
-
|
235
|
-
it "test_meta_weblog_should_preserve_date_time_on_roundtrip_edit" do
|
236
|
-
# The XML-RPC spec and the MetaWeblog API are ambiguous about how to
|
237
|
-
# intrepret the timezone in the dateCreated field. But _however_ we
|
238
|
-
# interpret it, we want to be able to fetch an article from the server,
|
239
|
-
# edit it, and write it back to the server without changing its
|
240
|
-
# dateCreated field.
|
241
|
-
article = contents(:article1)
|
242
|
-
original_published_at = article.published_at
|
243
|
-
|
244
|
-
args = [ article.id, 'tobi', 'whatever' ]
|
245
|
-
result = invoke_layered :metaWeblog, :getPost, *args
|
246
|
-
assert_equal original_published_at, result['dateCreated'].to_time
|
247
|
-
|
248
|
-
args = [ article.id, 'tobi', 'whatever', result, 1 ]
|
249
|
-
result = invoke_layered :metaWeblog, :editPost, *args
|
250
|
-
article.reload
|
251
|
-
assert_equal original_published_at, article.published_at
|
252
|
-
end
|
253
|
-
|
254
|
-
# Movable Type Tests
|
255
|
-
|
256
|
-
it "test_mt_get_category_list" do
|
257
|
-
args = [ 1, 'tobi', 'whatever' ]
|
258
|
-
|
259
|
-
result = invoke_layered :mt, :getCategoryList, *args
|
260
|
-
assert result.map { |c| c['categoryName'] }.include?('Software')
|
261
|
-
end
|
262
|
-
|
263
|
-
it "test_mt_get_post_categories" do
|
264
|
-
art_id = contents(:article1).id
|
265
|
-
article = Article.find(art_id)
|
266
|
-
article.categories << categories(:software)
|
267
|
-
|
268
|
-
args = [ art_id, 'tobi', 'whatever' ]
|
269
|
-
|
270
|
-
result = invoke_layered :mt, :getPostCategories, *args
|
271
|
-
assert_equal Set.new(result.collect {|v| v['categoryName']}), Set.new(article.categories.collect(&:name))
|
272
|
-
end
|
273
|
-
|
274
|
-
it "test_mt_get_recent_post_titles" do
|
275
|
-
args = [ 1, 'tobi', 'whatever', 2 ]
|
276
|
-
|
277
|
-
result = invoke_layered :mt, :getRecentPostTitles, *args
|
278
|
-
assert_equal result.first['title'], contents(:article2).title
|
279
|
-
end
|
280
|
-
|
281
|
-
it "test_mt_set_post_categories" do
|
282
|
-
art_id = contents(:article2).id
|
283
|
-
args = [ art_id, 'tobi', 'whatever',
|
284
|
-
[MovableTypeStructs::CategoryPerPost.new('categoryName' => 'personal', 'categoryId' => categories(:personal).id, 'isPrimary' => 1)] ]
|
285
|
-
|
286
|
-
result = invoke_layered :mt, :setPostCategories, *args
|
287
|
-
assert_equal [categories(:personal)], contents(:article2).categories
|
288
|
-
|
289
|
-
args = [ art_id, 'tobi', 'whatever',
|
290
|
-
[MovableTypeStructs::CategoryPerPost.new('categoryName' => 'Software', 'categoryId' => categories(:software).id, 'isPrimary' => 1),
|
291
|
-
MovableTypeStructs::CategoryPerPost.new('categoryName' => 'Hardware', 'categoryId' => categories(:hardware).id, 'isPrimary' => 0) ]]
|
292
|
-
|
293
|
-
result = invoke_layered :mt, :setPostCategories, *args
|
294
|
-
|
295
|
-
assert contents(:article2).reload.categories.include?(categories(:hardware))
|
296
|
-
|
297
|
-
end
|
298
|
-
|
299
|
-
it "test_mt_supported_text_filters" do
|
300
|
-
result = invoke_layered :mt, :supportedTextFilters
|
301
|
-
assert result.map {|f| f['label']}.include?('Markdown')
|
302
|
-
assert result.map {|f| f['label']}.include?('Textile')
|
303
|
-
end
|
304
|
-
|
305
|
-
it "test_mt_supported_methods" do
|
306
|
-
result = invoke_layered :mt, :supportedMethods
|
307
|
-
assert_equal 8, result.size
|
308
|
-
assert result.include?("publishPost")
|
309
|
-
end
|
310
|
-
|
311
|
-
it "test_mt_get_trackback_pings" do
|
312
|
-
args = [ contents(:article1).id ]
|
313
|
-
|
314
|
-
result = invoke_layered :mt, :getTrackbackPings, *args
|
315
|
-
|
316
|
-
assert_equal result.first['pingTitle'], 'Trackback Entry'
|
317
|
-
end
|
318
|
-
|
319
|
-
it "test_mt_publish_post" do
|
320
|
-
art_id = contents(:article4).id
|
321
|
-
args = [ art_id, 'tobi', 'whatever' ]
|
322
|
-
|
323
|
-
assert (not Article.find(art_id).published?)
|
324
|
-
|
325
|
-
result = invoke_layered :mt, :publishPost, *args
|
326
|
-
|
327
|
-
assert result
|
328
|
-
assert Article.find(art_id).published?
|
329
|
-
assert Article.find(art_id)[:published_at]
|
330
|
-
end
|
331
|
-
|
332
|
-
it "test_mt_fail_authentication" do
|
333
|
-
args = [ 1, 'tobi', 'using a wrong password', 2 ]
|
334
|
-
# This will be a little more useful with the upstream changes in [1093]
|
335
|
-
assert_raise(XMLRPC::FaultException) { invoke_layered :mt, :getRecentPostTitles, *args }
|
336
|
-
end
|
337
|
-
end
|
@@ -1,117 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
3
|
-
describe CategoriesController, "/index" do
|
4
|
-
def do_get
|
5
|
-
get 'index'
|
6
|
-
end
|
7
|
-
|
8
|
-
it "should be successful" do
|
9
|
-
do_get
|
10
|
-
response.should be_success
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should render :index"
|
14
|
-
if false
|
15
|
-
controller.stub!(:template_exists?) \
|
16
|
-
.and_return(true)
|
17
|
-
do_get
|
18
|
-
response.should render_template(:index)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should fall back to articles/groupings" do
|
22
|
-
controller.should_receive(:template_exists?) \
|
23
|
-
.with() \
|
24
|
-
.and_return(false)
|
25
|
-
do_get
|
26
|
-
response.should render_template('articles/groupings')
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe CategoriesController, '/articles/category/personal' do
|
31
|
-
def do_get
|
32
|
-
get 'show', :id => 'personal'
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'should be successful' do
|
36
|
-
do_get()
|
37
|
-
response.should be_success
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'should raise ActiveRecord::RecordNotFound' do
|
41
|
-
Category.should_receive(:find_by_permalink) \
|
42
|
-
.with('personal').and_raise(ActiveRecord::RecordNotFound)
|
43
|
-
lambda do
|
44
|
-
do_get
|
45
|
-
end.should raise_error(ActiveRecord::RecordNotFound)
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'should render :show by default'
|
49
|
-
if false
|
50
|
-
controller.stub!(:template_exists?) \
|
51
|
-
.and_return(true)
|
52
|
-
do_get
|
53
|
-
response.should render_template(:show)
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'should fall back to rendering articles/index' do
|
57
|
-
controller.should_receive(:template_exists?) \
|
58
|
-
.with() \
|
59
|
-
.and_raise(ActiveRecord::RecordNotFound)
|
60
|
-
lambda do
|
61
|
-
do_get
|
62
|
-
end.should raise_error(ActiveRecord::RecordNotFound)
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'should show only published articles' do
|
66
|
-
c = categories(:personal)
|
67
|
-
c.articles.size.should == 4
|
68
|
-
c.published_articles.size.should == 3
|
69
|
-
|
70
|
-
get 'show', :id => 'personal'
|
71
|
-
|
72
|
-
response.should be_success
|
73
|
-
assigns[:articles].size.should == 3
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'should set the page title to "Category Personal"' do
|
77
|
-
do_get
|
78
|
-
assigns[:page_title].should == 'Category Personal, everything about Personal'
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'should render the atom feed for /articles/category/personal.atom' do
|
82
|
-
get 'show', :id => 'personal', :format => 'atom'
|
83
|
-
response.should render_template('articles/_atom_feed')
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'should render the rss feed for /articles/category/personal.rss' do
|
87
|
-
get 'show', :id => 'personal', :format => 'rss'
|
88
|
-
response.should render_template('articles/_rss20_feed')
|
89
|
-
end
|
90
|
-
|
91
|
-
end
|
92
|
-
|
93
|
-
describe CategoriesController, 'empty category life-on-mars' do
|
94
|
-
it 'should redirect to home when the category is empty' do
|
95
|
-
get 'show', :id => 'life-on-mars'
|
96
|
-
|
97
|
-
response.status.should == "301 Moved Permanently"
|
98
|
-
response.should redirect_to(Blog.default.base_url)
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
## Old tests that still need conversion
|
103
|
-
|
104
|
-
# it "test_autodiscovery_category" do
|
105
|
-
# get :category, :id => 'hardware'
|
106
|
-
# assert_response :success
|
107
|
-
# assert_select 'link[title=RSS]' do
|
108
|
-
# assert_select '[rel=alternate]'
|
109
|
-
# assert_select '[type=application/rss+xml]'
|
110
|
-
# assert_select '[href=http://test.host/articles/category/hardware.rss]'
|
111
|
-
# end
|
112
|
-
# assert_select 'link[title=Atom]' do
|
113
|
-
# assert_select '[rel=alternate]'
|
114
|
-
# assert_select '[type=application/atom+xml]'
|
115
|
-
# assert_select '[href=http://test.host/articles/category/hardware.atom]'
|
116
|
-
# end
|
117
|
-
# end
|