zen 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +15 -0
- data/.mailmap +2 -0
- data/.rvmrc +2 -0
- data/.travis.yml +8 -3
- data/AUTHORS +1 -2
- data/CHANGELOG.md +48 -17
- data/README.md +44 -39
- data/Rakefile +4 -0
- data/bin/zen +5 -30
- data/lib/zen.rb +13 -19
- data/lib/zen/asset.rb +99 -64
- data/lib/zen/bin/create.rb +94 -0
- data/lib/zen/bin/runner.rb +118 -0
- data/lib/zen/controller/admin_controller.rb +52 -36
- data/lib/zen/controller/base_controller.rb +5 -5
- data/lib/zen/controller/frontend_controller.rb +7 -7
- data/lib/zen/controller/main_controller.rb +12 -10
- data/lib/zen/controller/preview.rb +15 -11
- data/lib/zen/helper/acl.rb +73 -53
- data/lib/zen/helper/blue_form_vendor.rb +689 -0
- data/lib/zen/helper/breadcrumb.rb +23 -19
- data/lib/zen/helper/message.rb +3 -3
- data/lib/zen/helper/theme.rb +18 -13
- data/lib/zen/language.rb +62 -58
- data/lib/zen/language/en/zen_general.yml +2 -4
- data/lib/zen/language/nl/zen_general.yml +2 -4
- data/lib/zen/layout/admin.xhtml +3 -12
- data/lib/zen/layout/login.xhtml +1 -6
- data/lib/zen/model/methods.rb +6 -6
- data/lib/zen/model/settings.rb +5 -4
- data/lib/zen/package.rb +47 -38
- data/lib/zen/package/all.rb +3 -5
- data/lib/zen/package/base.rb +7 -7
- data/lib/zen/package/categories/lib/categories.rb +8 -3
- data/lib/zen/package/categories/lib/categories/controller/categories.rb +81 -55
- data/lib/zen/package/categories/lib/categories/controller/category_groups.rb +45 -44
- data/lib/zen/package/categories/lib/categories/helper/category.rb +88 -0
- data/lib/zen/package/categories/lib/categories/language/en/categories.yml +5 -4
- data/lib/zen/package/categories/lib/categories/language/en/category_groups.yml +5 -4
- data/lib/zen/package/categories/lib/categories/language/nl/categories.yml +5 -4
- data/lib/zen/package/categories/lib/categories/language/nl/category_groups.yml +5 -4
- data/lib/zen/package/categories/lib/categories/model/category.rb +15 -13
- data/lib/zen/package/categories/lib/categories/model/category_group.rb +3 -3
- data/lib/zen/package/categories/lib/categories/plugin/categories.rb +36 -25
- data/lib/zen/package/categories/lib/categories/view/admin/categories/form.xhtml +49 -56
- data/lib/zen/package/categories/lib/categories/view/admin/categories/index.xhtml +48 -35
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/form.xhtml +36 -29
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/index.xhtml +42 -37
- data/lib/zen/package/comments/lib/comments.rb +4 -1
- data/lib/zen/package/comments/lib/comments/controller/comments.rb +39 -32
- data/lib/zen/package/comments/lib/comments/controller/comments_form.rb +45 -26
- data/lib/zen/package/comments/lib/comments/helper/comment.rb +35 -0
- data/lib/zen/package/comments/lib/comments/language/en/comments.yml +9 -7
- data/lib/zen/package/comments/lib/comments/language/nl/comments.yml +10 -8
- data/lib/zen/package/comments/lib/comments/model/comment.rb +31 -17
- data/lib/zen/package/comments/lib/comments/model/comment_status.rb +15 -0
- data/lib/zen/package/comments/lib/comments/plugin/anti_spam.rb +27 -18
- data/lib/zen/package/comments/lib/comments/plugin/comments.rb +25 -20
- data/lib/zen/package/comments/lib/comments/view/admin/comments/form.xhtml +61 -54
- data/lib/zen/package/comments/lib/comments/view/admin/comments/index.xhtml +38 -23
- data/lib/zen/package/comments/migrations/1308774099_comment_status.rb +60 -0
- data/lib/zen/package/custom_fields/lib/custom_fields.rb +33 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/blue_form_parameters.rb +209 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_groups.rb +50 -47
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_types.rb +215 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_fields.rb +111 -73
- data/lib/zen/package/custom_fields/lib/custom_fields/helper/custom_field.rb +79 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_field_groups.yml +20 -19
- data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_field_types.yml +40 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_fields.yml +34 -32
- data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_field_groups.yml +5 -4
- data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_field_types.yml +40 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_fields.yml +18 -16
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field.rb +31 -11
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_method.rb +15 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_type.rb +50 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_value.rb +28 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/form.xhtml +33 -28
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/index.xhtml +48 -46
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-types/form.xhtml +61 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-types/index.xhtml +93 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/form.xhtml +105 -99
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/index.xhtml +43 -39
- data/lib/zen/package/custom_fields/migrations/1295255665_create_schema.rb +47 -16
- data/lib/zen/package/custom_fields/migrations/1310659580_custom_field_types.rb +148 -0
- data/lib/zen/package/custom_fields/migrations/1311694920_rename_css_class.rb +11 -0
- data/lib/zen/package/menus/lib/menus/controller/menu_items.rb +40 -35
- data/lib/zen/package/menus/lib/menus/controller/menus.rb +47 -43
- data/lib/zen/package/menus/lib/menus/helper/{menu_item.rb → menu.rb} +42 -15
- data/lib/zen/package/menus/lib/menus/language/en/menu_items.yml +5 -5
- data/lib/zen/package/menus/lib/menus/language/en/menus.yml +9 -8
- data/lib/zen/package/menus/lib/menus/language/nl/menu_items.yml +8 -8
- data/lib/zen/package/menus/lib/menus/language/nl/menus.yml +11 -10
- data/lib/zen/package/menus/lib/menus/model/menu.rb +5 -5
- data/lib/zen/package/menus/lib/menus/model/menu_item.rb +6 -5
- data/lib/zen/package/menus/lib/menus/plugin/menus.rb +41 -43
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/form.xhtml +59 -63
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/index.xhtml +35 -30
- data/lib/zen/package/menus/lib/menus/view/admin/menus/form.xhtml +46 -37
- data/lib/zen/package/menus/lib/menus/view/admin/menus/index.xhtml +37 -37
- data/lib/zen/package/menus/migrations/1297184342_create_schema.rb +5 -5
- data/lib/zen/package/menus/migrations/1308671733_rename_order_column.rb +11 -0
- data/lib/zen/package/menus/migrations/1311695030_rename_css_class.rb +17 -0
- data/lib/zen/package/sections/lib/sections.rb +18 -11
- data/lib/zen/package/sections/lib/sections/controller/section_entries.rb +115 -109
- data/lib/zen/package/sections/lib/sections/controller/sections.rb +72 -50
- data/lib/zen/package/sections/lib/sections/helper/section.rb +53 -0
- data/lib/zen/package/sections/lib/sections/language/en/section_entries.yml +5 -4
- data/lib/zen/package/sections/lib/sections/language/en/sections.yml +5 -4
- data/lib/zen/package/sections/lib/sections/language/nl/section_entries.yml +5 -4
- data/lib/zen/package/sections/lib/sections/language/nl/sections.yml +5 -4
- data/lib/zen/package/sections/lib/sections/model/section.rb +17 -9
- data/lib/zen/package/sections/lib/sections/model/section_entry.rb +192 -13
- data/lib/zen/package/sections/lib/sections/model/section_entry_status.rb +13 -0
- data/lib/zen/package/sections/lib/sections/plugin/section_entries.rb +60 -39
- data/lib/zen/package/sections/lib/sections/plugin/sections.rb +14 -11
- data/lib/zen/package/sections/lib/sections/view/admin/form.xhtml +100 -97
- data/lib/zen/package/sections/lib/sections/view/admin/index.xhtml +41 -39
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/form.xhtml +95 -215
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/index.xhtml +48 -40
- data/lib/zen/package/sections/migrations/1308672298_use_id_for_default_section.rb +40 -0
- data/lib/zen/package/sections/migrations/1308813320_section_entry_statuses.rb +58 -0
- data/lib/zen/package/settings/lib/settings/controller/settings.rb +5 -8
- data/lib/zen/package/settings/lib/settings/model/setting.rb +2 -37
- data/lib/zen/package/settings/lib/settings/plugin/setting_base.rb +18 -1
- data/lib/zen/package/settings/lib/settings/plugin/settings.rb +13 -7
- data/lib/zen/package/settings/lib/settings/view/admin/settings/index.xhtml +2 -1
- data/lib/zen/package/users/lib/users.rb +3 -1
- data/lib/zen/package/users/lib/users/controller/access_rules.rb +77 -60
- data/lib/zen/package/users/lib/users/controller/user_groups.rb +41 -36
- data/lib/zen/package/users/lib/users/controller/users.rb +48 -42
- data/lib/zen/package/users/lib/users/helper/users.rb +72 -0
- data/lib/zen/package/users/lib/users/language/en/access_rules.yml +6 -5
- data/lib/zen/package/users/lib/users/language/en/user_groups.yml +5 -4
- data/lib/zen/package/users/lib/users/language/en/users.yml +1 -0
- data/lib/zen/package/users/lib/users/language/nl/access_rules.yml +5 -4
- data/lib/zen/package/users/lib/users/language/nl/user_groups.yml +5 -4
- data/lib/zen/package/users/lib/users/language/nl/users.yml +1 -0
- data/lib/zen/package/users/lib/users/model/access_rule.rb +5 -1
- data/lib/zen/package/users/lib/users/model/user.rb +17 -10
- data/lib/zen/package/users/lib/users/public/admin/js/users/access_rules.js +10 -37
- data/lib/zen/package/users/lib/users/public/admin/js/users/lib/access_rules.js +49 -0
- data/lib/zen/package/users/lib/users/view/admin/access-rules/form.xhtml +105 -96
- data/lib/zen/package/users/lib/users/view/admin/access-rules/index.xhtml +48 -41
- data/lib/zen/package/users/lib/users/view/admin/user-groups/form.xhtml +42 -32
- data/lib/zen/package/users/lib/users/view/admin/user-groups/index.xhtml +43 -38
- data/lib/zen/package/users/lib/users/view/admin/users/form.xhtml +76 -67
- data/lib/zen/package/users/lib/users/view/admin/users/index.xhtml +43 -41
- data/lib/zen/package/users/lib/users/view/admin/users/login.xhtml +12 -9
- data/lib/zen/package/users/migrations/1295281013_create_schema.rb +2 -2
- data/lib/zen/plugin.rb +56 -50
- data/lib/zen/plugin/markup/lib/markup/markup.rb +33 -21
- data/lib/zen/public/admin/css/zen/buttons.css +11 -7
- data/lib/zen/public/admin/css/zen/datepicker.css +6 -6
- data/lib/zen/public/admin/css/zen/forms.css +2 -1
- data/lib/zen/public/admin/css/zen/general.css +15 -10
- data/lib/zen/public/admin/css/zen/layout.css +51 -20
- data/lib/zen/public/admin/css/zen/tables.css +39 -11
- data/lib/zen/public/admin/css/zen/tabs.css +6 -4
- data/lib/zen/public/admin/css/zen/window.css +11 -11
- data/lib/zen/public/{favicon.ico → admin/favicon.ico} +0 -0
- data/lib/zen/public/admin/images/zen/icons/asc.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/desc.png +0 -0
- data/lib/zen/public/admin/js/vendor/datepicker.js +0 -11
- data/lib/zen/public/admin/js/{mootools → vendor/mootools}/core.js +0 -1
- data/lib/zen/public/admin/js/{mootools → vendor/mootools}/more.js +100 -29
- data/lib/zen/public/admin/js/zen/index.js +48 -0
- data/lib/zen/public/admin/js/zen/lib/asset.js +111 -0
- data/lib/zen/public/admin/js/zen/{editor.js → lib/editor.js} +107 -127
- data/lib/zen/public/admin/js/zen/{editor → lib/editor}/markdown.js +7 -9
- data/lib/zen/public/admin/js/zen/{editor → lib/editor}/textile.js +7 -9
- data/lib/zen/public/admin/js/zen/lib/html_table.js +143 -0
- data/lib/zen/public/admin/js/zen/{tabs.js → lib/tabs.js} +40 -37
- data/lib/zen/public/admin/js/zen/{window.js → lib/window.js} +24 -20
- data/lib/zen/spec/bacon/color_output.rb +39 -0
- data/lib/zen/spec/helper.rb +152 -0
- data/lib/zen/spec/simplecov.rb +22 -0
- data/lib/zen/task/build.rake +20 -43
- data/lib/zen/task/clean.rake +2 -6
- data/lib/zen/task/db.rake +8 -12
- data/lib/zen/task/package.rake +4 -10
- data/lib/zen/task/plugin.rake +3 -9
- data/lib/zen/task/proto.rake +0 -62
- data/lib/zen/task/test.rake +6 -3
- data/lib/zen/task/theme.rake +4 -11
- data/lib/zen/theme.rb +22 -24
- data/lib/zen/validation.rb +34 -27
- data/lib/zen/version.rb +2 -8
- data/lib/zen/view/head.xhtml +7 -0
- data/lib/zen/view/main.xhtml +7 -22
- data/{proto/package/migrations → pkg}/.gitkeep +0 -0
- data/proto/app/app.rb +1 -0
- data/proto/app/config/config.rb +5 -4
- data/proto/app/config/database.rb +19 -41
- data/proto/app/config/middlewares.rb +32 -29
- data/proto/{package/lib/package/view/admin/package/index.xhtml → app/log/database/dev/.gitkeep} +0 -0
- data/proto/app/log/database/live/.gitkeep +0 -0
- data/spec/Rakefile +26 -0
- data/spec/fixtures/zen/asset.rb +18 -0
- data/spec/fixtures/zen/helper/acl.rb +39 -0
- data/spec/fixtures/zen/helper/message.rb +19 -0
- data/spec/fixtures/zen/language/en/spec.yml +10 -0
- data/spec/fixtures/zen/language/nl/spec.yml +7 -0
- data/spec/fixtures/zen/package.rb +17 -0
- data/spec/fixtures/zen/package/comments/controller/comments_form.rb +27 -0
- data/spec/fixtures/zen/package/settings/plugin/settings.rb +20 -0
- data/spec/fixtures/zen/plugin.rb +7 -0
- data/spec/fixtures/zen/theme/404.xhtml +1 -0
- data/spec/fixtures/zen/theme/default-section/index.xhtml +1 -0
- data/spec/fixtures/zen/theme/helper/404.xhtml +1 -0
- data/spec/fixtures/zen/theme/helper/partial.xhtml +1 -0
- data/spec/fixtures/zen/theme/helper/wrong_partial.xhtml +1 -0
- data/spec/fixtures/zen/theme/partials/partial.xhtml +1 -0
- data/spec/fixtures/zen/theme/theme.rb +11 -0
- data/spec/fixtures/zen/validation.rb +22 -0
- data/spec/helper.rb +41 -0
- data/spec/zen/all.rb +5 -0
- data/spec/zen/asset.rb +97 -0
- data/spec/zen/bin/create.rb +89 -0
- data/spec/zen/bin/runner.rb +47 -0
- data/spec/zen/controller/admin_controller.rb +26 -0
- data/spec/zen/controller/main_controller.rb +81 -0
- data/spec/zen/controller/preview.rb +33 -0
- data/spec/zen/helper/acl.rb +149 -0
- data/spec/zen/helper/breadcrumb.rb +38 -0
- data/spec/zen/helper/message.rb +31 -0
- data/spec/zen/helper/theme.rb +58 -0
- data/spec/zen/language.rb +55 -0
- data/spec/zen/package.rb +23 -0
- data/spec/zen/package/categories/controller/categories.rb +123 -0
- data/spec/zen/package/categories/controller/category_groups.rb +108 -0
- data/spec/zen/package/categories/helper/category.rb +75 -0
- data/spec/zen/package/categories/plugin/categories.rb +92 -0
- data/spec/zen/package/comments/controller/comments.rb +134 -0
- data/spec/zen/package/comments/controller/comments_form.rb +343 -0
- data/spec/zen/package/comments/helper/comment.rb +47 -0
- data/spec/zen/package/comments/plugin/anti_spam.rb +59 -0
- data/spec/zen/package/comments/plugin/comments.rb +107 -0
- data/spec/zen/package/custom_fields/blue_form_parameters.rb +183 -0
- data/spec/zen/package/custom_fields/controller/custom_field_groups.rb +120 -0
- data/spec/zen/package/custom_fields/controller/custom_field_types.rb +169 -0
- data/spec/zen/package/custom_fields/controller/custom_fields.rb +158 -0
- data/spec/zen/package/custom_fields/helper/custom_field.rb +86 -0
- data/spec/zen/package/menus/controller/menu_items.rb +110 -0
- data/spec/zen/package/menus/controller/menus.rb +110 -0
- data/spec/zen/package/menus/helper/menu.rb +75 -0
- data/spec/zen/package/menus/plugin/menus.rb +120 -0
- data/spec/zen/package/sections/controller/section_entries.rb +201 -0
- data/spec/zen/package/sections/controller/sections.rb +116 -0
- data/spec/zen/package/sections/helper/section.rb +74 -0
- data/spec/zen/package/sections/plugin/section_entries.rb +161 -0
- data/spec/zen/package/sections/plugin/sections.rb +75 -0
- data/spec/zen/package/settings/controller/settings.rb +36 -0
- data/spec/zen/package/settings/plugin/settings.rb +33 -0
- data/spec/zen/package/users/controller/access_rules.rb +90 -0
- data/spec/zen/package/users/controller/user_groups.rb +101 -0
- data/spec/zen/package/users/controller/users.rb +130 -0
- data/spec/zen/package/users/helper/users.rb +97 -0
- data/spec/zen/plugin.rb +64 -0
- data/spec/zen/plugin/helper.rb +11 -0
- data/spec/zen/plugin/markup.rb +44 -0
- data/spec/zen/theme.rb +41 -0
- data/spec/zen/validation.rb +63 -0
- data/zen.gemspec +36 -0
- metadata +159 -113
- data/MANIFEST +0 -266
- data/lib/zen/bin/app.rb +0 -40
- data/lib/zen/ext/string.rb +0 -185
- data/lib/zen/helper/common.rb +0 -106
- data/lib/zen/package/categories/lib/categories/view/admin/categories/edit.xhtml +0 -7
- data/lib/zen/package/categories/lib/categories/view/admin/categories/new.xhtml +0 -7
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/edit.xhtml +0 -7
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/new.xhtml +0 -7
- data/lib/zen/package/comments/lib/comments/view/admin/comments/edit.xhtml +0 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/edit.xhtml +0 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/new.xhtml +0 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/edit.xhtml +0 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/new.xhtml +0 -7
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/edit.xhtml +0 -7
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/new.xhtml +0 -7
- data/lib/zen/package/menus/lib/menus/view/admin/menus/edit.xhtml +0 -7
- data/lib/zen/package/menus/lib/menus/view/admin/menus/new.xhtml +0 -7
- data/lib/zen/package/sections/lib/sections/view/admin/edit.xhtml +0 -7
- data/lib/zen/package/sections/lib/sections/view/admin/new.xhtml +0 -7
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/edit.xhtml +0 -7
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/new.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/access-rules/edit.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/access-rules/new.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/user-groups/edit.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/user-groups/new.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/users/edit.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/users/new.xhtml +0 -7
- data/lib/zen/plugin/controller.rb +0 -59
- data/lib/zen/public/admin/css/zen/notifications.css +0 -84
- data/lib/zen/public/admin/images/zen/icons/large/error.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/large/notice.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/large/success.png +0 -0
- data/lib/zen/public/admin/js/zen/core.js +0 -73
- data/lib/zen/public/admin/js/zen/init.js +0 -80
- data/proto/package/lib/package.rb +0 -21
- data/proto/package/lib/package/controller/controllers.rb +0 -50
- data/proto/package/lib/package/language/en/languages.yml +0 -4
- data/proto/package/lib/package/model/model.rb +0 -12
@@ -0,0 +1,47 @@
|
|
1
|
+
require File.expand_path('../../../../../helper', __FILE__)
|
2
|
+
|
3
|
+
describe('Ramaze::Helper::Comment') do
|
4
|
+
behaves_like :capybara
|
5
|
+
|
6
|
+
user_id = Users::Model::User[:email => 'spec@domain.tld'].id
|
7
|
+
status_id = Sections::Model::SectionEntryStatus[:name => 'published'].id
|
8
|
+
@section = Sections::Model::Section.create(
|
9
|
+
:name => 'Comment spec section',
|
10
|
+
:comment_allow => false,
|
11
|
+
:comment_require_account => false,
|
12
|
+
:comment_moderate => false,
|
13
|
+
:comment_format => 'markdown'
|
14
|
+
)
|
15
|
+
|
16
|
+
@entry = Sections::Model::SectionEntry.create(
|
17
|
+
:title => 'Spec entry',
|
18
|
+
:user_id => user_id,
|
19
|
+
:section_entry_status_id => status_id,
|
20
|
+
:section_id => @section.id
|
21
|
+
)
|
22
|
+
|
23
|
+
@comment = Comments::Model::Comment.create(
|
24
|
+
:comment => 'Spec comment',
|
25
|
+
:name => 'spec',
|
26
|
+
:email => 'spec@domain.tld',
|
27
|
+
:section_entry_id => @entry.id
|
28
|
+
)
|
29
|
+
|
30
|
+
it('Validate a valid comment') do
|
31
|
+
url = Comments::Controller::Comments.r(:edit, @comment.id).to_s
|
32
|
+
|
33
|
+
visit(url)
|
34
|
+
|
35
|
+
current_path.should === url
|
36
|
+
end
|
37
|
+
|
38
|
+
it('Validate an invalid comment') do
|
39
|
+
visit(Comments::Controller::Comments.r(:edit, @comment.id + 100).to_s)
|
40
|
+
|
41
|
+
current_path.should === Comments::Controller::Comments.r(:index).to_s
|
42
|
+
end
|
43
|
+
|
44
|
+
@comment.destroy
|
45
|
+
@entry.destroy
|
46
|
+
@section.destroy
|
47
|
+
end # describe
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require File.expand_path('../../../../../helper', __FILE__)
|
2
|
+
|
3
|
+
# If any system fails at this comment it's run buy a bunch of idiots.
|
4
|
+
spam_comment = 'Hello, you can buy viagra here <a href="http://buyviagra.com/">
|
5
|
+
Buy Viagra</a>'
|
6
|
+
|
7
|
+
describe("Comments::Plugin::AntiSpam") do
|
8
|
+
behaves_like :capybara
|
9
|
+
|
10
|
+
yaml_response = <<-YAML.strip
|
11
|
+
defensio-result:
|
12
|
+
api-version: 2.0
|
13
|
+
status: success
|
14
|
+
message:
|
15
|
+
signature: 1234abc
|
16
|
+
allow: false
|
17
|
+
classification: spam
|
18
|
+
spaminess: 0.9
|
19
|
+
profanity-match: false
|
20
|
+
YAML
|
21
|
+
|
22
|
+
stub_request(
|
23
|
+
:post,
|
24
|
+
'http://api.defensio.com/2.0/users/test/documents.yaml'
|
25
|
+
).to_return(:body => yaml_response)
|
26
|
+
|
27
|
+
it('Try to use an invalid engine') do
|
28
|
+
should.raise?(Zen::PluginError) do
|
29
|
+
plugin(:anti_spam, :foobar, nil, nil, nil, spam_comment)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it('Validate a spam comment using Defensio') do
|
34
|
+
plugin(:settings, :get, :defensio_key).value = 'test'
|
35
|
+
plugin(:anti_spam, :defensio, nil, nil, nil, spam_comment).should === true
|
36
|
+
end
|
37
|
+
|
38
|
+
it('Validate a comment using Defensio without an API key') do
|
39
|
+
plugin(:settings, :get, :defensio_key).value = nil
|
40
|
+
|
41
|
+
should.raise?(Zen::PluginError) do
|
42
|
+
plugin(:anti_spam, :defensio, nil, nil, nil, spam_comment)
|
43
|
+
end
|
44
|
+
|
45
|
+
plugin(:settings, :get, :defensio_key).value = 'test'
|
46
|
+
end
|
47
|
+
|
48
|
+
it('Load an engine\'s Gem that does not exist') do
|
49
|
+
Comments::Plugin::AntiSpam::Registered[:defensio] = 'test'
|
50
|
+
|
51
|
+
should.raise?(Zen::PluginError) do
|
52
|
+
plugin(:anti_spam, :defensio, nil, nil, nil, spam_comment)
|
53
|
+
end
|
54
|
+
|
55
|
+
Comments::Plugin::AntiSpam::Registered[:defensio] = 'defensio'
|
56
|
+
end
|
57
|
+
|
58
|
+
WebMock.reset!
|
59
|
+
end # describe
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require File.expand_path('../../../../../helper', __FILE__)
|
2
|
+
require 'rdiscount'
|
3
|
+
|
4
|
+
describe("Comments::Plugin::Comments") do
|
5
|
+
extend Sections::Model
|
6
|
+
extend Comments::Model
|
7
|
+
extend Users::Model
|
8
|
+
|
9
|
+
it("Create the test data") do
|
10
|
+
user = User[:email => 'spec@domain.tld']
|
11
|
+
status_id = CommentStatus[:name => 'open'].id
|
12
|
+
|
13
|
+
@section = Section.create(
|
14
|
+
:name => 'Spec',
|
15
|
+
:comment_allow => true,
|
16
|
+
:comment_require_account => false,
|
17
|
+
:comment_moderate => false,
|
18
|
+
:comment_format => 'markdown'
|
19
|
+
)
|
20
|
+
|
21
|
+
@entry = SectionEntry.create(
|
22
|
+
:title => 'Spec',
|
23
|
+
:status => 'published',
|
24
|
+
:section_id => @section.id,
|
25
|
+
:user_id => user.id
|
26
|
+
)
|
27
|
+
|
28
|
+
@comment_1 = Comment.create(
|
29
|
+
:user_id => user.id,
|
30
|
+
:comment => 'Spec comment',
|
31
|
+
:status => status_id,
|
32
|
+
:section_entry_id => @entry.id,
|
33
|
+
:email => user.email
|
34
|
+
)
|
35
|
+
|
36
|
+
@comment_2 = Comment.create(
|
37
|
+
:user_id => user.id,
|
38
|
+
:comment => 'Spec comment 1',
|
39
|
+
:status => status_id,
|
40
|
+
:section_entry_id => @entry.id,
|
41
|
+
:email => user.email
|
42
|
+
)
|
43
|
+
|
44
|
+
@section.name.should === 'Spec'
|
45
|
+
@entry.title.should === 'Spec'
|
46
|
+
@comment_1.comment.should === 'Spec comment'
|
47
|
+
@comment_2.comment.should === 'Spec comment 1'
|
48
|
+
end
|
49
|
+
|
50
|
+
it("Retrieve all comments for an ID") do
|
51
|
+
comments = plugin(:comments, :entry => @entry.slug)
|
52
|
+
|
53
|
+
comments.count.should === 2
|
54
|
+
comments[0].class.should == Hash
|
55
|
+
comments[0][:comment].include?('Spec comment').should === true
|
56
|
+
comments[1][:comment].include?('Spec comment 1').should === true
|
57
|
+
comments[1][:user][:email].should === 'spec@domain.tld'
|
58
|
+
comments[1][:user][:name].should === 'Spec'
|
59
|
+
end
|
60
|
+
|
61
|
+
it("Retrieve all comments for a slug") do
|
62
|
+
comments = plugin(:comments, :entry => @entry.id)
|
63
|
+
|
64
|
+
comments.count.should === 2
|
65
|
+
comments[0][:comment].include?('Spec comment').should === true
|
66
|
+
comments[1][:comment].include?('Spec comment 1').should === true
|
67
|
+
end
|
68
|
+
|
69
|
+
it("Retrieve all comments and check the markup") do
|
70
|
+
comments = plugin(:comments, :entry => @entry.id)
|
71
|
+
|
72
|
+
comments.count.should === 2
|
73
|
+
comments[0][:comment].strip.should === '<p>Spec comment</p>'
|
74
|
+
comments[1][:comment].strip.should === '<p>Spec comment 1</p>'
|
75
|
+
end
|
76
|
+
|
77
|
+
it("Retrieve a single comment") do
|
78
|
+
comments = plugin(
|
79
|
+
:comments, :entry => @entry.id, :limit => 1
|
80
|
+
)
|
81
|
+
|
82
|
+
comments.count.should === 1
|
83
|
+
comments[0][:comment].include?('Spec comment').should === true
|
84
|
+
end
|
85
|
+
|
86
|
+
it("Retrieve a single comment with an offset") do
|
87
|
+
comments = plugin(
|
88
|
+
:comments, :entry => @entry.id, :limit => 1, :offset => 1
|
89
|
+
)
|
90
|
+
|
91
|
+
comments.count.should === 1
|
92
|
+
comments[0][:comment].include?('Spec comment 1').should === true
|
93
|
+
end
|
94
|
+
|
95
|
+
it("Remove the test data") do
|
96
|
+
@comment_2.destroy
|
97
|
+
@comment_1.destroy
|
98
|
+
@entry.destroy
|
99
|
+
@section.destroy
|
100
|
+
|
101
|
+
Comment[:comment => 'Spec comment'].should === nil
|
102
|
+
Comment[:comment => 'Spec comment 1'].should === nil
|
103
|
+
Section[:name => 'Spec'].should === nil
|
104
|
+
SectionEntry[:title => 'Spec'].should === nil
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
@@ -0,0 +1,183 @@
|
|
1
|
+
require File.expand_path('../../../../helper', __FILE__)
|
2
|
+
|
3
|
+
describe('CustomFields::BlueFormParameters') do
|
4
|
+
behaves_like :capybara
|
5
|
+
|
6
|
+
it('Generate the parameters for input_text()') do
|
7
|
+
stubbed = stub_custom_field('textbox')
|
8
|
+
params = CustomFields::BlueFormParameters.input_text(
|
9
|
+
stubbed[:custom_field],
|
10
|
+
stubbed[:custom_field_value]
|
11
|
+
)
|
12
|
+
|
13
|
+
params[0].should === :input_text
|
14
|
+
params[1].should === stubbed[:custom_field].name
|
15
|
+
params[2].should === "custom_field_value_#{stubbed[:custom_field].id}"
|
16
|
+
|
17
|
+
params[3][:value].should === stubbed[:custom_field_value].value
|
18
|
+
params[3][:maxlength].should === stubbed[:custom_field].text_limit
|
19
|
+
params[3][:'data-format'].should === nil
|
20
|
+
params[3][:placeholder].should === stubbed[:custom_field].description
|
21
|
+
params[3].key?(:class).should === false
|
22
|
+
end
|
23
|
+
|
24
|
+
it('Generate the parameters for input_password()') do
|
25
|
+
stubbed = stub_custom_field('password')
|
26
|
+
params = CustomFields::BlueFormParameters.input_password(
|
27
|
+
stubbed[:custom_field],
|
28
|
+
stubbed[:custom_field_value]
|
29
|
+
)
|
30
|
+
|
31
|
+
params[0].should === :input_password
|
32
|
+
params[1].should === stubbed[:custom_field].name
|
33
|
+
params[2].should === "custom_field_value_#{stubbed[:custom_field].id}"
|
34
|
+
|
35
|
+
params[3][:value].should === stubbed[:custom_field_value].value
|
36
|
+
params[3].key?(:'data-format').should === false
|
37
|
+
end
|
38
|
+
|
39
|
+
it('Generate the parameters for textarea()') do
|
40
|
+
stubbed = stub_custom_field(
|
41
|
+
'textarea',
|
42
|
+
:text_editor => true,
|
43
|
+
:textarea_rows => 10
|
44
|
+
)
|
45
|
+
|
46
|
+
params = CustomFields::BlueFormParameters.textarea(
|
47
|
+
stubbed[:custom_field],
|
48
|
+
stubbed[:custom_field_value]
|
49
|
+
)
|
50
|
+
|
51
|
+
params[0].should === :textarea
|
52
|
+
params[1].should === stubbed[:custom_field].name
|
53
|
+
params[2].should === "custom_field_value_#{stubbed[:custom_field].id}"
|
54
|
+
|
55
|
+
params[3][:class].should === 'text_editor'
|
56
|
+
params[3][:'data-format'].should === stubbed[:custom_field].format
|
57
|
+
params[3][:rows].should === stubbed[:custom_field].textarea_rows
|
58
|
+
|
59
|
+
# Try again but with the text editor disabled.
|
60
|
+
stubbed = stub_custom_field('textarea',)
|
61
|
+
params = CustomFields::BlueFormParameters.textarea(
|
62
|
+
stubbed[:custom_field],
|
63
|
+
stubbed[:custom_field_value]
|
64
|
+
)
|
65
|
+
|
66
|
+
params[3][:class].empty?.should === true
|
67
|
+
end
|
68
|
+
|
69
|
+
it('Generate the parameters for input_radio()') do
|
70
|
+
stubbed = stub_custom_field(
|
71
|
+
'radio',
|
72
|
+
:possible_values => "ruby|Ruby\npython|Python"
|
73
|
+
)
|
74
|
+
|
75
|
+
params = CustomFields::BlueFormParameters.input_radio(
|
76
|
+
stubbed[:custom_field],
|
77
|
+
stubbed[:custom_field_value]
|
78
|
+
)
|
79
|
+
|
80
|
+
params[0].should === :input_radio
|
81
|
+
params[1].should === stubbed[:custom_field].name
|
82
|
+
params[2].should === "custom_field_value_#{stubbed[:custom_field].id}"
|
83
|
+
params[3].should === stubbed[:custom_field_value].value
|
84
|
+
|
85
|
+
params[4][:values]['ruby'].should === 'Ruby'
|
86
|
+
params[4][:values]['python'].should === 'Python'
|
87
|
+
|
88
|
+
# Check if the correct parameters are generated with a different set of
|
89
|
+
# possible values.
|
90
|
+
stubbed = stub_custom_field(
|
91
|
+
'radio',
|
92
|
+
:possible_values => "ruby\npython"
|
93
|
+
)
|
94
|
+
|
95
|
+
params = CustomFields::BlueFormParameters.input_radio(
|
96
|
+
stubbed[:custom_field],
|
97
|
+
stubbed[:custom_field_value]
|
98
|
+
)
|
99
|
+
|
100
|
+
params[4][:values]['ruby'].should === 'ruby'
|
101
|
+
params[4][:values]['python'].should === 'python'
|
102
|
+
end
|
103
|
+
|
104
|
+
it('Generate the parameters for input_checkbox()') do
|
105
|
+
stubbed = stub_custom_field(
|
106
|
+
'checkbox',
|
107
|
+
:possible_values => "ruby|Ruby\npython|Python"
|
108
|
+
)
|
109
|
+
|
110
|
+
stubbed[:custom_field_value].value = ['Ruby', 'Python']
|
111
|
+
|
112
|
+
params = CustomFields::BlueFormParameters.input_radio(
|
113
|
+
stubbed[:custom_field],
|
114
|
+
stubbed[:custom_field_value]
|
115
|
+
)
|
116
|
+
|
117
|
+
params[0].should === :input_radio
|
118
|
+
params[1].should === stubbed[:custom_field].name
|
119
|
+
params[2].should === "custom_field_value_#{stubbed[:custom_field].id}"
|
120
|
+
|
121
|
+
params[3].class.should == Array
|
122
|
+
params[3].include?('Ruby').should === true
|
123
|
+
params[3].include?('Python').should === true
|
124
|
+
end
|
125
|
+
|
126
|
+
it('Generate the parameters for select()') do
|
127
|
+
stubbed = stub_custom_field(
|
128
|
+
'select',
|
129
|
+
:possible_values => "ruby|Ruby\npython|Python"
|
130
|
+
)
|
131
|
+
|
132
|
+
params = CustomFields::BlueFormParameters.select(
|
133
|
+
stubbed[:custom_field],
|
134
|
+
stubbed[:custom_field_value]
|
135
|
+
)
|
136
|
+
|
137
|
+
params[0].should === :select
|
138
|
+
params[1].should === stubbed[:custom_field].name
|
139
|
+
params[2].should === "custom_field_value_#{stubbed[:custom_field].id}"
|
140
|
+
|
141
|
+
params[3][:selected].should === stubbed[:custom_field_value].value
|
142
|
+
params[3][:size].should === 1
|
143
|
+
params[3][:values]['ruby'].should === 'Ruby'
|
144
|
+
params[3][:values]['python'].should === 'Python'
|
145
|
+
|
146
|
+
# Create the parameters using the same string as the keys and values.
|
147
|
+
stubbed = stub_custom_field(
|
148
|
+
'select',
|
149
|
+
:possible_values => "ruby\npython"
|
150
|
+
)
|
151
|
+
|
152
|
+
params = CustomFields::BlueFormParameters.select(
|
153
|
+
stubbed[:custom_field],
|
154
|
+
stubbed[:custom_field_value]
|
155
|
+
)
|
156
|
+
|
157
|
+
params[3][:values]['ruby'].should === 'ruby'
|
158
|
+
params[3][:values]['python'].should === 'python'
|
159
|
+
end
|
160
|
+
|
161
|
+
it('Generate the parameters for select_multiple()') do
|
162
|
+
stubbed = stub_custom_field(
|
163
|
+
'select_multiple',
|
164
|
+
:possible_values => "ruby|Ruby\npython|Python"
|
165
|
+
)
|
166
|
+
|
167
|
+
stubbed[:custom_field_value].value = ['Ruby', 'Python']
|
168
|
+
|
169
|
+
params = CustomFields::BlueFormParameters.select_multiple(
|
170
|
+
stubbed[:custom_field],
|
171
|
+
stubbed[:custom_field_value]
|
172
|
+
)
|
173
|
+
|
174
|
+
params[0].should === :select
|
175
|
+
params[1].should === stubbed[:custom_field].name
|
176
|
+
params[2].should === "custom_field_value_#{stubbed[:custom_field].id}"
|
177
|
+
|
178
|
+
params[3][:selected].should === ['Ruby', 'Python']
|
179
|
+
params[3][:values]['Ruby'].should === 'ruby'
|
180
|
+
params[3][:values]['Python'].should === 'python'
|
181
|
+
params[3][:multiple].should === :multiple
|
182
|
+
end
|
183
|
+
end # describe
|
@@ -0,0 +1,120 @@
|
|
1
|
+
require File.expand_path('../../../../../helper', __FILE__)
|
2
|
+
|
3
|
+
describe('CustomFields::Controller::CustomFieldGroups') do
|
4
|
+
behaves_like :capybara
|
5
|
+
|
6
|
+
it('Submit a form without a CSRF token') do
|
7
|
+
response = page.driver.post(
|
8
|
+
CustomFields::Controller::CustomFieldGroups.r(:save).to_s
|
9
|
+
)
|
10
|
+
|
11
|
+
response.body.include?(lang('zen_general.errors.csrf')).should === true
|
12
|
+
response.status.should === 403
|
13
|
+
end
|
14
|
+
|
15
|
+
it("No custom field groups should exist") do
|
16
|
+
index_url = CustomFields::Controller::CustomFieldGroups.r(:index).to_s
|
17
|
+
message = lang('custom_field_groups.messages.no_groups')
|
18
|
+
|
19
|
+
visit(index_url)
|
20
|
+
|
21
|
+
current_path.should === index_url
|
22
|
+
|
23
|
+
# If the page shows the message telling the user that there are no groups.
|
24
|
+
page.has_selector?('table tbody tr').should === false
|
25
|
+
page.has_content?(message).should === true
|
26
|
+
end
|
27
|
+
|
28
|
+
it("Create a new group") do
|
29
|
+
index_url = CustomFields::Controller::CustomFieldGroups.r(:index).to_s
|
30
|
+
new_url = CustomFields::Controller::CustomFieldGroups.r(:new).to_s
|
31
|
+
edit_url = CustomFields::Controller::CustomFieldGroups.r(:edit).to_s
|
32
|
+
add_button = lang('custom_field_groups.buttons.new')
|
33
|
+
save_button = lang('custom_field_groups.buttons.save')
|
34
|
+
|
35
|
+
visit(index_url)
|
36
|
+
click_link(add_button)
|
37
|
+
|
38
|
+
current_path.should == new_url
|
39
|
+
|
40
|
+
within('#custom_field_group_form') do
|
41
|
+
fill_in('name' , :with => 'Spec field group')
|
42
|
+
fill_in('description', :with => 'Spec field group desc')
|
43
|
+
click_on(save_button)
|
44
|
+
end
|
45
|
+
|
46
|
+
current_path.should =~ /#{edit_url}\/[0-9]+/
|
47
|
+
|
48
|
+
page.find('input[name="name"]') \
|
49
|
+
.value.should === 'Spec field group'
|
50
|
+
|
51
|
+
page.find('textarea[name="description"]') \
|
52
|
+
.value.should === 'Spec field group desc'
|
53
|
+
end
|
54
|
+
|
55
|
+
it("Edit an existing group") do
|
56
|
+
index_url = CustomFields::Controller::CustomFieldGroups.r(:index).to_s
|
57
|
+
edit_url = CustomFields::Controller::CustomFieldGroups.r(:edit).to_s
|
58
|
+
save_button = lang('custom_field_groups.buttons.save')
|
59
|
+
|
60
|
+
visit(index_url)
|
61
|
+
click_link('Spec field group')
|
62
|
+
|
63
|
+
current_path.should =~ /#{edit_url}\/[0-9]+/
|
64
|
+
|
65
|
+
# Update the details
|
66
|
+
within('#custom_field_group_form') do
|
67
|
+
fill_in('name', :with => 'Spec field group modified')
|
68
|
+
click_on(save_button)
|
69
|
+
end
|
70
|
+
|
71
|
+
page.find('input[name="name"]') \
|
72
|
+
.value.should === 'Spec field group modified'
|
73
|
+
end
|
74
|
+
|
75
|
+
it("Edit an existing group with invalid data") do
|
76
|
+
index_url = CustomFields::Controller::CustomFieldGroups.r(:index).to_s
|
77
|
+
edit_url = CustomFields::Controller::CustomFieldGroups.r(:edit).to_s
|
78
|
+
save_button = lang('custom_field_groups.buttons.save')
|
79
|
+
|
80
|
+
visit(index_url)
|
81
|
+
click_link('Spec field group')
|
82
|
+
|
83
|
+
current_path.should =~ /#{edit_url}\/[0-9]+/
|
84
|
+
|
85
|
+
# Update the details
|
86
|
+
within('#custom_field_group_form') do
|
87
|
+
fill_in('name', :with => '')
|
88
|
+
click_on(save_button)
|
89
|
+
end
|
90
|
+
|
91
|
+
page.has_selector?('span.error').should === true
|
92
|
+
end
|
93
|
+
|
94
|
+
it("Try to delete a group without an ID specified") do
|
95
|
+
index_url = CustomFields::Controller::CustomFieldGroups.r(:index).to_s
|
96
|
+
delete_button = lang('custom_field_groups.buttons.delete')
|
97
|
+
message = lang('custom_field_groups.messages.no_groups')
|
98
|
+
|
99
|
+
visit(index_url)
|
100
|
+
|
101
|
+
click_on(delete_button)
|
102
|
+
|
103
|
+
page.has_selector?('input[name="custom_field_group_ids[]"]') \
|
104
|
+
.should === true
|
105
|
+
end
|
106
|
+
|
107
|
+
it("Delete an existing group") do
|
108
|
+
index_url = CustomFields::Controller::CustomFieldGroups.r(:index).to_s
|
109
|
+
delete_button = lang('custom_field_groups.buttons.delete')
|
110
|
+
message = lang('custom_field_groups.messages.no_groups')
|
111
|
+
|
112
|
+
visit(index_url)
|
113
|
+
|
114
|
+
check('custom_field_group_ids[]')
|
115
|
+
click_on(delete_button)
|
116
|
+
|
117
|
+
page.has_selector?('table tbody tr').should === false
|
118
|
+
page.has_content?(message).should === true
|
119
|
+
end
|
120
|
+
end # describe
|