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
data/spec/rcov.opts
DELETED
data/spec/spec.opts
DELETED
data/spec/spec_helper.rb
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
2
|
-
# from the project root directory.
|
3
|
-
ENV["RAILS_ENV"] ||= 'test'
|
4
|
-
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
|
5
|
-
require 'spec/autorun'
|
6
|
-
require 'spec/rails'
|
7
|
-
|
8
|
-
Spec::Runner.configure do |config|
|
9
|
-
config.use_transactional_fixtures = true
|
10
|
-
config.use_instantiated_fixtures = false
|
11
|
-
config.fixture_path = RAILS_ROOT + '/test/fixtures/'
|
12
|
-
config.global_fixtures =
|
13
|
-
%w{ blogs categories categorizations contents
|
14
|
-
feedback notifications page_caches profiles redirects resources sidebars
|
15
|
-
tags text_filters triggers users }
|
16
|
-
|
17
|
-
config.before(:each) do
|
18
|
-
Localization.lang = :default
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def define_spec_public_cache_directory
|
23
|
-
ActionController::Base.page_cache_directory = File.join(Rails.root, 'spec', 'public')
|
24
|
-
unless File.exist? ActionController::Base.page_cache_directory
|
25
|
-
FileUtils.mkdir_p ActionController::Base.page_cache_directory
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def path_for_file_in_spec_public_cache_directory(file)
|
30
|
-
define_spec_public_cache_directory
|
31
|
-
File.join(ActionController::Base.page_cache_directory, file)
|
32
|
-
end
|
33
|
-
|
34
|
-
def create_file_in_spec_public_cache_directory(file)
|
35
|
-
file_path = path_for_file_in_spec_public_cache_directory(file)
|
36
|
-
File.open(file_path, 'a').close
|
37
|
-
file_path
|
38
|
-
end
|
39
|
-
|
40
|
-
# TODO: Rewrite to be more RSpec-like instead of Test::Unit-like.
|
41
|
-
def assert_template_has(key=nil, message=nil)
|
42
|
-
msg = build_message(message, "<?> is not a template object", key)
|
43
|
-
assert_block(msg) { @response.has_template_object?(key) }
|
44
|
-
end
|
45
|
-
|
46
|
-
def assert_xml(xml)
|
47
|
-
assert_nothing_raised do
|
48
|
-
assert REXML::Document.new(xml)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def this_blog
|
53
|
-
Blog.default || Blog.create!
|
54
|
-
end
|
55
|
-
|
56
|
-
# test standard view and all themes
|
57
|
-
def with_each_theme
|
58
|
-
yield nil, ""
|
59
|
-
Dir.new(File.join(RAILS_ROOT, "themes")).each do |theme|
|
60
|
-
next if theme =~ /\.\.?/
|
61
|
-
view_path = "#{RAILS_ROOT}/themes/#{theme}/views"
|
62
|
-
if File.exists?("#{RAILS_ROOT}/themes/#{theme}/helpers/theme_helper.rb")
|
63
|
-
require "#{RAILS_ROOT}/themes/#{theme}/helpers/theme_helper.rb"
|
64
|
-
end
|
65
|
-
yield theme, view_path
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
# This test now has optional support for validating the generated RSS feeds.
|
70
|
-
# Since Ruby doesn't have a RSS/Atom validator, I'm using the Python source
|
71
|
-
# for http://feedvalidator.org and calling it via 'system'.
|
72
|
-
#
|
73
|
-
# To install the validator, download the source from
|
74
|
-
# http://sourceforge.net/cvs/?group_id=99943
|
75
|
-
# Then copy src/feedvalidator and src/rdflib into a Python lib directory.
|
76
|
-
# Finally, copy src/demo.py into your path as 'feedvalidator', make it executable,
|
77
|
-
# and change the first line to something like '#!/usr/bin/python'.
|
78
|
-
|
79
|
-
if($validator_installed == nil)
|
80
|
-
$validator_installed = false
|
81
|
-
begin
|
82
|
-
IO.popen("feedvalidator 2> /dev/null","r") do |pipe|
|
83
|
-
if (pipe.read =~ %r{Validating http://www.intertwingly.net/blog/index.})
|
84
|
-
puts "Using locally installed Python feed validator"
|
85
|
-
$validator_installed = true
|
86
|
-
end
|
87
|
-
end
|
88
|
-
rescue
|
89
|
-
nil
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def assert_feedvalidator(rss, todo=nil)
|
94
|
-
unless $validator_installed
|
95
|
-
puts 'Not validating feed because no validator (feedvalidator in python) is installed'
|
96
|
-
return
|
97
|
-
end
|
98
|
-
|
99
|
-
begin
|
100
|
-
file = Tempfile.new('typo-feed-test')
|
101
|
-
filename = file.path
|
102
|
-
file.write(rss)
|
103
|
-
file.close
|
104
|
-
|
105
|
-
messages = ''
|
106
|
-
|
107
|
-
IO.popen("feedvalidator file://#{filename}") do |pipe|
|
108
|
-
messages = pipe.read
|
109
|
-
end
|
110
|
-
|
111
|
-
okay, messages = parse_validator_messages(messages)
|
112
|
-
|
113
|
-
if todo && ! ENV['RUN_TODO_TESTS']
|
114
|
-
assert !okay, messages + "\nTest unexpectedly passed!\nFeed text:\n"+rss
|
115
|
-
else
|
116
|
-
assert okay, messages + "\nFeed text:\n"+rss
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
def parse_validator_messages(message)
|
122
|
-
messages=message.split(/\n/).reject do |m|
|
123
|
-
m =~ /Feeds should not be served with the "text\/plain" media type/ ||
|
124
|
-
m =~ /Self reference doesn't match document location/
|
125
|
-
end
|
126
|
-
|
127
|
-
if(messages.size > 1)
|
128
|
-
[false, messages.join("\n")]
|
129
|
-
else
|
130
|
-
[true, ""]
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
-
|
3
|
-
with_each_theme do |theme, view_path|
|
4
|
-
describe "#{view_path}/articles/index" do
|
5
|
-
before(:each) do
|
6
|
-
@controller.view_paths.unshift(view_path) if theme
|
7
|
-
# we only want to test pagination links
|
8
|
-
ActionView::Base.class_eval do
|
9
|
-
def article_links(article)
|
10
|
-
""
|
11
|
-
end
|
12
|
-
alias :category_links :article_links
|
13
|
-
alias :tag_links :article_links
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
context "normally" do
|
18
|
-
before(:each) do
|
19
|
-
@controller.action_name = "index"
|
20
|
-
assigns[:articles] = Article.paginate(:all, :page => 2, :per_page => 4)
|
21
|
-
render "articles/index"
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should not have pagination link to page 2 without q param" do
|
25
|
-
response.should_not have_tag("a[href=?]", "/page/2")
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should have pagination link to page 1 without q param if on page 2" do
|
29
|
-
response.should have_tag("a[href=?]", "/page/1")
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should not have too many paragraph marks around body" do
|
33
|
-
response.should have_tag("p", "body")
|
34
|
-
response.should_not have_tag("p>p", "body")
|
35
|
-
end
|
36
|
-
|
37
|
-
it "should not have div nested inside p" do
|
38
|
-
response.should_not have_tag("p>div")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# *notice
|
43
|
-
# this assumptions has "&", i don`t know why, but we want only to test the q= param in link and have separated this test from controller
|
44
|
-
context "when search" do
|
45
|
-
before(:each) do
|
46
|
-
@controller.action_name = "search"
|
47
|
-
params[:q] = "body"
|
48
|
-
params[:page] = 2
|
49
|
-
params[:action] = 'search'
|
50
|
-
assigns[:articles] = Blog.default.articles_matching(params[:q], :page => 2, :per_page => 4)
|
51
|
-
render "articles/index"
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should not have pagination link to page 2 with q param" do
|
55
|
-
response.should_not have_tag("a[href=?]", "/search/body?page=2") # *notice
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should have pagination link to page 1 with q param if on page 2" do
|
59
|
-
response.should have_tag("a[href=?]", "/search/body?page=1") # *notice
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
-
|
3
|
-
with_each_theme do |theme, view_path|
|
4
|
-
describe "#{view_path}/articles/read" do
|
5
|
-
before(:each) do
|
6
|
-
@controller.view_paths.unshift(view_path) if theme
|
7
|
-
# we do not want to test article links and such
|
8
|
-
ActionView::Base.class_eval do
|
9
|
-
def article_links(article)
|
10
|
-
""
|
11
|
-
end
|
12
|
-
alias :category_links :article_links
|
13
|
-
alias :tag_links :article_links
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
context "applying text filters" do
|
18
|
-
before(:each) do
|
19
|
-
@controller.action_name = "redirect"
|
20
|
-
assigns[:article] = contents('article1')
|
21
|
-
render "articles/read"
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should not have too many paragraph marks around body" do
|
25
|
-
response.should have_tag("p", "body")
|
26
|
-
response.should_not have_tag("p>p", "body")
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should not have too many paragraph marks around extended contents" do
|
30
|
-
response.should have_tag("p", "extended content")
|
31
|
-
response.should_not have_tag("p>p", "extended content")
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context "formatting comments" do
|
36
|
-
before(:each) do
|
37
|
-
Blog.default.comment_text_filter = 'textile'
|
38
|
-
@controller.action_name = "read"
|
39
|
-
assigns[:article] = contents('article1')
|
40
|
-
render "articles/read"
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should not have too many paragraph marks around comment contents" do
|
44
|
-
response.should have_tag("p>em", "italic")
|
45
|
-
response.should have_tag("p>strong", "bold")
|
46
|
-
response.should_not have_tag("p>p>em", "italic")
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
context "formatting comments with bare links" do
|
51
|
-
before(:each) do
|
52
|
-
Blog.default.comment_text_filter = 'textile'
|
53
|
-
@controller.action_name = "read"
|
54
|
-
assigns[:article] = contents('article3')
|
55
|
-
render "articles/read"
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should automatically add links" do
|
59
|
-
response.should have_tag("a[href=mailto:foo@bar.com]",
|
60
|
-
"foo@bar.com")
|
61
|
-
response.should have_tag("a[href=http://www.bar.com]",
|
62
|
-
"http://www.bar.com")
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
@@ -1,119 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
-
|
3
|
-
describe "CommentSanitization", :shared => true do
|
4
|
-
before do
|
5
|
-
@article = mock_model(Article, :created_at => Time.now, :published_at => Time.now)
|
6
|
-
Article.stub!(:find).and_return(@article)
|
7
|
-
@blog = mock_model(Blog, :use_gravatar => false)
|
8
|
-
@blog.stub!(:lang).and_return('en_US')
|
9
|
-
@controller.template.stub!(:this_blog).and_return(@blog)
|
10
|
-
|
11
|
-
prepare_comment
|
12
|
-
|
13
|
-
@comment.stub!(:id).and_return(1)
|
14
|
-
assigns[:comment] = @comment
|
15
|
-
end
|
16
|
-
|
17
|
-
def prepare_comment
|
18
|
-
Comment.with_options(:body => 'test foo <script>do_evil();</script>',
|
19
|
-
:author => 'Bob', :article => @article,
|
20
|
-
:created_at => Time.now) do |klass|
|
21
|
-
@comment = klass.new(comment_options)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
['', 'markdown', 'textile', 'smartypants', 'markdown smartypants'].each do |value|
|
26
|
-
it "Should sanitize content rendered with the #{value} textfilter" do
|
27
|
-
@blog.stub!(:comment_text_filter).and_return(value)
|
28
|
-
|
29
|
-
render 'comments/show'
|
30
|
-
response.should have_tag('.content')
|
31
|
-
response.should have_tag('.author')
|
32
|
-
|
33
|
-
response.should_not have_tag('.content script')
|
34
|
-
response.should_not have_tag(".content a:not([rel=nofollow])")
|
35
|
-
# No links with javascript
|
36
|
-
response.should_not have_tag(".content a[onclick]")
|
37
|
-
response.should_not have_tag(".content a[href^=javascript:]")
|
38
|
-
|
39
|
-
response.should_not have_tag('.author script')
|
40
|
-
response.should_not have_tag(".author a:not([rel=nofollow])")
|
41
|
-
# No links with javascript
|
42
|
-
response.should_not have_tag(".author a[onclick]")
|
43
|
-
response.should_not have_tag(".author a[href^=javascript:]")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe "First dodgy comment" do
|
49
|
-
it_should_behave_like "CommentSanitization"
|
50
|
-
|
51
|
-
def comment_options
|
52
|
-
{ :body => 'test foo <script>do_evil();</script>' }
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe "Second dodgy comment" do
|
57
|
-
it_should_behave_like "CommentSanitization"
|
58
|
-
|
59
|
-
def comment_options
|
60
|
-
{ :body => 'link to [spammy goodness](http://spammer.example.com)'}
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe "Dodgy comment #3" do
|
65
|
-
it_should_behave_like "CommentSanitization"
|
66
|
-
|
67
|
-
def comment_options
|
68
|
-
{ :body => 'link to <a href="spammer.com">spammy goodness</a>'}
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe "Extra Dodgy comment" do
|
73
|
-
it_should_behave_like "CommentSanitization"
|
74
|
-
|
75
|
-
def comment_options
|
76
|
-
{ :body => '<a href="http://spam.org">spam</a>',
|
77
|
-
:author => '<a href="http://spamme.com>spamme</a>',
|
78
|
-
:email => '<a href="http://itsallspam.com/">its all spam</a>' }
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
describe "XSS1" do
|
83
|
-
it_should_behave_like "CommentSanitization"
|
84
|
-
|
85
|
-
def comment_options
|
86
|
-
{ :body => %{Have you ever <script lang="javascript">alert("foo");</script> been hacked?} }
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
describe "XSS2" do
|
91
|
-
it_should_behave_like "CommentSanitization"
|
92
|
-
def comment_options
|
93
|
-
{ :body => %{<a href="#" onclick="javascript">bad link</a>}}
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
describe "XSS2" do
|
98
|
-
it_should_behave_like "CommentSanitization"
|
99
|
-
|
100
|
-
def comment_options
|
101
|
-
{ :body => %{<a href="javascript:bad">bad link</a>}}
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
describe "Comment with bare http URL" do
|
106
|
-
it_should_behave_like "CommentSanitization"
|
107
|
-
|
108
|
-
def comment_options
|
109
|
-
{ :body => %{http://www.example.com} }
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
describe "Comment with bare email address" do
|
114
|
-
it_should_behave_like "CommentSanitization"
|
115
|
-
|
116
|
-
def comment_options
|
117
|
-
{ :body => %{foo@example.com} }
|
118
|
-
end
|
119
|
-
end
|
data/test/fixtures/blogs.yml
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
2
|
-
default:
|
3
|
-
base_url: http://myblog.net
|
4
|
-
settings:
|
5
|
-
show_extended_on_rss: true
|
6
|
-
blog_name: test blog
|
7
|
-
title_prefix: 1
|
8
|
-
limit_article_display: 2
|
9
|
-
sp_url_limit: 3
|
10
|
-
use_gravatar: false
|
11
|
-
blog_subtitle: test subtitle
|
12
|
-
limit_rss_display: 10
|
13
|
-
ping_urls: |-
|
14
|
-
http://ping.example.com/ping
|
15
|
-
http://alsoping.example.com/rpc/ping
|
16
|
-
geourl_location: ""
|
17
|
-
default_allow_pings: false
|
18
|
-
send_outbound_pings: false
|
19
|
-
sp_global: true
|
20
|
-
default_allow_comments: true
|
21
|
-
email_from: scott@sigkill.org
|
22
|
-
theme: typographic
|
23
|
-
text_filter: textile
|
24
|
-
sp_article_auto_close: 300
|
25
|
-
link_to_author: false
|
26
|
-
comment_text_filter: markdown
|
27
|
-
permalink_format: /%year%/%month%/%day%/%title%
|
@@ -1,29 +0,0 @@
|
|
1
|
-
software:
|
2
|
-
name: Software
|
3
|
-
permalink: software
|
4
|
-
position: 1
|
5
|
-
|
6
|
-
hardware:
|
7
|
-
name: Hardware
|
8
|
-
permalink: hardware
|
9
|
-
position: 2
|
10
|
-
|
11
|
-
personal:
|
12
|
-
name: Personal
|
13
|
-
permalink: personal
|
14
|
-
position: 3
|
15
|
-
|
16
|
-
lifeonmars:
|
17
|
-
name: Life On Mars
|
18
|
-
permalink: life-on-mars
|
19
|
-
position: 4
|
20
|
-
|
21
|
-
strangelynamed:
|
22
|
-
name: "The Permalink doesn't match"
|
23
|
-
permalink: weird-permalink
|
24
|
-
position: 5
|
25
|
-
|
26
|
-
xmltest:
|
27
|
-
name: "this & that"
|
28
|
-
permalink: this-and-that
|
29
|
-
position: 6
|