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,17 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'Given an empty redirects table' do
|
|
4
|
-
before(:each) do
|
|
5
|
-
Redirect.delete_all
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it 'redirects are unique' do
|
|
9
|
-
lambda { Redirect.create!(:from_path => 'foo/bar', :to_path => '/') }.should_not raise_error
|
|
10
|
-
|
|
11
|
-
redirect = Redirect.new(:from_path => 'foo/bar', :to_path => '/')
|
|
12
|
-
|
|
13
|
-
redirect.should_not be_valid
|
|
14
|
-
redirect.errors.on(:from_path).should == 'has already been taken'
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe Resource, ' with its fixtures loaded' do
|
|
4
|
-
before(:each) do
|
|
5
|
-
File.stub!(:exist?).and_return(true)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it 'there are three resources in the database' do
|
|
9
|
-
Resource.count.should == 3
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it 'fullpath should be RAILS_ROOT + "/public/files/" + resource.filename' do
|
|
13
|
-
res = Resource.new(:article_id => 1, :filename => 'a_new_file', :mime => 'image/jpeg', :size => 110)
|
|
14
|
-
res.fullpath.should == RAILS_ROOT + "/public/files/a_new_file"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it 'resources created with the same name as an existing resource don\'t overwrite the old resource' do
|
|
18
|
-
File.should_receive(:exist?).with(%r{public/files/me\.jpg$}).and_return(true)
|
|
19
|
-
File.should_receive(:exist?).with(%r{public/files/me1\.jpg$}).at_least(:once).and_return(false)
|
|
20
|
-
File.should_receive(:unlink).with(%r{public/files/me1\.jpg$}).and_return(true)
|
|
21
|
-
|
|
22
|
-
f1 = Resource.create(:filename => resources(:resource1).filename,
|
|
23
|
-
:mime => resources(:resource1).mime)
|
|
24
|
-
f1.should_not be_nil
|
|
25
|
-
f1.should be_valid
|
|
26
|
-
|
|
27
|
-
f1.filename.should_not == resources(:resource1).filename
|
|
28
|
-
f1.filename.should == 'me1.jpg'
|
|
29
|
-
f1.destroy
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it 'a resource deletes its associated file on destruction' do
|
|
33
|
-
res = resources(:resource1)
|
|
34
|
-
File.should_receive(:exist?).with(res.fullpath).and_return(true)
|
|
35
|
-
File.should_receive(:unlink).with(res.fullpath).and_return(true)
|
|
36
|
-
|
|
37
|
-
res.destroy
|
|
38
|
-
end
|
|
39
|
-
end
|
data/spec/models/sidebar_spec.rb
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'Given a new StaticSidebar' do
|
|
4
|
-
before(:each) { @sb = StaticSidebar.new }
|
|
5
|
-
|
|
6
|
-
it 'title should be Links' do
|
|
7
|
-
@sb.title.should == 'Links'
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it 'body should be our default' do
|
|
11
|
-
@sb.body.should == StaticSidebar::DEFAULT_TEXT
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it 'description should be set correctly' do
|
|
15
|
-
@sb.description.should == 'Static content, like links to other sites, advertisements, or blog meta-information'
|
|
16
|
-
end
|
|
17
|
-
end
|
data/spec/models/tag_spec.rb
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'Given loaded fixtures' do
|
|
4
|
-
it 'we can Tag.get by name' do
|
|
5
|
-
Tag.get('foo').should == tags(:foo)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it 'tags are unique' do
|
|
9
|
-
lambda {Tag.create!(:name => 'test')}.should_not raise_error
|
|
10
|
-
|
|
11
|
-
test_tag = Tag.new(:name => 'test')
|
|
12
|
-
test_tag.should_not be_valid
|
|
13
|
-
test_tag.errors.on(:name).should == 'has already been taken'
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it 'display names with spaces can be found by joinedupname' do
|
|
17
|
-
Tag.find(:first, :conditions => {:name => 'Monty Python'}).should be_nil
|
|
18
|
-
tag = Tag.create(:name => 'Monty Python')
|
|
19
|
-
|
|
20
|
-
tag.should be_valid
|
|
21
|
-
tag.name.should == 'montypython'
|
|
22
|
-
tag.display_name.should == 'Monty Python'
|
|
23
|
-
|
|
24
|
-
tag.should == Tag.get('montypython')
|
|
25
|
-
tag.should == Tag.get('Monty Python')
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it 'articles can be tagged' do
|
|
29
|
-
a = Article.create(:title => 'an article')
|
|
30
|
-
a.tags << tags(:foo)
|
|
31
|
-
a.tags << tags(:bar)
|
|
32
|
-
|
|
33
|
-
a.reload
|
|
34
|
-
a.tags.size.should == 2
|
|
35
|
-
a.tags.sort_by(&:id).should == [tags(:foo), tags(:bar)].sort_by(&:id)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it 'find_all_with_article_counters finds 2 tags' do
|
|
39
|
-
tags = Tag.find_all_with_article_counters
|
|
40
|
-
tags.should have(2).entries
|
|
41
|
-
|
|
42
|
-
tags.first.name.should == "foo"
|
|
43
|
-
tags.first.article_counter.should == 3
|
|
44
|
-
|
|
45
|
-
tags.last.name.should == 'bar'
|
|
46
|
-
tags.last.article_counter.should == 2
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
it 'permalink_url should be of form /tag/<name>' do
|
|
50
|
-
Tag.get('foo').permalink_url.should == 'http://myblog.net/tag/foo'
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it "find_with_char('f') should be return foo" do
|
|
54
|
-
Tag.find_with_char('f').should == [tags(:foo)]
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
it "find_with_char('v') should return empty data" do
|
|
58
|
-
Tag.find_with_char('v').should == []
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
it "find_with_char('ba') should return tag bar and bazz" do
|
|
62
|
-
Tag.find_with_char('ba').sort_by(&:id).should == [tags(:bar), tags(:bazz)].sort_by(&:id)
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
end
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe "With the list of available filters" do
|
|
4
|
-
before(:each) { @filters = TextFilter.available_filters }
|
|
5
|
-
|
|
6
|
-
it 'Markdown is an available filter' do
|
|
7
|
-
@filters.should include(Typo::Textfilter::Markdown)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it 'Smartypants is available' do
|
|
11
|
-
@filters.should include(Typo::Textfilter::Smartypants)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it 'Htmlfilter is available' do
|
|
15
|
-
@filters.should include(Typo::Textfilter::Htmlfilter)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it 'Textile is available' do
|
|
19
|
-
@filters.should include(Typo::Textfilter::Textile)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it 'Flickr is available' do
|
|
23
|
-
@filters.should include(Typo::Textfilter::Flickr)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it 'TextFilterPlugin::Markup should be unavailable' do
|
|
27
|
-
@filters.should_not include(TextFilterPlugin::Markup)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it 'TextFilterPlugin::Macro should be unavailable' do
|
|
31
|
-
@filters.should_not include(TextFilterPlugin::Macro)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
end
|
data/spec/models/theme_spec.rb
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'Given a new test theme' do
|
|
4
|
-
before(:each) do
|
|
5
|
-
@theme = Theme.new("test", "test")
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it 'layout path should be "#{RAILS_ROOT}/themes/test/layouts/default.html.erb"' do
|
|
9
|
-
@theme.layout('index').should == "#{RAILS_ROOT}/themes/test/layouts/default.html.erb"
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe 'Given the default theme' do
|
|
14
|
-
before(:each) do
|
|
15
|
-
@theme = Blog.default.current_theme
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it 'theme should be typographic' do
|
|
19
|
-
@theme.name.should == 'typographic'
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it 'theme description should be correct' do
|
|
23
|
-
@theme.description.should ==
|
|
24
|
-
File.open(RAILS_ROOT + '/themes/typographic/about.markdown') {|f| f.read}
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
it 'theme_from_path should find the correct theme' do
|
|
28
|
-
Theme.theme_from_path(RAILS_ROOT + 'themes/typographic').name.should == 'typographic'
|
|
29
|
-
Theme.theme_from_path(RAILS_ROOT + 'themes/scribbish').name.should == 'scribbish'
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it '#search_theme_path finds the right things' do
|
|
33
|
-
Theme.should_receive(:themes_root).and_return(RAILS_ROOT + '/test/mocks/themes')
|
|
34
|
-
Theme.search_theme_directory.collect{|t| File.basename(t)}.sort.should ==
|
|
35
|
-
%w{ 123-numbers-in-path CamelCaseDirectory i-have-special-chars typographic }
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it 'find_all finds all the installed themes' do
|
|
39
|
-
Theme.find_all.collect{|t| t.name}.should include(@theme.name)
|
|
40
|
-
Theme.find_all.size.should ==
|
|
41
|
-
Dir.glob(RAILS_ROOT + '/themes/[a-zA-Z0-9]*').select do |file|
|
|
42
|
-
File.readable? "#{file}/about.markdown"
|
|
43
|
-
end.size
|
|
44
|
-
end
|
|
45
|
-
end
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe Trackback, 'With the various trackback filters loaded and DNS mocked out appropriately' do
|
|
4
|
-
before(:each) do
|
|
5
|
-
IPSocket.stub!(:getaddress).and_return { raise SocketError.new("getaddrinfo: Name or service not known") }
|
|
6
|
-
@blog = Blog.default
|
|
7
|
-
@blog.sp_global = true
|
|
8
|
-
@blog.default_moderate_comments = false
|
|
9
|
-
@blog.save!
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it 'Incomplete trackbacks should not be accepted' do
|
|
13
|
-
tb = Trackback.new(:blog_name => 'Blog name',
|
|
14
|
-
:title => 'Title',
|
|
15
|
-
:excerpt => 'Excerpt',
|
|
16
|
-
:article_id => contents(:article1).id)
|
|
17
|
-
tb.should_not be_valid
|
|
18
|
-
tb.errors.should be_invalid('url')
|
|
19
|
-
|
|
20
|
-
tb.url = 'http://foo.com'
|
|
21
|
-
tb.should be_valid
|
|
22
|
-
tb.save
|
|
23
|
-
tb.guid.size.should be > 15
|
|
24
|
-
tb.should_not be_spam
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
it 'Trackbacks with a spammy link in the excerpt should be rejected' do
|
|
28
|
-
IPSocket.should_receive(:getaddress).with('chinaaircatering.com.bsb.empty.us').at_least(:once).and_return('127.0.0.2')
|
|
29
|
-
|
|
30
|
-
tb = Trackback.new(ham_params.merge(:excerpt => '<a href="http://chinaaircatering.com">spam</a>'))
|
|
31
|
-
tb.should be_spam
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it 'Trackbacks with a spammy source url should be rejected' do
|
|
35
|
-
add_spam_domain
|
|
36
|
-
tb = Trackback.new(ham_params.merge(:url => 'http://www.chinaircatering.com'))
|
|
37
|
-
tb.should be_spam
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it 'Trackbacks from a spammy ip address should be rejected' do
|
|
41
|
-
add_spam_ip('212.42.230.207')
|
|
42
|
-
tb = Trackback.new(ham_params.merge(:ip => '212.42.230.207'))
|
|
43
|
-
tb.should be_spam
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def add_spam_domain(domain = 'chinaircatering.com')
|
|
47
|
-
IPSocket.should_receive(:getaddress).with("#{domain}.bsb.empty.us").at_least(:once).and_return('127.0.0.2')
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def add_spam_ip(addr = '212.42.230.206')
|
|
51
|
-
rbl_domain = addr.split(/\./).reverse.join('.') + '.opm.blitzed.us'
|
|
52
|
-
IPSocket.should_receive(:getaddress).with(rbl_domain).at_least(:once).and_return('127.0.0.2')
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def ham_params
|
|
56
|
-
{ :blog_name => 'Blog', :title => 'trackback', :excerpt => 'bland',
|
|
57
|
-
:url => 'http://notaspammer.com', :ip => '212.42.230.206',
|
|
58
|
-
:blog => @blog }
|
|
59
|
-
end
|
|
60
|
-
end
|
data/spec/models/trigger_spec.rb
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'With the contents fixture' do
|
|
4
|
-
before(:each) do
|
|
5
|
-
@page = mock('fake_page')
|
|
6
|
-
@page.stub!(:id).and_return(1)
|
|
7
|
-
@page.stub!(:type).and_return('Page')
|
|
8
|
-
@page.stub!(:new_record?).and_return(false)
|
|
9
|
-
@page.stub!(:class).and_return(Page)
|
|
10
|
-
@page.stub!(:destroyed?).and_return(false)
|
|
11
|
-
Content.stub!(:find).and_return(@page)
|
|
12
|
-
@current_utime = 1
|
|
13
|
-
Time.stub!(:now).and_return { Time.at(@current_utime) }
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def sleep(time_delta)
|
|
17
|
-
@current_utime += time_delta
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it '.post_action should not fire immediately for future triggers' do
|
|
21
|
-
lambda do
|
|
22
|
-
Trigger.post_action(Time.now + 2, @page, 'tickle')
|
|
23
|
-
Trigger.count.should == 1
|
|
24
|
-
Trigger.fire
|
|
25
|
-
Trigger.count.should == 1
|
|
26
|
-
end.should_not raise_error
|
|
27
|
-
|
|
28
|
-
@page.should_receive(:tickle)
|
|
29
|
-
sleep 2
|
|
30
|
-
Trigger.fire
|
|
31
|
-
Trigger.count.should == 0
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it '.post_action should fire immediately if the target time is <= now' do
|
|
35
|
-
@page.should_receive(:tickle)
|
|
36
|
-
Trigger.post_action(Time.now, @page, 'tickle')
|
|
37
|
-
Trigger.count.should == 0
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
end
|
data/spec/models/user_spec.rb
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe User do
|
|
4
|
-
describe 'Factory Girl' do
|
|
5
|
-
it 'should user factory valid' do
|
|
6
|
-
Factory.create(:user).should be_valid
|
|
7
|
-
Factory.build(:user).should be_valid
|
|
8
|
-
end
|
|
9
|
-
it 'should multiple user factory valid' do
|
|
10
|
-
Factory.create(:user).should be_valid
|
|
11
|
-
Factory.create(:user).should be_valid
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe 'With the contents and users fixtures loaded' do
|
|
17
|
-
before(:each) do
|
|
18
|
-
User.stub!(:salt).and_return('change-me')
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it 'Calling User.authenticate with a valid user/password combo returns a user' do
|
|
22
|
-
User.authenticate('bob', 'test').should == users(:bob)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
it 'User.authenticate(user,invalid) returns nil' do
|
|
26
|
-
User.authenticate('bob', 'wrong password').should be_nil
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
it 'User.authenticate(inactive,valid) returns nil' do
|
|
30
|
-
User.authenticate('inactive', 'longtest').should be_nil
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
it 'User.authenticate(invalid,whatever) returns nil' do
|
|
34
|
-
User.authenticate('userwhodoesnotexist', 'what ever').should be_nil
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
it 'The various article finders work appropriately' do
|
|
38
|
-
users(:tobi).articles.size.should == 8
|
|
39
|
-
# User.find(1).articles.find_published.size.should == Article.find(:all, :conditions => {:published => true}).size
|
|
40
|
-
users(:tobi).articles.published.size.should == 7
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it 'authenticate? works as expected' do
|
|
44
|
-
User.should be_authenticate('bob', 'test')
|
|
45
|
-
User.should_not be_authenticate('bob', 'duff password')
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
describe 'With a new user' do
|
|
50
|
-
before(:each) do
|
|
51
|
-
@user = User.new :login => 'not_bob'
|
|
52
|
-
@user.email = 'typo@typo.com'
|
|
53
|
-
set_password 'a secure password'
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
describe "the password" do
|
|
57
|
-
it 'can be just right' do
|
|
58
|
-
set_password 'Just right'
|
|
59
|
-
@user.should be_valid
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
{ 'too short' => 'x',
|
|
63
|
-
'too long' => 'repetitivepass' * 10,
|
|
64
|
-
'empty' => ''
|
|
65
|
-
}.each do |problematic, password|
|
|
66
|
-
it "cannot be #{problematic}" do
|
|
67
|
-
set_password password
|
|
68
|
-
@user.should_not be_valid
|
|
69
|
-
@user.errors.should be_invalid('password')
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
it "has to match confirmation" do
|
|
74
|
-
@user.password = "foo"
|
|
75
|
-
@user.password_confirmation = "bar"
|
|
76
|
-
@user.should_not be_valid
|
|
77
|
-
@user.errors.should be_invalid('password')
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
describe 'the login' do
|
|
82
|
-
it 'can be just right' do
|
|
83
|
-
@user.login = 'okbob'
|
|
84
|
-
@user.should be_valid
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
{ 'too short' => 'x',
|
|
88
|
-
'too long' => 'repetitivepass' * 10,
|
|
89
|
-
'empty' => ''
|
|
90
|
-
}.each do |problematic, login|
|
|
91
|
-
it "cannot be #{problematic}" do
|
|
92
|
-
@user.login = login
|
|
93
|
-
@user.should_not be_valid
|
|
94
|
-
@user.errors.should be_invalid('login')
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
it 'email cannot be blank' do
|
|
100
|
-
@user.email = ''
|
|
101
|
-
@user.should_not be_valid
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
def set_password(newpass)
|
|
105
|
-
@user.password = @user.password_confirmation = newpass
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
describe 'With a user in the database' do
|
|
110
|
-
before(:each) do
|
|
111
|
-
@olduser = Factory.create(:user)
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
it 'should not be able to create another user with the same login' do
|
|
115
|
-
login = @olduser.login
|
|
116
|
-
u = User.new(:login => login) {|u| u.password = u.password_confirmation = 'secure password'}
|
|
117
|
-
|
|
118
|
-
u.should_not be_valid
|
|
119
|
-
u.errors.should be_invalid('login')
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
describe 'Updating an existing user' do
|
|
124
|
-
before(:each) do
|
|
125
|
-
@user = Factory.create(:user)
|
|
126
|
-
set_password 'a secure password'
|
|
127
|
-
@user.save!
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
describe "the password" do
|
|
131
|
-
{ 'just right' => 'Just right',
|
|
132
|
-
'empty' => ''
|
|
133
|
-
}.each do |ok, password|
|
|
134
|
-
it "can be #{ok}" do
|
|
135
|
-
set_password password
|
|
136
|
-
@user.should be_valid
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
{ 'too short' => 'x',
|
|
141
|
-
'too long' => 'repetitivepass' * 10,
|
|
142
|
-
}.each do |problematic, password|
|
|
143
|
-
it "cannot be #{problematic}" do
|
|
144
|
-
set_password password
|
|
145
|
-
@user.should_not be_valid
|
|
146
|
-
@user.errors.should be_invalid('password')
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
it "has to match confirmation" do
|
|
151
|
-
@user.password = "foo"
|
|
152
|
-
@user.password_confirmation = "bar"
|
|
153
|
-
@user.should_not be_valid
|
|
154
|
-
@user.errors.should be_invalid('password')
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
it "is not actually changed when set to empty" do
|
|
158
|
-
set_password ''
|
|
159
|
-
@user.save!
|
|
160
|
-
User.authenticate(@user.login, '').should be_nil
|
|
161
|
-
User.authenticate(@user.login, 'a secure password').should == @user
|
|
162
|
-
end
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
describe "saving twice" do
|
|
166
|
-
it "should not change the password" do
|
|
167
|
-
(found = User.authenticate(@user.login, 'a secure password')).should == @user
|
|
168
|
-
found.save
|
|
169
|
-
found.save
|
|
170
|
-
User.authenticate(@user.login, 'a secure password').should == found
|
|
171
|
-
end
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
describe 'the login' do
|
|
175
|
-
it 'must not change' do
|
|
176
|
-
@user.login = 'not_bob'
|
|
177
|
-
@user.should_not be_valid
|
|
178
|
-
end
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
def set_password(newpass)
|
|
182
|
-
@user.password = @user.password_confirmation = newpass
|
|
183
|
-
end
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
describe User do
|
|
187
|
-
describe '#admin?' do
|
|
188
|
-
|
|
189
|
-
it 'should return true if user is admin' do
|
|
190
|
-
users(:tobi).should be_admin
|
|
191
|
-
end
|
|
192
|
-
|
|
193
|
-
it 'should return false if user is not admin' do
|
|
194
|
-
users(:user_publisher).should_not be_admin
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
end
|
|
198
|
-
end
|