typo 5.4.4 → 5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +59 -28
- data/MAINTAINERS +9 -17
- data/README +28 -20
- data/UPGRADE +6 -2
- data/app/controllers/accounts_controller.rb +1 -1
- data/app/controllers/admin/content_controller.rb +1 -1
- data/app/controllers/admin/feedback_controller.rb +3 -3
- data/app/controllers/admin/pages_controller.rb +2 -0
- data/app/controllers/application_controller.rb +6 -1
- data/app/controllers/articles_controller.rb +13 -1
- data/app/helpers/application_helper.rb +5 -2
- data/app/helpers/authors_helper.rb +14 -3
- data/app/models/article.rb +6 -4
- data/app/models/blog.rb +0 -4
- data/app/models/blog_sweeper.rb +1 -1
- data/app/models/content.rb +10 -5
- data/app/models/page_cache.rb +6 -7
- data/app/models/user.rb +1 -0
- data/app/views/admin/content/_form.html.erb +13 -11
- data/app/views/admin/content/_images.html.erb +1 -1
- data/app/views/admin/content/_simple_editor.html.erb +1 -0
- data/app/views/admin/content/_visual_editor.html.erb +1 -0
- data/app/views/admin/dashboard/_overview.html.erb +7 -7
- data/app/views/admin/pages/_form.html.erb +1 -0
- data/app/views/admin/pages/_images.html.erb +18 -0
- data/app/views/admin/pages/_simple_editor.html.erb +1 -2
- data/app/views/admin/pages/_visual_editor.html.erb +2 -1
- data/app/views/admin/pages/index.html.erb +1 -1
- data/app/views/admin/settings/feedback.html.erb +2 -1
- data/app/views/admin/tags/edit.html.erb +1 -1
- data/app/views/articles/_article.html.erb +17 -13
- data/app/views/articles/_article_content.html.erb +1 -0
- data/app/views/articles/_comment_box.html.erb +1 -1
- data/app/views/articles/_password_form.html.erb +10 -0
- data/app/views/articles/groupings.html.erb +1 -1
- data/app/views/articles/index.html.erb +1 -2
- data/app/views/articles/read.html.erb +1 -4
- data/app/views/articles/search.html.erb +1 -1
- data/app/views/layouts/administration.html.erb +1 -1
- data/app/views/shared/_search.html.erb +1 -1
- data/config/ckeditor.yml +14 -0
- data/config/environment.rb +13 -25
- data/config/environments/test.rb +1 -3
- data/config/filemanager.yml +16 -0
- data/config/initializers/access_rules.rb +5 -0
- data/config/routes.rb +5 -1
- data/db/migrate/004_add_sidebars.rb +3 -9
- data/db/migrate/089_drop_cache_information_table.rb +31 -0
- data/db/migrate/090_remove_keywords_from_posts.rb +9 -0
- data/db/migrate/091_adds_password_protection_to_posts.rb +9 -0
- data/doc/CACHE.SETUP.README +36 -0
- data/lang/de_DE.rb +6 -1
- data/lang/pl_PL.rb +221 -89
- data/lib/filemanager.rb +53 -0
- data/lib/filemanager/controller.rb +217 -0
- data/lib/i18n_interpolation_deprecation.rb +26 -0
- data/lib/rails_patch/active_support.rb +4 -0
- data/lib/tasks/release.rake +4 -131
- data/lib/typo_version.rb +1 -1
- data/public/.htaccess +6 -5
- data/public/filemanager/images/avi.gif +0 -0
- data/public/filemanager/images/box.gif +0 -0
- data/public/filemanager/images/bullet.gif +0 -0
- data/public/filemanager/images/close.gif +0 -0
- data/public/filemanager/images/closelabel.gif +0 -0
- data/public/filemanager/images/doc.gif +0 -0
- data/public/filemanager/images/donate-button.gif +0 -0
- data/public/filemanager/images/download-icon.gif +0 -0
- data/public/filemanager/images/folder.gif +0 -0
- data/public/filemanager/images/gif.gif +0 -0
- data/public/filemanager/images/htm.gif +0 -0
- data/public/filemanager/images/html.gif +0 -0
- data/public/filemanager/images/image-1.jpg +0 -0
- data/public/filemanager/images/image.gif +0 -0
- data/public/filemanager/images/jpg.gif +0 -0
- data/public/filemanager/images/loading.gif +0 -0
- data/public/filemanager/images/mov.gif +0 -0
- data/public/filemanager/images/nextlabel.gif +0 -0
- data/public/filemanager/images/pdf.gif +0 -0
- data/public/filemanager/images/png.gif +0 -0
- data/public/filemanager/images/ppt.gif +0 -0
- data/public/filemanager/images/prevlabel.gif +0 -0
- data/public/filemanager/images/rar.gif +0 -0
- data/public/filemanager/images/rm.gif +0 -0
- data/public/filemanager/images/rmvb.gif +0 -0
- data/public/filemanager/images/separator.gif +0 -0
- data/public/filemanager/images/spacer.gif +0 -0
- data/public/filemanager/images/swf.gif +0 -0
- data/public/filemanager/images/thumb-1.jpg +0 -0
- data/public/filemanager/images/tool_copy.gif +0 -0
- data/public/filemanager/images/tool_cut.gif +0 -0
- data/public/filemanager/images/tool_del.gif +0 -0
- data/public/filemanager/images/tool_folder.gif +0 -0
- data/public/filemanager/images/tool_imagemanager.gif +0 -0
- data/public/filemanager/images/tool_new.gif +0 -0
- data/public/filemanager/images/tool_paste.gif +0 -0
- data/public/filemanager/images/tool_props.gif +0 -0
- data/public/filemanager/images/tool_refresh.gif +0 -0
- data/public/filemanager/images/tool_unzip.gif +0 -0
- data/public/filemanager/images/tool_upload.gif +0 -0
- data/public/filemanager/images/tool_zip.gif +0 -0
- data/public/filemanager/images/txt.gif +0 -0
- data/public/filemanager/images/unknown.gif +0 -0
- data/public/filemanager/images/wmv.gif +0 -0
- data/public/filemanager/images/xls.gif +0 -0
- data/public/filemanager/images/zip.gif +0 -0
- data/public/filemanager/javascripts/filemanager.js +6 -0
- data/public/filemanager/javascripts/lang/en.js +31 -0
- data/public/filemanager/javascripts/lang/zh_CN.js +31 -0
- data/public/filemanager/javascripts/lightbox.js +497 -0
- data/public/filemanager/javascripts/translate.js +42 -0
- data/public/filemanager/resources/resources.txt +1 -0
- data/public/filemanager/stylesheets/filelist.css +147 -0
- data/public/filemanager/stylesheets/general.css +135 -0
- data/public/filemanager/stylesheets/lightbox.css +27 -0
- data/public/javascripts/prototype_ext.js +117 -0
- data/public/stylesheets/administration.css +19 -2
- data/themes/dirtylicious/views/articles/_article.html.erb +16 -12
- data/themes/dirtylicious/views/articles/_article_content.html.erb +1 -0
- data/themes/dirtylicious/views/articles/_password_form.html.erb +10 -0
- data/themes/scribbish/views/articles/_article.html.erb +18 -14
- data/themes/scribbish/views/articles/_article_content.html.erb +1 -0
- data/themes/scribbish/views/articles/_password_form.html.erb +10 -0
- data/themes/standard_issue/views/articles/_article.html.erb +16 -12
- data/themes/standard_issue/views/articles/_article_content.html.erb +1 -0
- data/themes/standard_issue/views/articles/_password_form.html.erb +10 -0
- data/themes/true-blue-3/helpers/theme_helper.rb +2 -2
- data/themes/true-blue-3/images/submit_form.jpg +0 -0
- data/themes/true-blue-3/stylesheets/style.css +27 -3
- data/themes/true-blue-3/views/articles/_article.html.erb +13 -8
- data/themes/true-blue-3/views/articles/_article_content.html.erb +1 -0
- data/themes/true-blue-3/views/articles/_comment_form.html.erb +1 -1
- data/themes/true-blue-3/views/articles/_password_form.html.erb +10 -0
- data/themes/true-blue-3/views/categories/_article.html.erb +5 -0
- data/themes/true-blue-3/views/tags/_article.html.erb +4 -0
- data/themes/typographic/views/articles/_article.html.erb +16 -12
- data/themes/typographic/views/articles/_article_content.html.erb +1 -0
- data/themes/typographic/views/articles/_password_form.html.erb +10 -0
- data/vendor/plugins/easy-ckeditor/app/controllers/ckeditor_controller.rb +2 -1
- data/vendor/plugins/easy-ckeditor/lib/ckeditor.rb +1 -20
- data/vendor/plugins/easy-ckeditor/{tasks → lib/tasks}/ckeditor_tasks.rake +0 -0
- data/vendor/plugins/filemanager/app/controllers/fm/filemanager_controller.rb +22 -0
- data/vendor/plugins/filemanager/app/views/fm/filemanager/index.html.erb +512 -0
- data/vendor/plugins/filemanager/app/views/fm/filemanager/view.html.erb +67 -0
- data/vendor/plugins/filemanager/filemanager.yml +16 -0
- data/vendor/plugins/static_sidebar/lib/static_sidebar.rb +4 -2
- data/vendor/plugins/typo_converter/{tasks → lib/tasks}/typo_converters_tasks.rake +0 -0
- data/vendor/plugins/typo_login_system/lib/access_control.rb +24 -1
- data/vendor/plugins/typo_textfilter_code/{tasks → lib/tasks}/typo_textfilter_code_tasks.rake +0 -0
- data/vendor/plugins/typo_textfilter_code/lib/typo_textfilter_code.rb +4 -3
- data/vendor/plugins/typo_textfilter_flickr/{tasks → lib/tasks}/typo_textfilter_flickr_tasks.rake +0 -0
- data/vendor/plugins/typo_textfilter_htmlfilter/{tasks → lib/tasks}/typo_textfilter_htmlfilter_tasks.rake +0 -0
- data/vendor/plugins/typo_textfilter_lightbox/{tasks → lib/tasks}/typo_textfilter_lightbox_tasks.rake +0 -0
- data/vendor/plugins/typo_textfilter_markdown/{tasks → lib/tasks}/typo_textfilter_markdown_tasks.rake +0 -0
- data/vendor/plugins/typo_textfilter_none/{tasks → lib/tasks}/typo_textfilter_none_tasks.rake +0 -0
- data/vendor/plugins/typo_textfilter_smartypants/{tasks → lib/tasks}/typo_textfilter_smartypants_tasks.rake +0 -0
- data/vendor/plugins/typo_textfilter_textile/{tasks → lib/tasks}/typo_textfilter_textile_tasks.rake +0 -0
- data/vendor/plugins/typo_textfilter_textile_and_markdown/{tasks → lib/tasks}/typo_textfilter_textile_and_markdown_tasks.rake +0 -0
- data/vendor/plugins/xml_sidebar/views/content.rhtml +1 -1
- metadata +190 -195
- data/app/controllers/admin/cache_controller.rb +0 -9
- data/app/models/cache_information.rb +0 -19
- data/db/schema.rb +0 -242
- data/doc/test_themes.rb +0 -50
- data/public/javascripts/ckeditor/config.js +0 -27
- data/spec/controllers/accounts_controller_spec.rb +0 -414
- data/spec/controllers/admin/cache_controller_spec.rb +0 -18
- data/spec/controllers/admin/categories_controller_spec.rb +0 -73
- data/spec/controllers/admin/content_controller_spec.rb +0 -443
- data/spec/controllers/admin/dashboard_controller_spec.rb +0 -13
- data/spec/controllers/admin/feedback_controller_spec.rb +0 -308
- data/spec/controllers/admin/pages_controller_spec.rb +0 -80
- data/spec/controllers/admin/profiles_controller_spec.rb +0 -22
- data/spec/controllers/admin/resources_controller_spec.rb +0 -53
- data/spec/controllers/admin/settings_controller_spec.rb +0 -80
- data/spec/controllers/admin/tags_controller_spec.rb +0 -64
- data/spec/controllers/admin/textfilters_controller_spec.rb +0 -20
- data/spec/controllers/admin/themes_controller_spec.rb +0 -30
- data/spec/controllers/admin/users_controller_spec.rb +0 -109
- data/spec/controllers/application_controller_spec.rb +0 -18
- data/spec/controllers/articles_controller_spec.rb +0 -440
- data/spec/controllers/authors_controller_spec.rb +0 -42
- data/spec/controllers/backend_controller_spec.rb +0 -337
- data/spec/controllers/categories_controller_spec.rb +0 -117
- data/spec/controllers/comments_controller_spec.rb +0 -137
- data/spec/controllers/routes/articles_routing_spec.rb +0 -31
- data/spec/controllers/routes/xml_routing_spec.rb +0 -71
- data/spec/controllers/setup_controller_spec.rb +0 -24
- data/spec/controllers/tags_controller_spec.rb +0 -147
- data/spec/controllers/textfilter_controller_spec.rb +0 -192
- data/spec/controllers/theme_controller_spec.rb +0 -39
- data/spec/controllers/xml_controller_spec.rb +0 -185
- data/spec/factories.rb +0 -69
- data/spec/helpers/application_helper_spec.rb +0 -25
- data/spec/helpers/content_helper_spec.rb +0 -28
- data/spec/lib/text_filter_plugin_spec.rb +0 -15
- data/spec/models/amazon_sidebar_spec.rb +0 -40
- data/spec/models/article_closing_spec.rb +0 -42
- data/spec/models/article_spec.rb +0 -515
- data/spec/models/blog_spec.rb +0 -116
- data/spec/models/cache_information_spec.rb +0 -42
- data/spec/models/cache_support_spec.rb +0 -51
- data/spec/models/category_spec.rb +0 -44
- data/spec/models/comment_spec.rb +0 -240
- data/spec/models/configuration_spec.rb +0 -91
- data/spec/models/content_state/feedback_states_spec.rb +0 -64
- data/spec/models/notification_spec.rb +0 -8
- data/spec/models/page_cache_spec.rb +0 -30
- data/spec/models/page_spec.rb +0 -91
- data/spec/models/ping_pinger_spec.rb +0 -33
- data/spec/models/ping_spec.rb +0 -154
- data/spec/models/redirect_spec.rb +0 -17
- data/spec/models/resource_spec.rb +0 -39
- data/spec/models/route_cache_spec.rb +0 -11
- data/spec/models/sidebar_spec.rb +0 -7
- data/spec/models/static_sidebar_spec.rb +0 -17
- data/spec/models/tag_spec.rb +0 -65
- data/spec/models/text_filter_spec.rb +0 -34
- data/spec/models/theme_spec.rb +0 -45
- data/spec/models/trackback_spec.rb +0 -60
- data/spec/models/trigger_spec.rb +0 -40
- data/spec/models/user_spec.rb +0 -198
- data/spec/rcov.opts +0 -2
- data/spec/spec.opts +0 -4
- data/spec/spec_helper.rb +0 -133
- data/spec/views/articles/index_spec.rb +0 -63
- data/spec/views/articles/read_spec.rb +0 -67
- data/spec/views/comments/html_sanitization_spec.rb +0 -119
- data/test/fixtures/blogs.yml +0 -27
- data/test/fixtures/categories.yml +0 -29
- data/test/fixtures/categorizations.yml +0 -31
- data/test/fixtures/contents.yml +0 -231
- data/test/fixtures/feedback.yml +0 -180
- data/test/fixtures/notification_mailer/article +0 -3
- data/test/fixtures/notification_mailer/comment +0 -3
- data/test/fixtures/notification_mailer/trackback +0 -3
- data/test/fixtures/notifications.yml +0 -0
- data/test/fixtures/page_caches.yml +0 -7
- data/test/fixtures/profiles.yml +0 -27
- data/test/fixtures/redirects.yml +0 -10
- data/test/fixtures/resources.yml +0 -21
- data/test/fixtures/sidebars.yml +0 -10
- data/test/fixtures/tags.yml +0 -10
- data/test/fixtures/text_filters.yml +0 -37
- data/test/fixtures/triggers.yml +0 -1
- data/test/fixtures/users.yml +0 -101
- data/test/mocks/test/dns_mock.rb +0 -13
- data/test/mocks/test/flickr_mock.rb +0 -30
- data/test/mocks/test/http_mock.rb +0 -39
- data/test/mocks/test/theme_mock.rb +0 -5
- data/test/mocks/test/xmlrpc_mock.rb +0 -28
- data/test/mocks/themes/123-numbers-in-path/about.markdown +0 -0
- data/test/mocks/themes/CamelCaseDirectory/about.markdown +0 -0
- data/test/mocks/themes/i-have-special-chars/about.markdown +0 -0
- data/test/mocks/themes/typographic/about.markdown +0 -7
- data/test/mocks/themes/typographic/images/Thumbs.db +0 -0
- data/test/mocks/themes/typographic/images/accept.png +0 -0
- data/test/mocks/themes/typographic/images/accept50.png +0 -0
- data/test/mocks/themes/typographic/images/bg_body.jpg +0 -0
- data/test/mocks/themes/typographic/images/bg_white.png +0 -0
- data/test/mocks/themes/typographic/images/bg_wrapper.jpg +0 -0
- data/test/mocks/themes/typographic/images/bullet_bottom.png +0 -0
- data/test/mocks/themes/typographic/images/bullet_right.png +0 -0
- data/test/mocks/themes/typographic/images/email_open.png +0 -0
- data/test/mocks/themes/typographic/images/email_open50.png +0 -0
- data/test/mocks/themes/typographic/images/meta.png +0 -0
- data/test/mocks/themes/typographic/images/page_edit.png +0 -0
- data/test/mocks/themes/typographic/images/page_edit50.png +0 -0
- data/test/mocks/themes/typographic/images/tag.png +0 -0
- data/test/mocks/themes/typographic/images/user.png +0 -0
- data/test/mocks/themes/typographic/images/user50.png +0 -0
- data/test/mocks/themes/typographic/images/world_link.png +0 -0
- data/test/mocks/themes/typographic/images/world_link50.png +0 -0
- data/test/mocks/themes/typographic/layouts/default.html.erb +0 -42
- data/test/mocks/themes/typographic/preview.png +0 -0
- data/test/mocks/themes/typographic/stylesheets/colors.css +0 -51
- data/test/mocks/themes/typographic/stylesheets/layout.css +0 -346
- data/test/mocks/themes/typographic/stylesheets/reset.css +0 -5
- data/test/mocks/themes/typographic/stylesheets/style.css +0 -36
- data/test/mocks/themes/typographic/views/articles/_article.html.erb +0 -41
- data/test/mocks/themes/typographic/views/articles/_comment.html.erb +0 -14
- data/test/mocks/themes/typographic/views/articles/_comment_form.html.erb +0 -48
- data/test/mocks/themes/typographic/views/articles/_comment_list.html.erb +0 -7
- data/test/mocks/themes/typographic/views/articles/_trackback.html.erb +0 -9
- data/test/mocks/themes/typographic/views/articles/comment_preview.html.erb +0 -10
- data/test/mocks/themes/typographic/views/articles/index.html.erb +0 -5
- data/test/mocks/themes/typographic/views/articles/read.html.erb +0 -42
- data/test/mocks/themes/typographic/views/shared/_search.html.erb +0 -17
- data/test/mocks/themes/typographic/views/theme/static_view_test.html.erb +0 -1
- data/test/test_helper.rb +0 -13
- data/themes/true-blue-3/images/frederic-de-villamil.jpg +0 -0
- data/themes/true-blue-3/images/textarea_bg.jpg +0 -0
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe Admin::SettingsController do
|
|
4
|
-
before do
|
|
5
|
-
request.session = { :user => users(:tobi).id }
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
describe "#index" do
|
|
9
|
-
it 'should render index' do
|
|
10
|
-
get :index
|
|
11
|
-
response.should render_template('index')
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
describe 'read action' do
|
|
16
|
-
it 'should render read' do
|
|
17
|
-
get :read
|
|
18
|
-
assert_template 'read'
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
describe 'write action' do
|
|
23
|
-
|
|
24
|
-
it 'should be success' do
|
|
25
|
-
get :write
|
|
26
|
-
assert_template 'write'
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
describe 'feedback action' do
|
|
31
|
-
it 'should be sucess' do
|
|
32
|
-
get :feedback
|
|
33
|
-
assert_template 'feedback'
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
describe 'seo action' do
|
|
38
|
-
it 'should be success' do
|
|
39
|
-
get :seo
|
|
40
|
-
assert_template 'seo'
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
describe 'redirect action' do
|
|
45
|
-
it 'should be success' do
|
|
46
|
-
get :redirect
|
|
47
|
-
assert_response :redirect, :controller => 'admin/settings', :action => 'index'
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
describe 'update action' do
|
|
52
|
-
|
|
53
|
-
def good_update(options={})
|
|
54
|
-
post :update, {"from"=>"seo",
|
|
55
|
-
"authenticity_token"=>"f9ed457901b96c65e99ecb73991b694bd6e7c56b",
|
|
56
|
-
"setting"=>{"permalink_format"=>"/%title%.html",
|
|
57
|
-
"index_categories"=>"1",
|
|
58
|
-
"google_analytics"=>"",
|
|
59
|
-
"meta_keywords"=>"my keywords",
|
|
60
|
-
"meta_description"=>"",
|
|
61
|
-
"title_prefix"=>"1",
|
|
62
|
-
"rss_description"=>"1",
|
|
63
|
-
"robots"=>"User-agent: *\r\nDisallow: /admin/\r\nDisallow: /page/\r\nDisallow: /cgi-bin \r\nUser-agent: Googlebot-Image\r\nAllow: /*",
|
|
64
|
-
"index_tags"=>"1"}}.merge(options)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
it 'should success' do
|
|
68
|
-
good_update
|
|
69
|
-
response.should redirect_to(:action => 'seo')
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
it 'should not save blog with bad permalink format' do
|
|
73
|
-
@blog = Blog.default
|
|
74
|
-
good_update "setting" => {"permalink_format" => "title"}
|
|
75
|
-
response.should be_success
|
|
76
|
-
response.should render_template(:seo)
|
|
77
|
-
@blog.should == Blog.default
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe Admin::TagsController do
|
|
4
|
-
before do
|
|
5
|
-
request.session = { :user => users(:tobi).id }
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
describe 'index action' do
|
|
9
|
-
before :each do
|
|
10
|
-
get :index
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
it 'should be success' do
|
|
14
|
-
response.should be_success
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it 'should render template index' do
|
|
18
|
-
response.should render_template('index')
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
describe 'edit action' do
|
|
25
|
-
before(:each) do
|
|
26
|
-
@tag_id = contents(:article1).tags.first.id
|
|
27
|
-
get :edit, :id => @tag_id
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it 'should be success' do
|
|
31
|
-
response.should be_success
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it 'should render template edit' do
|
|
35
|
-
response.should render_template('edit')
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it 'should assigns value :tag' do
|
|
39
|
-
assert assigns(:tag).valid?
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
describe 'update action' do
|
|
46
|
-
|
|
47
|
-
before :each do
|
|
48
|
-
@tag = Tag.find_by_id(contents(:article1).tags.first.id)
|
|
49
|
-
post :edit, 'id' => @tag.id, 'tag' => {:name => 'foobar', :display_name => 'Foo Bar'}
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it 'should redirect to index' do
|
|
53
|
-
response.should redirect_to(:action => 'index')
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
it 'should update tag' do
|
|
57
|
-
@tag.reload
|
|
58
|
-
@tag.name.should == 'foobar'
|
|
59
|
-
@tag.display_name == "Foo Bar"
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe Admin::TextfiltersController do
|
|
4
|
-
|
|
5
|
-
integrate_views
|
|
6
|
-
|
|
7
|
-
before do
|
|
8
|
-
request.session = { :user => users(:tobi).id }
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
describe 'macro help action' do
|
|
12
|
-
|
|
13
|
-
it 'should render success' do
|
|
14
|
-
get 'macro_help', :id => 'code'
|
|
15
|
-
response.should be_success
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
-
require 'admin/themes_controller'
|
|
3
|
-
|
|
4
|
-
# Re-raise errors caught by the controller.
|
|
5
|
-
class Admin::ThemesController; def rescue_action(e) raise e end; end
|
|
6
|
-
|
|
7
|
-
describe Admin::ThemesController, 'ported from the tests' do
|
|
8
|
-
integrate_views
|
|
9
|
-
|
|
10
|
-
before do
|
|
11
|
-
request.session = { :user => users(:tobi).id }
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# Replace this with your real tests.
|
|
15
|
-
it "test_index" do
|
|
16
|
-
get :index
|
|
17
|
-
assert_response :success
|
|
18
|
-
assert_not_nil assigns(:themes)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it "test_switchto" do
|
|
22
|
-
get :switchto, :theme => 'typographic'
|
|
23
|
-
assert_response :redirect, :action => 'index'
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it "test_preview" do
|
|
27
|
-
get :preview, :theme => 'typographic'
|
|
28
|
-
assert_response :success
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe Admin::UsersController, "rough port of the old functional test" do
|
|
4
|
-
integrate_views
|
|
5
|
-
fixtures :users
|
|
6
|
-
|
|
7
|
-
describe ' when you are admin' do
|
|
8
|
-
before(:each) do
|
|
9
|
-
request.session = { :user => users(:tobi).id }
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it "test_index" do
|
|
13
|
-
get :index
|
|
14
|
-
assert_template 'index'
|
|
15
|
-
assert_template_has 'users'
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "test_new" do
|
|
19
|
-
get :new
|
|
20
|
-
assert_template 'new'
|
|
21
|
-
|
|
22
|
-
post :new, :user => { :login => 'errand', :email => 'corey@test.com',
|
|
23
|
-
:password => 'testpass', :password_confirmation => 'testpass', :profile_id => 1 }
|
|
24
|
-
response.should redirect_to(:action => 'index')
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
describe '#EDIT action' do
|
|
28
|
-
describe 'with POST request' do
|
|
29
|
-
before do
|
|
30
|
-
post :edit, :id => users(:tobi).id, :user => { :login => 'errand',
|
|
31
|
-
:email => 'corey@test.com', :password => 'testpass',
|
|
32
|
-
:password_confirmation => 'testpass' }
|
|
33
|
-
end
|
|
34
|
-
it 'should redirect to index' do
|
|
35
|
-
response.should redirect_to(:action => 'index')
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
describe 'with GET request' do
|
|
40
|
-
describe 'edit admin render', :shared => true do
|
|
41
|
-
it 'should render template edit' do
|
|
42
|
-
assert_template 'edit'
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
it 'should assigns tobi user' do
|
|
46
|
-
assert assigns(:user).valid?
|
|
47
|
-
assigns(:user).should == users(:tobi)
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
describe 'with no id params' do
|
|
51
|
-
before do
|
|
52
|
-
get :edit
|
|
53
|
-
end
|
|
54
|
-
it_should_behave_like 'edit admin render'
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
describe 'with id params' do
|
|
58
|
-
before do
|
|
59
|
-
get :edit, :id => users(:tobi).id
|
|
60
|
-
end
|
|
61
|
-
it_should_behave_like 'edit admin render'
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
it "test_destroy" do
|
|
68
|
-
user_count = User.count
|
|
69
|
-
get :destroy, :id => users(:bob).id
|
|
70
|
-
assert_template 'destroy'
|
|
71
|
-
assert assigns(:user).valid?
|
|
72
|
-
|
|
73
|
-
assert_equal user_count, User.count
|
|
74
|
-
post :destroy, :id => users(:bob).id
|
|
75
|
-
response.should redirect_to(:action => 'index')
|
|
76
|
-
assert_equal user_count - 1, User.count
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
describe 'when you are not admin' do
|
|
81
|
-
|
|
82
|
-
before :each do
|
|
83
|
-
session[:user] = users(:user_publisher).id
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
it "don't see the list of user" do
|
|
87
|
-
get :index
|
|
88
|
-
response.should redirect_to('/accounts/login')
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
describe 'EDIT Action' do
|
|
92
|
-
|
|
93
|
-
describe 'try update another user' do
|
|
94
|
-
before do
|
|
95
|
-
post :edit,
|
|
96
|
-
:id => users(:tobi).id,
|
|
97
|
-
:profile_id => profiles(:contributor).id
|
|
98
|
-
end
|
|
99
|
-
it 'should redirect to login' do
|
|
100
|
-
response.should redirect_to('/accounts/login')
|
|
101
|
-
end
|
|
102
|
-
it 'should not change user profile' do
|
|
103
|
-
u = users(:tobi).reload
|
|
104
|
-
u.profile_id.should == profiles(:admin).id
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe ApplicationController do
|
|
4
|
-
it 'safely caches a page' do
|
|
5
|
-
define_spec_public_cache_directory
|
|
6
|
-
file_path = path_for_file_in_spec_public_cache_directory('/test.html')
|
|
7
|
-
File.delete file_path if File.exists? file_path
|
|
8
|
-
File.should_not be_exist(file_path)
|
|
9
|
-
|
|
10
|
-
ApplicationController.perform_caching = true
|
|
11
|
-
ApplicationController.cache_page 'test', '/test'
|
|
12
|
-
File.should be_exist(file_path)
|
|
13
|
-
|
|
14
|
-
ApplicationController.perform_caching = false
|
|
15
|
-
File.delete(file_path)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
@@ -1,440 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe ArticlesController do
|
|
4
|
-
integrate_views
|
|
5
|
-
|
|
6
|
-
it "should redirect category to /categories" do
|
|
7
|
-
get 'category'
|
|
8
|
-
response.should redirect_to(categories_path)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "should redirect tag to /tags" do
|
|
12
|
-
get 'tag'
|
|
13
|
-
response.should redirect_to(tags_path)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe 'index action' do
|
|
17
|
-
before :each do
|
|
18
|
-
get 'index'
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it 'should be render template index' do
|
|
22
|
-
response.should render_template(:index)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
it 'should assigns articles' do
|
|
26
|
-
assigns[:articles].should_not be_nil
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
it 'should have good link feed rss' do
|
|
30
|
-
response.should have_tag('head>link[href=?]','http://test.host/articles.rss')
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
it 'should have good link feed atom' do
|
|
34
|
-
response.should have_tag('head>link[href=?]','http://test.host/articles.atom')
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
describe '#search action' do
|
|
40
|
-
|
|
41
|
-
describe 'a valid search' do
|
|
42
|
-
before :each do
|
|
43
|
-
get 'search', :q => 'a'
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
it 'should render template search' do
|
|
47
|
-
response.should render_template(:search)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
it 'should assigns articles' do
|
|
51
|
-
assigns[:articles].should_not be_nil
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
it 'should have good feed rss link' do
|
|
55
|
-
response.should have_tag('head>link[href=?]','http://test.host/search/a.rss')
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
it 'should have good feed atom link' do
|
|
59
|
-
response.should have_tag('head>link[href=?]','http://test.host/search/a.atom')
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
it 'should have content markdown interpret and without html tag' do
|
|
63
|
-
response.should have_tag('div', /in markdown format\n\n\nwe\nuse\nok to define a link\n\n...\n/)
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
it 'should render feed rss by search' do
|
|
69
|
-
get 'search', :q => 'a', :format => 'rss'
|
|
70
|
-
response.should be_success
|
|
71
|
-
response.should render_template('articles/_rss20_feed')
|
|
72
|
-
assert_feedvalidator response.body
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
it 'should render feed atom by search' do
|
|
76
|
-
get 'search', :q => 'a', :format => 'atom'
|
|
77
|
-
response.should be_success
|
|
78
|
-
response.should render_template('articles/_atom_feed')
|
|
79
|
-
assert_feedvalidator response.body
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
it 'search with empty result' do
|
|
83
|
-
get 'search', :q => 'abcdefghijklmnopqrstuvwxyz'
|
|
84
|
-
response.should render_template('articles/error.html.erb')
|
|
85
|
-
assigns[:articles].should be_empty
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
describe '#livesearch action' do
|
|
90
|
-
|
|
91
|
-
describe 'with a query with several words' do
|
|
92
|
-
|
|
93
|
-
before :each do
|
|
94
|
-
Factory.create(:article, :body => "hello world and im herer")
|
|
95
|
-
Factory.create(:article, :title => "hello", :body => "worldwide")
|
|
96
|
-
Factory.create(:article)
|
|
97
|
-
get :live_search, :q => 'hello world'
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
it 'should be valid' do
|
|
101
|
-
assigns[:articles].should_not be_empty
|
|
102
|
-
assigns[:articles].should have(2).records
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
it 'should render without layout' do
|
|
106
|
-
controller.should_receive(:render).with(:layout =>false, :action => :live_search)
|
|
107
|
-
get :live_search, :q => 'hello world'
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
it 'should render template live_search' do
|
|
111
|
-
response.should render_template(:live_search)
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
it 'should not have h3 tag' do
|
|
115
|
-
response.should have_tag("h3")
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
it "should assign @search the search string" do
|
|
119
|
-
assigns[:search].should be_equal(params[:q])
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
it 'archives' do
|
|
127
|
-
get 'archives'
|
|
128
|
-
response.should render_template(:archives)
|
|
129
|
-
assigns[:articles].should_not be_nil
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
describe 'index for a month' do
|
|
133
|
-
|
|
134
|
-
before :each do
|
|
135
|
-
get 'index', :year => 2004, :month => 4
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
it 'should render template index' do
|
|
139
|
-
response.should render_template(:index)
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
it 'should contain some articles' do
|
|
143
|
-
assigns[:articles].should_not be_nil
|
|
144
|
-
end
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
describe ArticlesController, "nosettings" do
|
|
150
|
-
before(:each) do
|
|
151
|
-
Blog.delete_all
|
|
152
|
-
@blog = Blog.new.save
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
it 'redirects to setup' do
|
|
156
|
-
get 'index'
|
|
157
|
-
response.should redirect_to(:controller => 'setup', :action => 'index')
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
describe ArticlesController, "nousers" do
|
|
163
|
-
before(:each) do
|
|
164
|
-
User.stub!(:count).and_return(0)
|
|
165
|
-
@user = mock("user")
|
|
166
|
-
@user.stub!(:reload).and_return(@user)
|
|
167
|
-
User.stub!(:new).and_return(@user)
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
it 'redirects to signup' do
|
|
171
|
-
get 'index'
|
|
172
|
-
response.should redirect_to(:controller => 'accounts', :action => 'signup')
|
|
173
|
-
end
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
describe ArticlesController, "feeds" do
|
|
177
|
-
|
|
178
|
-
integrate_views
|
|
179
|
-
|
|
180
|
-
specify "/articles.atom => an atom feed" do
|
|
181
|
-
get 'index', :format => 'atom'
|
|
182
|
-
response.should be_success
|
|
183
|
-
response.should render_template("_atom_feed")
|
|
184
|
-
assert_feedvalidator response.body
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
specify "/articles.rss => an RSS 2.0 feed" do
|
|
188
|
-
get 'index', :format => 'rss'
|
|
189
|
-
response.should be_success
|
|
190
|
-
response.should render_template("_rss20_feed")
|
|
191
|
-
response.should have_tag('link', 'http://myblog.net')
|
|
192
|
-
assert_feedvalidator response.body
|
|
193
|
-
end
|
|
194
|
-
|
|
195
|
-
specify "atom feed for archive should be valid" do
|
|
196
|
-
get 'index', :year => 2004, :month => 4, :format => 'atom'
|
|
197
|
-
response.should render_template("_atom_feed")
|
|
198
|
-
assert_feedvalidator response.body
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
specify "RSS feed for archive should be valid" do
|
|
202
|
-
get 'index', :year => 2004, :month => 4, :format => 'rss'
|
|
203
|
-
response.should render_template("_rss20_feed")
|
|
204
|
-
assert_feedvalidator response.body
|
|
205
|
-
end
|
|
206
|
-
|
|
207
|
-
it 'should create valid atom feed when article contains é' do
|
|
208
|
-
article = contents(:article2)
|
|
209
|
-
article.body = 'écoute!'
|
|
210
|
-
article.save!
|
|
211
|
-
get 'index', :format => 'atom'
|
|
212
|
-
#response.body.should =~ /écoute!/
|
|
213
|
-
assert_feedvalidator response.body
|
|
214
|
-
end
|
|
215
|
-
|
|
216
|
-
it 'should create valid atom feed when article contains loose <' do
|
|
217
|
-
article = contents(:article2)
|
|
218
|
-
article.body = 'is 4 < 2? no!'
|
|
219
|
-
article.save!
|
|
220
|
-
get 'index', :format => 'atom'
|
|
221
|
-
assert_feedvalidator response.body
|
|
222
|
-
end
|
|
223
|
-
end
|
|
224
|
-
|
|
225
|
-
describe ArticlesController, "the index" do
|
|
226
|
-
it "should ignore the HTTP Accept: header" do
|
|
227
|
-
request.env["HTTP_ACCEPT"] = "application/atom+xml"
|
|
228
|
-
get "index"
|
|
229
|
-
response.should_not render_template("_atom_feed")
|
|
230
|
-
end
|
|
231
|
-
end
|
|
232
|
-
|
|
233
|
-
describe ArticlesController, "previewing" do
|
|
234
|
-
integrate_views
|
|
235
|
-
|
|
236
|
-
describe 'with non logged user' do
|
|
237
|
-
before :each do
|
|
238
|
-
@request.session = {}
|
|
239
|
-
get :preview, :id => Factory(:article).id
|
|
240
|
-
end
|
|
241
|
-
|
|
242
|
-
it 'should be redirect to login' do
|
|
243
|
-
response.should redirect_to(:controller => "accounts/login", :action => :index)
|
|
244
|
-
end
|
|
245
|
-
end
|
|
246
|
-
describe 'with logged user' do
|
|
247
|
-
before :each do
|
|
248
|
-
@request.session = {:user => users(:tobi).id}
|
|
249
|
-
@article = Factory(:article)
|
|
250
|
-
end
|
|
251
|
-
|
|
252
|
-
with_each_theme do |theme, view_path|
|
|
253
|
-
it "should render template #{view_path}/articles/read" do
|
|
254
|
-
this_blog.theme = theme if theme
|
|
255
|
-
get :preview, :id => @article.id
|
|
256
|
-
response.should render_template('articles/read.html.erb')
|
|
257
|
-
end
|
|
258
|
-
end
|
|
259
|
-
|
|
260
|
-
it 'should assigns article define with id' do
|
|
261
|
-
get :preview, :id => @article.id
|
|
262
|
-
assigns[:article].should == @article
|
|
263
|
-
end
|
|
264
|
-
|
|
265
|
-
it 'should assigns last article with id like parent_id' do
|
|
266
|
-
draft = Factory(:article, :parent_id => @article.id)
|
|
267
|
-
get :preview, :id => @article.id
|
|
268
|
-
assigns[:article].should == draft
|
|
269
|
-
end
|
|
270
|
-
|
|
271
|
-
end
|
|
272
|
-
end
|
|
273
|
-
|
|
274
|
-
describe ArticlesController, "redirecting" do
|
|
275
|
-
before do
|
|
276
|
-
ActionController::Base.relative_url_root = nil # avoid failures if environment.rb defines a relative URL root
|
|
277
|
-
end
|
|
278
|
-
|
|
279
|
-
it 'should split routing path' do
|
|
280
|
-
assert_routing "foo/bar/baz", {
|
|
281
|
-
:from => ["foo", "bar", "baz"],
|
|
282
|
-
:controller => 'articles', :action => 'redirect'}
|
|
283
|
-
end
|
|
284
|
-
|
|
285
|
-
it 'should redirect from articles_routing' do
|
|
286
|
-
assert_routing "articles", {
|
|
287
|
-
:from => ["articles"],
|
|
288
|
-
:controller => 'articles', :action => 'redirect'}
|
|
289
|
-
assert_routing "articles/foo", {
|
|
290
|
-
:from => ["articles", "foo"],
|
|
291
|
-
:controller => 'articles', :action => 'redirect'}
|
|
292
|
-
assert_routing "articles/foo/bar", {
|
|
293
|
-
:from => ["articles", "foo", "bar"],
|
|
294
|
-
:controller => 'articles', :action => 'redirect'}
|
|
295
|
-
assert_routing "articles/foo/bar/baz", {
|
|
296
|
-
:from => ["articles", "foo", "bar", "baz"],
|
|
297
|
-
:controller => 'articles', :action => 'redirect'}
|
|
298
|
-
end
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
it 'should redirect' do
|
|
302
|
-
get :redirect, :from => ["foo", "bar"]
|
|
303
|
-
assert_response 301
|
|
304
|
-
assert_redirected_to "http://test.host/someplace/else"
|
|
305
|
-
end
|
|
306
|
-
|
|
307
|
-
it 'should redirect with url_root' do
|
|
308
|
-
ActionController::Base.relative_url_root = "/blog"
|
|
309
|
-
get :redirect, :from => ["foo", "bar"]
|
|
310
|
-
assert_response 301
|
|
311
|
-
assert_redirected_to "http://test.host/blog/someplace/else"
|
|
312
|
-
|
|
313
|
-
get :redirect, :from => ["bar", "foo"]
|
|
314
|
-
assert_response 301
|
|
315
|
-
assert_redirected_to "http://test.host/blog/someplace/else"
|
|
316
|
-
end
|
|
317
|
-
|
|
318
|
-
it 'should no redirect' do
|
|
319
|
-
get :redirect, :from => ["something/that/isnt/there"]
|
|
320
|
-
assert_response 404
|
|
321
|
-
end
|
|
322
|
-
|
|
323
|
-
it 'should redirect to article' do
|
|
324
|
-
get :redirect, :from => ["articles", "2004", "04", "01", "second-blog-article"]
|
|
325
|
-
assert_response 301
|
|
326
|
-
assert_redirected_to "http://myblog.net/2004/04/01/second-blog-article"
|
|
327
|
-
end
|
|
328
|
-
|
|
329
|
-
it 'should redirect to article with url_root' do
|
|
330
|
-
b = blogs(:default)
|
|
331
|
-
b.base_url = "http://test.host/blog"
|
|
332
|
-
b.save
|
|
333
|
-
get :redirect, :from => ["articles", "2004", "04", "01", "second-blog-article"]
|
|
334
|
-
assert_response 301
|
|
335
|
-
assert_redirected_to "http://test.host/blog/2004/04/01/second-blog-article"
|
|
336
|
-
end
|
|
337
|
-
|
|
338
|
-
it 'should redirect to article when url_root is articles' do
|
|
339
|
-
b = blogs(:default)
|
|
340
|
-
b.base_url = "http://test.host/articles"
|
|
341
|
-
b.save
|
|
342
|
-
get :redirect, :from => ["articles", "2004", "04", "01", "second-blog-article"]
|
|
343
|
-
assert_response 301
|
|
344
|
-
assert_redirected_to "http://test.host/articles/2004/04/01/second-blog-article"
|
|
345
|
-
end
|
|
346
|
-
|
|
347
|
-
it 'should redirect to article with articles in url_root' do
|
|
348
|
-
b = blogs(:default)
|
|
349
|
-
b.base_url = "http://test.host/aaa/articles/bbb"
|
|
350
|
-
b.save
|
|
351
|
-
|
|
352
|
-
get :redirect, :from => ["articles", "2004", "04", "01", "second-blog-article"]
|
|
353
|
-
assert_response 301
|
|
354
|
-
assert_redirected_to "http://test.host/aaa/articles/bbb/2004/04/01/second-blog-article"
|
|
355
|
-
end
|
|
356
|
-
|
|
357
|
-
describe 'with permalink_format like %title%.html' do
|
|
358
|
-
|
|
359
|
-
integrate_views
|
|
360
|
-
|
|
361
|
-
before(:each) do
|
|
362
|
-
b = blogs(:default)
|
|
363
|
-
b.permalink_format = '/%title%.html'
|
|
364
|
-
b.save
|
|
365
|
-
end
|
|
366
|
-
describe 'render article' do
|
|
367
|
-
|
|
368
|
-
integrate_views
|
|
369
|
-
|
|
370
|
-
before(:each) do
|
|
371
|
-
get :redirect, :from => ["#{contents(:article1).permalink}.html"]
|
|
372
|
-
end
|
|
373
|
-
|
|
374
|
-
it 'should render template read to article' do
|
|
375
|
-
response.should render_template('articles/read.html.erb')
|
|
376
|
-
end
|
|
377
|
-
|
|
378
|
-
it 'should assign article1 to @article' do
|
|
379
|
-
assigns(:article).should == contents(:article1)
|
|
380
|
-
end
|
|
381
|
-
|
|
382
|
-
it 'should have good rss feed link' do
|
|
383
|
-
response.should have_tag('head>link[href=?]', "http://myblog.net/#{contents(:article1).permalink}.html.rss")
|
|
384
|
-
end
|
|
385
|
-
|
|
386
|
-
it 'should have good atom feed link' do
|
|
387
|
-
response.should have_tag('head>link[href=?]', "http://myblog.net/#{contents(:article1).permalink}.html.atom")
|
|
388
|
-
end
|
|
389
|
-
|
|
390
|
-
end
|
|
391
|
-
|
|
392
|
-
it 'should get good article with utf8 slug' do
|
|
393
|
-
get :redirect, :from => ['2004', '06', '02', 'ルビー']
|
|
394
|
-
assigns(:article).should == contents(:utf8_article)
|
|
395
|
-
end
|
|
396
|
-
|
|
397
|
-
describe 'rendering as atom feed' do
|
|
398
|
-
before(:each) do
|
|
399
|
-
get :redirect, :from => ["#{contents(:article1).permalink}.html.atom"]
|
|
400
|
-
end
|
|
401
|
-
|
|
402
|
-
it 'should render atom partial' do
|
|
403
|
-
response.should render_template('articles/_atom_feed.atom.builder')
|
|
404
|
-
end
|
|
405
|
-
|
|
406
|
-
it 'should render a valid feed' do
|
|
407
|
-
assert_feedvalidator response.body
|
|
408
|
-
end
|
|
409
|
-
end
|
|
410
|
-
|
|
411
|
-
describe 'rendering as rss feed' do
|
|
412
|
-
before(:each) do
|
|
413
|
-
get :redirect, :from => ["#{contents(:article1).permalink}.html.rss"]
|
|
414
|
-
end
|
|
415
|
-
|
|
416
|
-
it 'should render rss20 partial' do
|
|
417
|
-
response.should render_template('articles/_rss20_feed.rss.builder')
|
|
418
|
-
end
|
|
419
|
-
|
|
420
|
-
it 'should render a valid feed' do
|
|
421
|
-
assert_feedvalidator response.body
|
|
422
|
-
end
|
|
423
|
-
end
|
|
424
|
-
|
|
425
|
-
describe 'rendering comment feed with problematic characters' do
|
|
426
|
-
before(:each) do
|
|
427
|
-
@comment = contents(:article1).comments.first
|
|
428
|
-
@comment.body = "écoute! 4 < 2, non?"
|
|
429
|
-
@comment.save!
|
|
430
|
-
get :redirect, :from => ["#{contents(:article1).permalink}.html.atom"]
|
|
431
|
-
end
|
|
432
|
-
|
|
433
|
-
it 'should result in a valid atom feed' do
|
|
434
|
-
assigns(:article).should == contents(:article1)
|
|
435
|
-
assert_feedvalidator response.body
|
|
436
|
-
end
|
|
437
|
-
end
|
|
438
|
-
|
|
439
|
-
end
|
|
440
|
-
end
|