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,33 @@
|
|
1
|
+
require File.expand_path('../../../../../helper', __FILE__)
|
2
|
+
require File.join(Zen::Fixtures, 'package/settings/plugin/settings')
|
3
|
+
|
4
|
+
describe("Settings::Plugin::Settings") do
|
5
|
+
extend ::Settings::Model
|
6
|
+
|
7
|
+
it("Retrieve a setting") do
|
8
|
+
setting = plugin(:settings, :get, 'spec')
|
9
|
+
|
10
|
+
setting.title.should === 'Spec'
|
11
|
+
setting.group.should === 'general_spec'
|
12
|
+
setting.values.should === [1,2,3]
|
13
|
+
setting.description.should === 'An example of a setting with a select box.'
|
14
|
+
end
|
15
|
+
|
16
|
+
it("Migrate all settings") do
|
17
|
+
plugin(:settings, :migrate)
|
18
|
+
|
19
|
+
setting = Setting[:name => 'spec']
|
20
|
+
setting1 = Setting[:name => 'spec_textbox']
|
21
|
+
|
22
|
+
setting.type.should === 'select'
|
23
|
+
setting1.type.should === 'textbox'
|
24
|
+
end
|
25
|
+
|
26
|
+
it("Remove all settings") do
|
27
|
+
plugin(:settings, :remove, ['spec', 'spec_textbox'])
|
28
|
+
|
29
|
+
Setting[:name => 'spec'].should === nil
|
30
|
+
Setting[:name => 'spec_textbox'].should === nil
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require File.expand_path('../../../../../helper', __FILE__)
|
2
|
+
|
3
|
+
describe("Users::Controller::AccessRules") do
|
4
|
+
behaves_like :capybara
|
5
|
+
|
6
|
+
it('Submit a form without a CSRF token') do
|
7
|
+
response = page.driver.post(
|
8
|
+
Users::Controller::AccessRules.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 access rules should exist") do
|
16
|
+
index_url = Users::Controller::AccessRules.r(:index).to_s
|
17
|
+
message = lang('access_rules.messages.no_rules')
|
18
|
+
|
19
|
+
visit(index_url)
|
20
|
+
|
21
|
+
page.has_content?(message).should === true
|
22
|
+
page.has_selector?('table tbody tr').should === false
|
23
|
+
end
|
24
|
+
|
25
|
+
it("Create a new access rule") do
|
26
|
+
index_url = Users::Controller::AccessRules.r(:index).to_s
|
27
|
+
new_button = lang('access_rules.buttons.new')
|
28
|
+
save_button = lang('access_rules.buttons.save')
|
29
|
+
|
30
|
+
visit(index_url)
|
31
|
+
click_link(new_button)
|
32
|
+
|
33
|
+
within('#access_rule_form') do
|
34
|
+
choose('form_rule_applies_0')
|
35
|
+
select('Spec' , :from => 'user_id')
|
36
|
+
select('sections', :from => 'package')
|
37
|
+
choose('form_create_access_1')
|
38
|
+
choose('form_read_access_0')
|
39
|
+
choose('form_update_access_1')
|
40
|
+
choose('form_delete_access_1')
|
41
|
+
click_on(save_button)
|
42
|
+
end
|
43
|
+
|
44
|
+
page.find('#form_rule_applies_0').checked?.should === 'checked'
|
45
|
+
page.find('select[name="package"]').value.should === 'sections'
|
46
|
+
end
|
47
|
+
|
48
|
+
it("Edit an existing access rule") do
|
49
|
+
index_url = Users::Controller::AccessRules.r(:index).to_s
|
50
|
+
edit_url = Users::Controller::AccessRules.r(:edit).to_s
|
51
|
+
save_button = lang('access_rules.buttons.save')
|
52
|
+
|
53
|
+
visit(index_url)
|
54
|
+
click_link(lang('access_rules.labels.all_controllers'))
|
55
|
+
|
56
|
+
current_path.should =~ /#{edit_url}\/[0-9]+/
|
57
|
+
|
58
|
+
within('#access_rule_form') do
|
59
|
+
choose('form_rule_applies_1')
|
60
|
+
click_on(save_button)
|
61
|
+
end
|
62
|
+
|
63
|
+
page.find('#form_rule_applies_1').checked?.should === 'checked'
|
64
|
+
end
|
65
|
+
|
66
|
+
it('Delete an access rule without specifying an ID') do
|
67
|
+
index_url = Users::Controller::AccessRules.r(:index).to_s
|
68
|
+
delete_button = lang('access_rules.buttons.delete')
|
69
|
+
message = lang('access_rules.messages.no_rules')
|
70
|
+
|
71
|
+
visit(index_url)
|
72
|
+
click_on(delete_button)
|
73
|
+
|
74
|
+
page.has_selector?('input[name="access_rule_ids[]"]').should === true
|
75
|
+
end
|
76
|
+
|
77
|
+
it("Delete an existing access rule") do
|
78
|
+
index_url = Users::Controller::AccessRules.r(:index).to_s
|
79
|
+
delete_button = lang('access_rules.buttons.delete')
|
80
|
+
message = lang('access_rules.messages.no_rules')
|
81
|
+
|
82
|
+
visit(index_url)
|
83
|
+
check('access_rule_ids[]')
|
84
|
+
click_on(delete_button)
|
85
|
+
|
86
|
+
page.has_content?(message).should === true
|
87
|
+
page.has_selector?('table tbody tr').should === false
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require File.expand_path('../../../../../helper', __FILE__)
|
2
|
+
|
3
|
+
Zen::Language.load('user_groups')
|
4
|
+
|
5
|
+
describe("Users::Controller::UserGroups") do
|
6
|
+
behaves_like :capybara
|
7
|
+
|
8
|
+
it('Submit a form without a CSRF token') do
|
9
|
+
response = page.driver.post(
|
10
|
+
Users::Controller::UserGroups.r(:save).to_s
|
11
|
+
)
|
12
|
+
|
13
|
+
response.body.include?(lang('zen_general.errors.csrf')).should === true
|
14
|
+
response.status.should === 403
|
15
|
+
end
|
16
|
+
|
17
|
+
it("A single user group should exist") do
|
18
|
+
index_url = Users::Controller::UserGroups.r(:index).to_s
|
19
|
+
message = lang('user_groups.messages.no_groups')
|
20
|
+
|
21
|
+
visit(index_url)
|
22
|
+
|
23
|
+
page.has_content?(message).should === false
|
24
|
+
page.has_selector?('table tbody tr').should === true
|
25
|
+
page.all('table tbody tr').count.should === 1
|
26
|
+
end
|
27
|
+
|
28
|
+
it("Create a new user group") do
|
29
|
+
index_url = Users::Controller::UserGroups.r(:index).to_s
|
30
|
+
save_button = lang('user_groups.buttons.save')
|
31
|
+
new_button = lang('user_groups.buttons.new')
|
32
|
+
|
33
|
+
visit(index_url)
|
34
|
+
click_link(new_button)
|
35
|
+
|
36
|
+
within('#user_group_form') do
|
37
|
+
fill_in('name', :with => 'Spec group')
|
38
|
+
choose('form_super_group_0')
|
39
|
+
click_on(save_button)
|
40
|
+
end
|
41
|
+
|
42
|
+
page.find('input[name="name"]').value.should === 'Spec group'
|
43
|
+
page.find('#form_super_group_0').checked?.should === 'checked'
|
44
|
+
end
|
45
|
+
|
46
|
+
it("Edit an existing user group") do
|
47
|
+
index_url = Users::Controller::UserGroups.r(:index).to_s
|
48
|
+
save_button = lang('user_groups.buttons.save')
|
49
|
+
|
50
|
+
visit(index_url)
|
51
|
+
click_link('Spec group')
|
52
|
+
|
53
|
+
within('#user_group_form') do
|
54
|
+
fill_in('name', :with => 'Spec group modified')
|
55
|
+
click_on(save_button)
|
56
|
+
end
|
57
|
+
|
58
|
+
page.find('input[name="name"]').value.should === 'Spec group modified'
|
59
|
+
end
|
60
|
+
|
61
|
+
it("Edit an existing user group with invalid data") do
|
62
|
+
index_url = Users::Controller::UserGroups.r(:index).to_s
|
63
|
+
save_button = lang('user_groups.buttons.save')
|
64
|
+
|
65
|
+
visit(index_url)
|
66
|
+
click_link('Spec group')
|
67
|
+
|
68
|
+
within('#user_group_form') do
|
69
|
+
fill_in('name', :with => '')
|
70
|
+
click_on(save_button)
|
71
|
+
end
|
72
|
+
|
73
|
+
page.has_selector?('label[for="form_name"] span.error').should === true
|
74
|
+
end
|
75
|
+
|
76
|
+
it("Delete an existing user group") do
|
77
|
+
index_url = Users::Controller::UserGroups.r(:index).to_s
|
78
|
+
delete_button = lang('user_groups.buttons.delete')
|
79
|
+
|
80
|
+
visit(index_url)
|
81
|
+
click_on(delete_button)
|
82
|
+
|
83
|
+
page.has_selector?('input[name="user_group_ids[]"]').should === true
|
84
|
+
page.all('table tbody tr').count.should === 2
|
85
|
+
end
|
86
|
+
|
87
|
+
it("Delete an existing user group") do
|
88
|
+
index_url = Users::Controller::UserGroups.r(:index).to_s
|
89
|
+
delete_button = lang('user_groups.buttons.delete')
|
90
|
+
|
91
|
+
visit(index_url)
|
92
|
+
|
93
|
+
within('table tbody tr:last-child') do
|
94
|
+
check('user_group_ids[]')
|
95
|
+
end
|
96
|
+
|
97
|
+
click_on(delete_button)
|
98
|
+
|
99
|
+
page.all('table tbody tr').count.should === 1
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
require File.expand_path('../../../../../helper', __FILE__)
|
2
|
+
|
3
|
+
Zen::Language.load('users')
|
4
|
+
|
5
|
+
describe("Users::Controller::Users") do
|
6
|
+
behaves_like :capybara
|
7
|
+
|
8
|
+
it('Submit a form without a CSRF token') do
|
9
|
+
response = page.driver.post(
|
10
|
+
Users::Controller::Users.r(:save).to_s
|
11
|
+
)
|
12
|
+
|
13
|
+
response.body.include?(lang('zen_general.errors.csrf')).should === true
|
14
|
+
response.status.should === 403
|
15
|
+
end
|
16
|
+
|
17
|
+
it('Show the login form') do
|
18
|
+
login_url = Users::Controller::Users.r(:login).to_s
|
19
|
+
|
20
|
+
visit(login_url)
|
21
|
+
|
22
|
+
page.has_selector?('#login_form').should === true
|
23
|
+
page.has_selector?('input[type="submit"][value="Login"]').should === true
|
24
|
+
page.has_content?('Email').should === true
|
25
|
+
page.has_content?('Password').should === true
|
26
|
+
end
|
27
|
+
|
28
|
+
it('Log in') do
|
29
|
+
login_url = Users::Controller::Users.r(:login).to_s
|
30
|
+
dashboard_url = Sections::Controller::Sections.r(:index).to_s
|
31
|
+
|
32
|
+
visit(login_url)
|
33
|
+
|
34
|
+
within('#login_form') do
|
35
|
+
fill_in 'Email' , :with => 'spec@domain.tld'
|
36
|
+
fill_in 'Password', :with => 'spec'
|
37
|
+
click_button 'Login'
|
38
|
+
end
|
39
|
+
|
40
|
+
current_path.should == dashboard_url
|
41
|
+
end
|
42
|
+
|
43
|
+
it("A user should exist") do
|
44
|
+
index_url = Users::Controller::Users.r(:index).to_s
|
45
|
+
message = lang('users.messages.no_users')
|
46
|
+
|
47
|
+
visit(index_url)
|
48
|
+
|
49
|
+
page.has_selector?('table tbody tr').should === true
|
50
|
+
page.has_content?(message).should === false
|
51
|
+
end
|
52
|
+
|
53
|
+
it("Create a new user") do
|
54
|
+
index_url = Users::Controller::Users.r(:index).to_s
|
55
|
+
save_button = lang('users.buttons.save')
|
56
|
+
new_button = lang('users.buttons.new')
|
57
|
+
status = lang('users.special.status_hash.open')
|
58
|
+
|
59
|
+
visit(index_url)
|
60
|
+
click_link(new_button)
|
61
|
+
|
62
|
+
within('#user_form') do
|
63
|
+
fill_in('name' , :with => 'Spec user')
|
64
|
+
fill_in('email' , :with => 'spec@email.com')
|
65
|
+
fill_in('website', :with => 'spec.com')
|
66
|
+
fill_in('new_password' , :with => 'spec')
|
67
|
+
fill_in('confirm_password', :with => 'spec')
|
68
|
+
select(status, :from => 'status')
|
69
|
+
click_on(save_button)
|
70
|
+
end
|
71
|
+
|
72
|
+
page.find('input[name="name"]').value.should === 'Spec user'
|
73
|
+
page.find('input[name="email"]').value.should === 'spec@email.com'
|
74
|
+
end
|
75
|
+
|
76
|
+
it("Edit an existing user") do
|
77
|
+
index_url = Users::Controller::Users.r(:index).to_s
|
78
|
+
save_button = lang('users.buttons.save')
|
79
|
+
|
80
|
+
visit(index_url)
|
81
|
+
click_link('spec@email.com')
|
82
|
+
|
83
|
+
within('#user_form') do
|
84
|
+
fill_in('name', :with => 'Spec user modified')
|
85
|
+
click_on(save_button)
|
86
|
+
end
|
87
|
+
|
88
|
+
page.find('input[name="name"]').value.should === 'Spec user modified'
|
89
|
+
end
|
90
|
+
|
91
|
+
it("Edit an existing user with invalid data") do
|
92
|
+
index_url = Users::Controller::Users.r(:index).to_s
|
93
|
+
save_button = lang('users.buttons.save')
|
94
|
+
|
95
|
+
visit(index_url)
|
96
|
+
click_link('spec@email.com')
|
97
|
+
|
98
|
+
within('#user_form') do
|
99
|
+
fill_in('name', :with => '')
|
100
|
+
click_on(save_button)
|
101
|
+
end
|
102
|
+
|
103
|
+
page.has_selector?('label[for="form_name"] span.error').should === true
|
104
|
+
end
|
105
|
+
|
106
|
+
it("Delete an existing user without specifying an ID") do
|
107
|
+
index_url = Users::Controller::Users.r(:index).to_s
|
108
|
+
delete_button = lang('users.buttons.delete')
|
109
|
+
|
110
|
+
visit(index_url)
|
111
|
+
click_on(delete_button)
|
112
|
+
|
113
|
+
page.has_selector?('input[name="user_ids[]"]').should === true
|
114
|
+
end
|
115
|
+
|
116
|
+
it("Delete an existing user") do
|
117
|
+
index_url = Users::Controller::Users.r(:index).to_s
|
118
|
+
delete_button = lang('users.buttons.delete')
|
119
|
+
|
120
|
+
visit(index_url)
|
121
|
+
|
122
|
+
within('table tbody tr:last-child') do
|
123
|
+
check('user_ids[]')
|
124
|
+
end
|
125
|
+
|
126
|
+
click_on(delete_button)
|
127
|
+
|
128
|
+
page.has_content?('spec@email.com').should === false
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require File.expand_path('../../../../../helper', __FILE__)
|
2
|
+
|
3
|
+
describe('Ramaze::Helper::Users') do
|
4
|
+
behaves_like :capybara
|
5
|
+
|
6
|
+
it('Create the test data') do
|
7
|
+
@user = Users::Model::User.create(
|
8
|
+
:email => 'spec@spec.com',
|
9
|
+
:name => 'Spec user',
|
10
|
+
:password => 'password'
|
11
|
+
)
|
12
|
+
|
13
|
+
@group = Users::Model::UserGroup.create(
|
14
|
+
:name => 'Spec user group',
|
15
|
+
:super_group => true
|
16
|
+
)
|
17
|
+
|
18
|
+
@rule = Users::Model::AccessRule.create(
|
19
|
+
:package => 'sections',
|
20
|
+
:controller => '*',
|
21
|
+
:create_access => true,
|
22
|
+
:read_access => true,
|
23
|
+
:delete_access => true,
|
24
|
+
:update_access => true,
|
25
|
+
:user_id => @user.id
|
26
|
+
)
|
27
|
+
|
28
|
+
@user.email.should === 'spec@spec.com'
|
29
|
+
@group.name.should === 'Spec user group'
|
30
|
+
@rule.package.should === 'sections'
|
31
|
+
@rule.user_id.should === @user.id
|
32
|
+
end
|
33
|
+
|
34
|
+
it('Validate a valid user') do
|
35
|
+
url = Users::Controller::Users.r(:edit, @user.id).to_s
|
36
|
+
|
37
|
+
visit(url)
|
38
|
+
|
39
|
+
current_path.should === url
|
40
|
+
end
|
41
|
+
|
42
|
+
it('Validate an invalid user') do
|
43
|
+
url = Users::Controller::Users.r(:edit, @user.id + 1).to_s
|
44
|
+
index = Users::Controller::Users.r(:index).to_s
|
45
|
+
|
46
|
+
visit(url)
|
47
|
+
|
48
|
+
current_path.should === index
|
49
|
+
end
|
50
|
+
|
51
|
+
it('Validate a valid user group') do
|
52
|
+
url = Users::Controller::UserGroups.r(:edit, @group.id).to_s
|
53
|
+
|
54
|
+
visit(url)
|
55
|
+
|
56
|
+
current_path.should === url
|
57
|
+
end
|
58
|
+
|
59
|
+
it('Validate an invalid user group') do
|
60
|
+
url = Users::Controller::UserGroups.r(:edit, @group.id + 1).to_s
|
61
|
+
index = Users::Controller::UserGroups.r(:index).to_s
|
62
|
+
|
63
|
+
visit(url)
|
64
|
+
|
65
|
+
current_path.should === index
|
66
|
+
end
|
67
|
+
|
68
|
+
it('Validate a valid access rule') do
|
69
|
+
url = Users::Controller::AccessRules.r(:edit, @rule.id).to_s
|
70
|
+
|
71
|
+
visit(url)
|
72
|
+
|
73
|
+
current_path.should === url
|
74
|
+
end
|
75
|
+
|
76
|
+
it('Validate an invalid access rule') do
|
77
|
+
url = Users::Controller::AccessRules.r(:edit, @rule.id + 1).to_s
|
78
|
+
index = Users::Controller::AccessRules.r(:index).to_s
|
79
|
+
|
80
|
+
visit(url)
|
81
|
+
|
82
|
+
current_path.should === index
|
83
|
+
end
|
84
|
+
|
85
|
+
it('Delete the test data') do
|
86
|
+
id = @user.id
|
87
|
+
|
88
|
+
@rule.destroy
|
89
|
+
@group.destroy
|
90
|
+
@user.destroy
|
91
|
+
|
92
|
+
Users::Model::User[:name => 'Spec user'].should === nil
|
93
|
+
Users::Model::UserGroup[:name => 'Spec user group'].should === nil
|
94
|
+
Users::Model::AccessRule[:user_id => id].should === nil
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|