zena 1.0.0.rc2 → 1.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +23 -0
- data/README.rdoc +1 -1
- data/app/controllers/columns_controller.rb +3 -31
- data/app/controllers/comments_controller.rb +8 -3
- data/app/controllers/data_entries_controller.rb +1 -1
- data/app/controllers/documents_controller.rb +2 -2
- data/app/controllers/nodes_controller.rb +29 -12
- data/app/controllers/relations_controller.rb +2 -2
- data/app/controllers/sites_controller.rb +1 -1
- data/app/controllers/user_sessions_controller.rb +6 -3
- data/app/controllers/users_controller.rb +18 -16
- data/app/controllers/versions_controller.rb +20 -18
- data/app/controllers/virtual_classes_controller.rb +103 -17
- data/app/helpers/users_helper.rb +1 -1
- data/app/models/column.rb +19 -50
- data/app/models/comment.rb +2 -1
- data/app/models/node.rb +45 -22
- data/app/models/relation.rb +13 -0
- data/app/models/relation_proxy.rb +3 -2
- data/app/models/role.rb +213 -4
- data/app/models/site.rb +18 -11
- data/app/models/template.rb +37 -35
- data/app/models/version.rb +1 -1
- data/app/models/virtual_class.rb +154 -86
- data/app/views/columns/_li.html.erb +1 -1
- data/app/views/columns/index.html.erb +1 -9
- data/app/views/comments/index.rhtml +10 -8
- data/app/views/documents/_crop.rhtml +5 -6
- data/app/views/documents/crop_form.rjs +3 -2
- data/app/views/groups/index.rhtml +1 -1
- data/app/views/iformats/index.rhtml +1 -1
- data/app/views/nodes/_import_results.rhtml +1 -1
- data/app/views/nodes/_parent.rhtml +1 -2
- data/app/views/nodes/update.rjs +3 -4
- data/app/views/relations/index.erb +1 -1
- data/app/views/sites/index.erb +1 -1
- data/app/views/templates/drive_tabs/_drive.rhtml +0 -2
- data/app/views/templates/edit_tabs/_image.rhtml +1 -1
- data/app/views/templates/edit_tabs/_title.rhtml +0 -6
- data/app/views/users/index.rhtml +1 -1
- data/app/views/users/preferences.html.erb +2 -2
- data/app/views/versions/backup.rjs +1 -1
- data/app/views/versions/custom_tab.rhtml +9 -4
- data/app/views/versions/destroy.rjs +2 -2
- data/app/views/versions/update.rjs +2 -9
- data/app/views/virtual_classes/_form.erb +3 -2
- data/app/views/virtual_classes/import_prepare.html.erb +13 -0
- data/app/views/virtual_classes/index.erb +28 -8
- data/app/views/zafu/default/Node-+adminLayout.zafu +1 -13
- data/app/views/zafu/default/Node-+login.zafu +1 -0
- data/app/views/zafu/default/Node-+notFound.zafu +1 -1
- data/app/views/zafu/default/Node-+popupLayout.zafu +1 -2
- data/app/views/zafu/default/Node-+search.zafu +1 -1
- data/app/views/zafu/default/Node-admin.zafu +205 -0
- data/app/views/zafu/default/Node.zafu +11 -11
- data/bricks/captcha/lib/bricks/captcha.rb +3 -2
- data/bricks/mongrel/zena/init.rb +2 -1
- data/bricks/pdf/README +5 -5
- data/bricks/pdf/lib/bricks/pdf/engine/prince.rb +2 -2
- data/bricks/pdf/lib/bricks/pdf/engine/xhtml2pdf.rb +2 -2
- data/bricks/pdf/lib/bricks/pdf/install.rb +5 -5
- data/bricks/pdf/lib/bricks/pdf.rb +11 -11
- data/bricks/pdf/test/engines/test_prince.rb +4 -4
- data/bricks/pdf/test/engines/test_xhtml2pdf.rb +4 -4
- data/bricks/pdf/test/shoulda_macros/shoulda_pdf.rb +2 -2
- data/bricks/pdf/zena/init.rb +2 -2
- data/bricks/pdf/zena/tasks.rb +2 -2
- data/bricks/sphinx/lib/bricks/sphinx.rb +6 -2
- data/bricks/sphinx/zena/{sphinx.yml → sphinx.yml.erb} +2 -2
- data/bricks/sphinx/zena/tasks.rb +28 -2
- data/bricks/tags/lib/bricks/tags.rb +16 -1
- data/bricks/tags/zena/test/unit/tags_test.rb +15 -0
- data/bricks/tags/zena/test/zafu/tags.yml +5 -1
- data/bricks/worker/lib/bricks/worker.rb +39 -0
- data/bricks/worker/zena/deploy.rb +0 -2
- data/bricks/worker/zena/init.rb +1 -0
- data/bricks/worker/zena/test/sites/zena/delayed_jobs.yml +16 -0
- data/bricks/worker/zena/test/zafu/worker.yml +8 -0
- data/bricks/zena/zena/migrate/01_base.rb +36 -60
- data/bricks/zena/zena/migrate/02_zerox1_schema.rb +388 -0
- data/bricks/zena/zena/migrate/03_zerox1_data.rb +380 -0
- data/bricks/zena/zena/migrate/20110315161158_add_reverse_scope_to_roles.rb +9 -0
- data/config/database_example.yml +1 -1
- data/config/environment.rb +1 -1
- data/config/gems.yml +17 -14
- data/db/init/base/skins/default/Node-+index.zafu +8 -1
- data/db/init/base/skins/default/Node-+login.zafu +1 -0
- data/db/init/base/skins/default/Node-+popupLayout.zafu +1 -2
- data/db/init/base/skins/default/Node-+search.zafu +2 -2
- data/db/init/base/skins/default/Node.zafu +9 -9
- data/db/init/base/skins/default/{favicon.png → img/favicon.png} +0 -0
- data/db/init/base/skins/default/{style.css → img/style.css} +0 -0
- data/db/init/base/skins/default/img/translations.yml +11 -0
- data/db/init/base/skins/default/notes.zafu +7 -9
- data/doc/zafu_changes.yml +12 -0
- data/lib/bricks/loader.rb +38 -15
- data/lib/tasks/zena.rake +74 -24
- data/lib/zena/acts/enrollable.rb +4 -1
- data/lib/zena/acts/secure.rb +2 -48
- data/lib/zena/acts/serializable.rb +13 -1
- data/lib/zena/app.rb +9 -0
- data/lib/zena/code_syntax.rb +154 -151
- data/lib/zena/console.rb +141 -0
- data/lib/zena/controller/test_case.rb +1 -1
- data/lib/zena/db_helper/abstract_db.rb +17 -5
- data/lib/zena/db_helper/mysql.rb +14 -12
- data/lib/zena/db_helper/postgresql.rb +1 -2
- data/lib/zena/db_helper/sqlite3.rb +6 -6
- data/lib/zena/deploy/awstats.conf.rhtml +1 -1
- data/lib/zena/deploy/httpd.rhtml +6 -1
- data/lib/zena/deploy/vhost.rhtml +9 -1
- data/lib/zena/deploy.rb +12 -7
- data/lib/zena/foxy_parser.rb +3 -1
- data/lib/zena/info.rb +1 -1
- data/lib/zena/parser/zafu_tags.rb +1 -0
- data/lib/zena/parser/zazen_rules.rb +1 -1
- data/lib/zena/remote/node.rb +15 -3
- data/lib/zena/remote/serializable_array.rb +19 -0
- data/lib/zena/remote.rb +1 -0
- data/lib/zena/routes.rb +7 -2
- data/lib/zena/site_worker.rb +11 -1
- data/lib/zena/unit/test_case.rb +68 -0
- data/lib/zena/use/action.rb +6 -2
- data/lib/zena/use/ajax.rb +127 -53
- data/lib/zena/use/ancestry.rb +11 -8
- data/lib/zena/use/calendar.rb +265 -129
- data/lib/zena/use/conditional.rb +1 -1
- data/lib/zena/use/context.rb +5 -5
- data/lib/zena/use/dates.rb +172 -60
- data/lib/zena/use/display.rb +70 -39
- data/lib/zena/use/error_rendering.rb +1 -3
- data/lib/zena/use/field_index.rb +4 -1
- data/lib/zena/use/forms.rb +94 -72
- data/lib/zena/use/fulltext.rb +16 -24
- data/lib/zena/use/html_tags.rb +20 -12
- data/lib/zena/use/i18n.rb +37 -37
- data/lib/zena/use/image_builder.rb +8 -1
- data/lib/zena/use/ml_index.rb +16 -16
- data/lib/zena/use/prop_eval.rb +10 -5
- data/lib/zena/use/query_builder.rb +55 -23
- data/lib/zena/use/query_node.rb +51 -25
- data/lib/zena/use/refactor.rb +2 -28
- data/lib/zena/use/relations.rb +1 -1
- data/lib/zena/use/rendering.rb +29 -0
- data/lib/zena/use/scope_index.rb +75 -14
- data/lib/zena/use/search.rb +5 -10
- data/lib/zena/use/test_helper.rb +2 -2
- data/lib/zena/use/urls.rb +125 -104
- data/lib/zena/use/workflow.rb +2 -1
- data/lib/zena/use/zafu_attributes.rb +2 -2
- data/lib/zena/use/zafu_safe_definitions.rb +20 -0
- data/lib/zena/use/zafu_templates.rb +20 -6
- data/lib/zena/use/zazen.rb +31 -20
- data/lib/zena/view/test_case.rb +5 -0
- data/lib/zena/zafu_compiler.rb +24 -2
- data/lib/zena.rb +12 -6
- data/locale/de/LC_MESSAGES/zena.mo +0 -0
- data/locale/de/zena.po +1345 -1164
- data/locale/en/LC_MESSAGES/zena.mo +0 -0
- data/locale/en/zena.po +1275 -1129
- data/locale/fr/LC_MESSAGES/zena.mo +0 -0
- data/locale/fr/zena.mo +0 -0
- data/locale/fr/zena.po +1617 -1441
- data/locale/log.txt +9 -0
- data/locale/zena.pot +957 -748
- data/public/javascripts/prototype.js +1 -1
- data/public/javascripts/zena.js +99 -44
- data/public/stylesheets/admin.css +6 -4
- data/public/stylesheets/backend.css +71 -0
- data/public/stylesheets/calendar.css +24 -25
- data/public/stylesheets/code.css +11 -6
- data/public/stylesheets/comment.css +2 -1
- data/public/stylesheets/popup.css +7 -8
- data/test/custom_queries/complex.host.yml +15 -1
- data/test/fixtures/files/Node-test.zafu +29 -28
- data/test/fixtures/files/translations_de.yml +12 -1
- data/test/fixtures/files/translations_fr.yml +12 -1
- data/test/functional/comments_controller_test.rb +9 -0
- data/test/functional/iformats_controller_test.rb +1 -1
- data/test/functional/nodes_controller_test.rb +124 -35
- data/test/functional/users_controller_test.rb +132 -3
- data/test/functional/virtual_classes_controller_test.rb +75 -4
- data/test/integration/navigation_test.rb +51 -9
- data/test/integration/query_node/basic.yml +19 -7
- data/test/integration/query_node/complex.yml +1 -1
- data/test/integration/query_node/dates.yml +27 -1
- data/test/integration/query_node/filters.yml +1 -1
- data/test/integration/query_node/relations.yml +13 -4
- data/test/integration/query_node_test.rb +4 -0
- data/test/integration/xml_api_test.rb +6 -1
- data/test/integration/zafu_compiler/action.yml +3 -3
- data/test/integration/zafu_compiler/ajax.yml +103 -22
- data/test/integration/zafu_compiler/basic.yml +0 -52
- data/test/integration/zafu_compiler/calendar.yml +44 -20
- data/test/integration/zafu_compiler/comments.yml +53 -0
- data/test/integration/zafu_compiler/complex.yml +11 -11
- data/test/integration/zafu_compiler/complex_ok.yml +16 -3
- data/test/integration/zafu_compiler/conditional.yml +15 -5
- data/test/integration/zafu_compiler/context.yml +9 -0
- data/test/integration/zafu_compiler/dates.yml +43 -15
- data/test/integration/zafu_compiler/display.yml +60 -6
- data/test/integration/zafu_compiler/errors.yml +6 -2
- data/test/integration/zafu_compiler/forms.yml +45 -6
- data/test/integration/zafu_compiler/i18n.yml +8 -1
- data/test/integration/zafu_compiler/meta.yml +38 -0
- data/test/integration/zafu_compiler/query.yml +43 -4
- data/test/integration/zafu_compiler/relations.yml +26 -33
- data/test/integration/zafu_compiler/rubyless.yml +10 -0
- data/test/integration/zafu_compiler/safe_definitions.yml +21 -1
- data/test/integration/zafu_compiler/urls.yml +75 -5
- data/test/integration/zafu_compiler/version.yml +2 -2
- data/test/integration/zafu_compiler/zafu_attributes.yml +5 -1
- data/test/integration/zafu_compiler/zazen.yml +14 -6
- data/test/integration/zafu_compiler_test.rb +5 -1
- data/test/sites/complex/columns.yml +5 -0
- data/test/sites/complex/roles.yml +4 -0
- data/test/sites/zena/nodes.yml +13 -2
- data/test/sites/zena/roles.yml +13 -5
- data/test/sites/zena/versions.yml +27 -9
- data/test/unit/column_test.rb +51 -5
- data/test/unit/iformat_test.rb +2 -2
- data/test/unit/node_test.rb +29 -17
- data/test/unit/note_test.rb +1 -1
- data/test/unit/relation_proxy_test.rb +4 -5
- data/test/unit/relation_test.rb +16 -0
- data/test/unit/remote_test.rb +2 -2
- data/test/unit/role_test.rb +292 -4
- data/test/unit/site_test.rb +12 -0
- data/test/unit/template_test.rb +1 -1
- data/test/unit/text_document_test.rb +1 -1
- data/test/unit/virtual_class_test.rb +200 -83
- data/test/unit/zena/acts/enrollable_test.rb +26 -31
- data/test/unit/zena/use/calendar_test.rb +90 -37
- data/test/unit/zena/use/field_index_test.rb +28 -0
- data/test/unit/zena/use/html_tags_test.rb +7 -3
- data/test/unit/zena/use/ml_index_test.rb +2 -16
- data/test/unit/zena/use/nested_attributes_alias_view_test.rb +2 -2
- data/test/unit/zena/use/prop_eval_test.rb +50 -8
- data/test/unit/zena/use/query_node_test.rb +11 -0
- data/test/unit/zena/use/rendering_test.rb +72 -0
- data/test/unit/zena/use/scope_index_test.rb +37 -2
- data/test/unit/zena/use/urls_test.rb +10 -0
- data/test/unit/zena/use/zazen_test.rb +3 -3
- data/vendor/plugins/gettext_i18n_rails/Gemfile +11 -0
- data/vendor/plugins/gettext_i18n_rails/Gemfile.lock +92 -0
- data/vendor/plugins/gettext_i18n_rails/Rakefile +12 -17
- data/vendor/plugins/gettext_i18n_rails/Readme.md +215 -0
- data/vendor/plugins/gettext_i18n_rails/VERSION +1 -1
- data/vendor/plugins/gettext_i18n_rails/gettext_i18n_rails.gemspec +38 -34
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb +1 -1
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/backend.rb +30 -14
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/haml_parser.rb +1 -1
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/html_safe_translations.rb +29 -0
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/i18n_hacks.rb +29 -1
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/model_attributes_finder.rb +7 -1
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/railtie.rb +10 -0
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/ruby_gettext_extractor.rb +6 -2
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/string_interpolate_fix.rb +20 -0
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/tasks.rb +120 -0
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails.rb +10 -3
- data/vendor/plugins/gettext_i18n_rails/lib/tasks/gettext_rails_i18n.rake +1 -74
- data/vendor/plugins/gettext_i18n_rails/spec/gettext_i18n_rails/active_record_spec.rb +51 -20
- data/vendor/plugins/gettext_i18n_rails/spec/gettext_i18n_rails/backend_spec.rb +12 -7
- data/vendor/plugins/gettext_i18n_rails/spec/gettext_i18n_rails/string_interpolate_fix_spec.rb +32 -0
- data/vendor/plugins/gettext_i18n_rails/spec/gettext_i18n_rails_spec.rb +38 -1
- data/vendor/plugins/gettext_i18n_rails/spec/rails2/Gemfile +11 -0
- data/vendor/plugins/gettext_i18n_rails/spec/spec_helper.rb +1 -8
- data/zena.gemspec +2241 -2217
- metadata +123 -83
- data/.gitignore +0 -36
- data/app/views/nodes/_dates.rhtml +0 -13
- data/db/init/base/skins/default/Node-+adminLayout.zafu +0 -46
- data/db/init/base/skins/default/Node-tree.zafu +0 -19
- data/vendor/plugins/gettext_i18n_rails/README.markdown +0 -143
data/test/unit/node_test.rb
CHANGED
@@ -17,19 +17,19 @@ class NodeTest < Zena::Unit::TestCase
|
|
17
17
|
end
|
18
18
|
|
19
19
|
context 'with a sub-node' do
|
20
|
-
should 'return true on
|
21
|
-
assert subject.
|
20
|
+
should 'return true on is_ancestor?' do
|
21
|
+
assert subject.is_ancestor?(secure!(Node) { nodes(:status) })
|
22
22
|
end
|
23
23
|
end # with a sub-node
|
24
24
|
|
25
25
|
context 'with a node that is not a sub-node' do
|
26
|
-
should 'return false on
|
27
|
-
assert !subject.
|
26
|
+
should 'return false on is_ancestor?' do
|
27
|
+
assert !subject.is_ancestor?(secure!(Node) { nodes(:people) })
|
28
28
|
end
|
29
29
|
end # with a node that is not a sub-node
|
30
30
|
|
31
|
-
should 'return true on
|
32
|
-
assert subject.
|
31
|
+
should 'return true on is_ancestor? on self' do
|
32
|
+
assert subject.is_ancestor?(subject)
|
33
33
|
end
|
34
34
|
end # On a node
|
35
35
|
|
@@ -117,7 +117,7 @@ class NodeTest < Zena::Unit::TestCase
|
|
117
117
|
|
118
118
|
should 'transform zip in parent_id' do
|
119
119
|
assert subject.update_attributes_with_transformation('parent_id' => 'lake+')
|
120
|
-
assert_equal nodes_id(:
|
120
|
+
assert_equal nodes_id(:lake), subject.parent_id
|
121
121
|
end
|
122
122
|
|
123
123
|
should 'add error on bad zip in parent_id' do
|
@@ -147,7 +147,7 @@ class NodeTest < Zena::Unit::TestCase
|
|
147
147
|
# This is a stupid test because the result is not the same in production...
|
148
148
|
def test_match_query
|
149
149
|
query = Node.match_query('smala')
|
150
|
-
assert_equal "
|
150
|
+
assert_equal "vs.idx_text_high LIKE '%smala%'", query[:conditions]
|
151
151
|
query = Node.match_query('.', :node => nodes(:wiki))
|
152
152
|
assert_equal ["parent_id = ?", nodes_id(:wiki)], query[:conditions]
|
153
153
|
end
|
@@ -384,6 +384,18 @@ class NodeTest < Zena::Unit::TestCase
|
|
384
384
|
assert_equal Zena::Status[:rem], versions(:bird_jpg_en).status
|
385
385
|
assert_equal Zena::Status[:rem], versions(:flower_jpg_en).status
|
386
386
|
end
|
387
|
+
|
388
|
+
should 'sync documents with node' do
|
389
|
+
assert subject.unpublish
|
390
|
+
assert_equal Zena::Status[:rem], versions(:bird_jpg_en).status
|
391
|
+
assert_equal Zena::Status[:rem], versions(:flower_jpg_en).status
|
392
|
+
assert subject.redit
|
393
|
+
assert_equal Zena::Status[:red], versions(:bird_jpg_en).status
|
394
|
+
assert_equal Zena::Status[:red], versions(:flower_jpg_en).status
|
395
|
+
assert subject.publish
|
396
|
+
assert_equal Zena::Status[:pub], versions(:bird_jpg_en).status
|
397
|
+
assert_equal Zena::Status[:pub], versions(:flower_jpg_en).status
|
398
|
+
end
|
387
399
|
end
|
388
400
|
|
389
401
|
context 'on a removed node with removed documents' do
|
@@ -1076,19 +1088,19 @@ done: \"I am done\""
|
|
1076
1088
|
assert_equal Document, Node.native_classes['ND']
|
1077
1089
|
assert_equal Image, Node.native_classes['NDI']
|
1078
1090
|
end
|
1079
|
-
|
1091
|
+
|
1080
1092
|
should 'return nil for vclass kpath' do
|
1081
1093
|
assert_nil Node.native_classes['NNP']
|
1082
1094
|
end
|
1083
1095
|
end # by kpath
|
1084
|
-
|
1096
|
+
|
1085
1097
|
context 'by name' do
|
1086
1098
|
should 'find class' do
|
1087
1099
|
assert_equal Page, Node.native_classes_by_name['Page']
|
1088
1100
|
assert_equal Document, Node.native_classes_by_name['Document']
|
1089
1101
|
assert_equal Image, Node.native_classes_by_name['Image']
|
1090
1102
|
end
|
1091
|
-
|
1103
|
+
|
1092
1104
|
should 'return nil for vclass kpath' do
|
1093
1105
|
assert_nil Node.native_classes['Post']
|
1094
1106
|
end
|
@@ -1385,24 +1397,24 @@ done: \"I am done\""
|
|
1385
1397
|
end
|
1386
1398
|
|
1387
1399
|
should 'parse pseudo ids' do
|
1388
|
-
assert_transforms "Hi, this is just a simple \"test\":
|
1389
|
-
"Hi, this is just a simple \"test\"::w or \"\"::w
|
1400
|
+
assert_transforms "Hi, this is just a simple \"test\":49 or \"\":43_life.rss. OK ?\n\n!24_pv!",
|
1401
|
+
"Hi, this is just a simple \"test\"::w or \"\"::w++_life.rss. OK ?\n\n!:lake_pv!"
|
1390
1402
|
end
|
1391
1403
|
|
1392
1404
|
should 'parse pseudo ids with offset in gallery' do
|
1393
|
-
assert_transforms "Hi ![30,
|
1405
|
+
assert_transforms "Hi ![30,23]! ![]!",
|
1394
1406
|
"Hi ![30,:lake+]! ![]!"
|
1395
1407
|
end
|
1396
1408
|
|
1397
1409
|
should 'parse pseudo ids in doc_list' do
|
1398
|
-
assert_transforms "Hi !{30,
|
1410
|
+
assert_transforms "Hi !{30,23}! !{}!",
|
1399
1411
|
"Hi !{:bird,:lake+}! !{}!"
|
1400
1412
|
|
1401
1413
|
end
|
1402
1414
|
|
1403
1415
|
should 'parse pseudo ids in links' do
|
1404
|
-
assert_transforms "Hi !30!:21 !30!:
|
1405
|
-
"Hi !30!::clean !:bird!::clean !:bird/nice bird!:21 !30_pv/hello ladies!:21"
|
1416
|
+
assert_transforms "Hi !30!:21 !30!:37 !30/nice bird!:21 !30_pv/hello ladies!:21",
|
1417
|
+
"Hi !30!::clean+ !:bird!::clean !:bird/nice bird!:21 !30_pv/hello ladies!:21"
|
1406
1418
|
end
|
1407
1419
|
|
1408
1420
|
should 'not alter existing code without pseudo ids' do
|
data/test/unit/note_test.rb
CHANGED
@@ -7,7 +7,7 @@ class NoteTest < Zena::Unit::TestCase
|
|
7
7
|
test_page = secure!(Note) { Note.create(:title => "yoba", :parent_id => nodes_id(:cleanWater), :inherit=>1 ) }
|
8
8
|
assert ! test_page.new_record? , "Not a new record"
|
9
9
|
assert_equal nodes_id(:cleanWater), test_page.parent[:id]
|
10
|
-
assert_equal
|
10
|
+
assert_equal "18/21/#{test_page.zip}", test_page.fullpath
|
11
11
|
assert_equal '18/21', test_page.basepath
|
12
12
|
end
|
13
13
|
|
@@ -508,7 +508,7 @@ class RelationProxyTest < Zena::Unit::TestCase
|
|
508
508
|
assert node.update_attributes_with_transformation('rel_attributes' => {'reference_attributes' => {'other_id' => 33, 'date' => '2009-7-18 8:0'}})
|
509
509
|
assert node.update_attributes_with_transformation('rel_attributes' => {'reference_attributes' => {'other_id' => 33, 'date' => '2009-7-18 9:0'}})
|
510
510
|
end
|
511
|
-
|
511
|
+
|
512
512
|
subject do
|
513
513
|
secure!(Node) { nodes(:cleanWater) }
|
514
514
|
end
|
@@ -517,15 +517,15 @@ class RelationProxyTest < Zena::Unit::TestCase
|
|
517
517
|
assert_difference('Link.count', -1) do
|
518
518
|
# remove 9:0
|
519
519
|
assert subject.update_attributes_with_transformation('rel_attributes' => {'reference_attributes' => {'other_id' => '', 'date' => '2009-7-18 9:0'}})
|
520
|
-
end
|
521
|
-
|
520
|
+
end
|
521
|
+
|
522
522
|
assert references = subject.find(:all, 'references')
|
523
523
|
assert_equal 2, references.size
|
524
524
|
assert_equal Time.gm(2009,7,17), references.first.l_date
|
525
525
|
assert_equal Time.gm(2009,7,18,8), references.last.l_date
|
526
526
|
end
|
527
527
|
end # with many dates for a given target
|
528
|
-
|
528
|
+
|
529
529
|
def test_attr_public
|
530
530
|
assert Node.safe_method_type(['l_status'])
|
531
531
|
assert Node.safe_method_type(['l_comment'])
|
@@ -554,5 +554,4 @@ class RelationProxyTest < Zena::Unit::TestCase
|
|
554
554
|
assert_equal 100, subject.find(:first, 'reference where l_status = 100').l_status
|
555
555
|
end
|
556
556
|
end # With many links
|
557
|
-
|
558
557
|
end
|
data/test/unit/relation_test.rb
CHANGED
@@ -196,5 +196,21 @@ class RelationTest < Zena::Unit::TestCase
|
|
196
196
|
relation.update_attributes(:site_id => 1234)
|
197
197
|
assert_equal original_site_id, relation.site_id
|
198
198
|
end
|
199
|
+
|
200
|
+
|
201
|
+
context 'Exporting a relation' do
|
202
|
+
subject do
|
203
|
+
relations(:node_has_tags)
|
204
|
+
end
|
205
|
+
|
206
|
+
should 'create a hash' do
|
207
|
+
assert_equal({
|
208
|
+
'rel_group' => 'doc.tags',
|
209
|
+
'source_role' => 'tagged',
|
210
|
+
'target_kpath' => 'NPT',
|
211
|
+
'target_icon' => "<img src='/images/tag_blue.png' alt='tag'/>",
|
212
|
+
}, subject.export)
|
213
|
+
end
|
214
|
+
end # Exporting a relation
|
199
215
|
|
200
216
|
end
|
data/test/unit/remote_test.rb
CHANGED
@@ -218,11 +218,11 @@ class RemoteTest < Zena::Integration::TestCase
|
|
218
218
|
|
219
219
|
context 'nodes with search' do
|
220
220
|
subject do
|
221
|
-
@app.search('
|
221
|
+
@app.search('lake')
|
222
222
|
end
|
223
223
|
|
224
224
|
should 'find through fulltext search' do
|
225
|
-
assert_equal ["
|
225
|
+
assert_equal ["it's a lake", "The lake we love"], subject.map(&:title)
|
226
226
|
end
|
227
227
|
end
|
228
228
|
end # finding
|
data/test/unit/role_test.rb
CHANGED
@@ -41,7 +41,7 @@ class RoleTest < Zena::Unit::TestCase
|
|
41
41
|
|
42
42
|
context 'Creating a new Role' do
|
43
43
|
subject do
|
44
|
-
Role.create('name' => 'WriteTests')
|
44
|
+
Role.create('name' => 'WriteTests', 'superclass' => 'Node')
|
45
45
|
end
|
46
46
|
|
47
47
|
context 'with an anonymous visitor' do
|
@@ -77,6 +77,7 @@ class RoleTest < Zena::Unit::TestCase
|
|
77
77
|
assert_difference('Role.count', 1) do
|
78
78
|
subject
|
79
79
|
end
|
80
|
+
assert_equal 'N', subject.kpath
|
80
81
|
end
|
81
82
|
end # with an admin visitor
|
82
83
|
end # Creating a new Role
|
@@ -117,8 +118,8 @@ class RoleTest < Zena::Unit::TestCase
|
|
117
118
|
end
|
118
119
|
end # with an admin visitor
|
119
120
|
end # Creating a new Role
|
120
|
-
|
121
|
-
context 'with a
|
121
|
+
|
122
|
+
context 'with a Role' do
|
122
123
|
subject do
|
123
124
|
roles(:Original)
|
124
125
|
end
|
@@ -126,6 +127,293 @@ class RoleTest < Zena::Unit::TestCase
|
|
126
127
|
should 'return all defined safe columns' do
|
127
128
|
assert_equal %w{origin tz weight}, subject.defined_safe_columns.map(&:name)
|
128
129
|
end
|
129
|
-
end # with a
|
130
|
+
end # with a Role
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
context 'An admin' do
|
135
|
+
setup do
|
136
|
+
login(:lion)
|
137
|
+
end
|
138
|
+
|
139
|
+
context 'exporting a virtual class' do
|
140
|
+
setup do
|
141
|
+
login(:lion)
|
142
|
+
end
|
143
|
+
|
144
|
+
subject do
|
145
|
+
VirtualClass['Post'].export
|
146
|
+
end
|
147
|
+
|
148
|
+
should 'export attributes' do
|
149
|
+
assert_equal('VirtualClass', subject['type'])
|
150
|
+
end
|
151
|
+
|
152
|
+
should 'export columns' do
|
153
|
+
assert_equal({
|
154
|
+
'date' => {'index' => '.idx_datetime1', 'ptype' => 'datetime'},
|
155
|
+
}, subject['columns'])
|
156
|
+
end
|
157
|
+
|
158
|
+
should 'export sub classes' do
|
159
|
+
end
|
160
|
+
end # exporting a virtual class
|
161
|
+
|
162
|
+
context 'exporting a real class' do
|
163
|
+
subject do
|
164
|
+
VirtualClass['Page'].export
|
165
|
+
end
|
166
|
+
|
167
|
+
should 'export type as Class' do
|
168
|
+
assert_equal('Class', subject['type'])
|
169
|
+
end
|
170
|
+
|
171
|
+
should 'export sub classes' do
|
172
|
+
assert_equal(%w{Tracker Project Section Tag}, subject.keys.select{|k| k=~/\A[A-Z]/})
|
173
|
+
assert_equal('VirtualClass', subject['Tracker']['type'])
|
174
|
+
end
|
175
|
+
|
176
|
+
context 'with linked roles' do
|
177
|
+
setup do
|
178
|
+
secure!(::Role) { ::Role.create('name' => 'Foo', 'superclass' => 'Page')}
|
179
|
+
end
|
180
|
+
|
181
|
+
should 'export linked roles' do
|
182
|
+
assert_equal('Role', subject['Foo']['type'])
|
183
|
+
end
|
184
|
+
end # with linked roles
|
185
|
+
|
186
|
+
end # exporting a real class
|
187
|
+
|
188
|
+
context 'exporting a role' do
|
189
|
+
subject do
|
190
|
+
roles(:Original).export
|
191
|
+
end
|
192
|
+
|
193
|
+
should 'description' do
|
194
|
+
|
195
|
+
end
|
196
|
+
end # exporting a role
|
197
|
+
|
198
|
+
context 'importing columns' do
|
199
|
+
subject do
|
200
|
+
roles(:Post)
|
201
|
+
end
|
202
|
+
|
203
|
+
should 'create properties' do
|
204
|
+
assert_difference('Column.count', 2) do
|
205
|
+
subject.import_columns({
|
206
|
+
'one' => {
|
207
|
+
'ptype' => 'string',
|
208
|
+
'index' => 'ml_string',
|
209
|
+
},
|
210
|
+
'two' => {
|
211
|
+
'ptype' => 'integer',
|
212
|
+
},
|
213
|
+
})
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
should 'not create or move existing property in different role' do
|
218
|
+
data = Zafu::OrderedHash.new
|
219
|
+
data['one'] = {
|
220
|
+
'ptype' => 'string',
|
221
|
+
'index' => 'ml_string',
|
222
|
+
}
|
223
|
+
data['tz'] = {
|
224
|
+
'ptype' => 'integer',
|
225
|
+
}
|
226
|
+
assert_difference('Column.count', 0) do
|
227
|
+
# rollback 'one' creation
|
228
|
+
assert_raise(Exception) do
|
229
|
+
subject.import_columns(data)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
should 'set property type and index' do
|
235
|
+
subject.import_columns({
|
236
|
+
'one' => {
|
237
|
+
'ptype' => 'string',
|
238
|
+
'index' => 'ml_string',
|
239
|
+
},
|
240
|
+
'two' => {
|
241
|
+
'ptype' => 'integer',
|
242
|
+
},
|
243
|
+
})
|
244
|
+
one = ::Column.find_by_name('one')
|
245
|
+
two = ::Column.find_by_name('two')
|
246
|
+
assert_equal('string', one.ptype)
|
247
|
+
assert_equal('ml_string', one.index)
|
248
|
+
assert_equal('integer', two.ptype)
|
249
|
+
assert_nil(two.index)
|
250
|
+
end
|
251
|
+
|
252
|
+
context 'with invalid index' do
|
253
|
+
should 'raise errors' do
|
254
|
+
e = nil
|
255
|
+
assert_difference('Column.count', 0) do
|
256
|
+
e = assert_raise(ActiveRecord::RecordInvalid) do
|
257
|
+
subject.import_columns({
|
258
|
+
'one' => {
|
259
|
+
'ptype' => 'stringbar',
|
260
|
+
},
|
261
|
+
'two' => {
|
262
|
+
'ptype' => 'integer',
|
263
|
+
'index' => 'bad',
|
264
|
+
},
|
265
|
+
})
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
r = e.record
|
270
|
+
assert_equal "Column 'two' Validation failed: Index invalid", "#{r.class} '#{r.name}' #{e.message}"
|
271
|
+
end
|
272
|
+
end # with invalid index
|
273
|
+
|
274
|
+
context 'with invalid column name' do
|
275
|
+
should 'raise errors' do
|
276
|
+
e = nil
|
277
|
+
assert_difference('Column.count', 0) do
|
278
|
+
e = assert_raise(Exception) do
|
279
|
+
subject.import_columns({
|
280
|
+
'one' => {
|
281
|
+
'ptype' => 'stringbar',
|
282
|
+
},
|
283
|
+
'paper' => {
|
284
|
+
'ptype' => 'integer',
|
285
|
+
},
|
286
|
+
})
|
287
|
+
end
|
288
|
+
end
|
289
|
+
assert_equal "Cannot set property 'paper' in 'Post': already defined in 'Letter'.", e.message
|
290
|
+
end
|
291
|
+
end # with invalid data
|
292
|
+
end
|
293
|
+
|
294
|
+
context 'importing roles' do
|
295
|
+
subject do
|
296
|
+
{ 'Node' => {
|
297
|
+
'Foo' => {
|
298
|
+
'type' => 'Role',
|
299
|
+
'columns' => {
|
300
|
+
'foo' => {'index' => '', 'ptype' => 'integer'},
|
301
|
+
'bar' => {'index' => '', 'ptype' => 'string'},
|
302
|
+
'baz' => {'index' => 'string', 'ptype' => 'string'},
|
303
|
+
},
|
304
|
+
},
|
305
|
+
},
|
306
|
+
}
|
307
|
+
end
|
308
|
+
|
309
|
+
should 'create roles' do
|
310
|
+
assert_difference('Role.count', 1) do
|
311
|
+
::Role.import(subject)
|
312
|
+
end
|
313
|
+
role = Role.find_by_name 'Foo'
|
314
|
+
assert_equal 'N', role.kpath
|
315
|
+
end
|
316
|
+
|
317
|
+
should 'create columns' do
|
318
|
+
assert_difference('Column.count', 3) do
|
319
|
+
::Role.import(subject)
|
320
|
+
end
|
321
|
+
end
|
322
|
+
end # importing roles
|
323
|
+
|
324
|
+
context 'importing virtual classes' do
|
325
|
+
setup do
|
326
|
+
VirtualClass.expire_cache!
|
327
|
+
end
|
328
|
+
|
329
|
+
subject do
|
330
|
+
{ 'Node' => {
|
331
|
+
'Note' => {
|
332
|
+
'Foo' => {
|
333
|
+
'type' => 'VirtualClass',
|
334
|
+
'idx_scope' => "{'reference' => 'references', 'contact' => 'project'}",
|
335
|
+
'columns' => {
|
336
|
+
'foo' => {'index' => '', 'ptype' => 'integer'},
|
337
|
+
'bar' => {'index' => '', 'ptype' => 'string'},
|
338
|
+
'baz' => {'index' => 'string', 'ptype' => 'string'},
|
339
|
+
},
|
340
|
+
},
|
341
|
+
},
|
342
|
+
},
|
343
|
+
}
|
344
|
+
end
|
345
|
+
|
346
|
+
should 'create virtual class' do
|
347
|
+
assert_difference('VirtualClass.count', 1) do
|
348
|
+
::Role.import(subject)
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
352
|
+
should 'set attributes' do
|
353
|
+
::Role.import(subject)
|
354
|
+
assert_equal(
|
355
|
+
"{'reference' => 'references', 'contact' => 'project'}",
|
356
|
+
VirtualClass['Foo'].idx_scope
|
357
|
+
)
|
358
|
+
assert_equal('NNF', VirtualClass['Foo'].kpath)
|
359
|
+
end
|
360
|
+
|
361
|
+
should 'create columns' do
|
362
|
+
assert_difference('Column.count', 3) do
|
363
|
+
::Role.import(subject)
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
context 'with duplicate column names' do
|
368
|
+
subject do
|
369
|
+
{ 'Node' => {
|
370
|
+
'Foo' => {
|
371
|
+
'type' => 'Role',
|
372
|
+
'columns' => {
|
373
|
+
'foo' => {'ptype' => 'integer'},
|
374
|
+
'tz' => {'ptype' => 'string'},
|
375
|
+
},
|
376
|
+
},
|
377
|
+
},
|
378
|
+
}
|
379
|
+
end
|
380
|
+
|
381
|
+
should 'raise an error' do
|
382
|
+
assert_difference('Column.count', 0) do
|
383
|
+
e = assert_raise(Exception) do
|
384
|
+
::Role.import(subject)
|
385
|
+
end
|
386
|
+
assert_equal "Cannot set property 'tz' in 'Foo': already defined in 'Original'.", e.message
|
387
|
+
end
|
388
|
+
end
|
389
|
+
end # with duplicate column names
|
390
|
+
|
391
|
+
|
392
|
+
context 'with bad types' do
|
393
|
+
subject do
|
394
|
+
{ 'Node' => {
|
395
|
+
'Note' => {
|
396
|
+
'type' => 'Capoff',
|
397
|
+
'Foo' => {
|
398
|
+
'type' => 'Role',
|
399
|
+
},
|
400
|
+
},
|
401
|
+
},
|
402
|
+
}
|
403
|
+
end
|
404
|
+
|
405
|
+
should 'raise an error' do
|
406
|
+
assert_difference('Column.count', 0) do
|
407
|
+
e = assert_raise(Exception) do
|
408
|
+
::Role.import(subject)
|
409
|
+
end
|
410
|
+
assert_equal "Cannot create 'Note': invalid type 'Capoff'.", e.message
|
411
|
+
end
|
412
|
+
end
|
413
|
+
end # with duplicate column names
|
414
|
+
end # importing virtual classes
|
415
|
+
end # An admin
|
416
|
+
|
130
417
|
# Indexed columns in role tested in NodeTest
|
418
|
+
|
131
419
|
end
|
data/test/unit/site_test.rb
CHANGED
@@ -129,6 +129,18 @@ class SiteTest < Zena::Unit::TestCase
|
|
129
129
|
anon.site = site
|
130
130
|
assert anon.is_anon?
|
131
131
|
end
|
132
|
+
|
133
|
+
context 'A site' do
|
134
|
+
subject do
|
135
|
+
sites(:zena)
|
136
|
+
end
|
137
|
+
|
138
|
+
should 'respond to any_admin' do
|
139
|
+
assert_kind_of User, subject.any_admin
|
140
|
+
assert_equal users(:lion), subject.any_admin
|
141
|
+
end
|
142
|
+
end # A site
|
143
|
+
|
132
144
|
|
133
145
|
def test_public_group
|
134
146
|
login(:anon)
|
data/test/unit/template_test.rb
CHANGED
@@ -238,7 +238,7 @@ class TemplateTest < Zena::Unit::TestCase
|
|
238
238
|
|
239
239
|
should 'destroy index if target_klass is removed' do
|
240
240
|
assert_difference('IdxTemplate.count', -1) do
|
241
|
-
assert subject.update_attributes(:target_klass => '')
|
241
|
+
assert subject.update_attributes(:target_klass => '', :v_status => Zena::Status[:pub])
|
242
242
|
end
|
243
243
|
end
|
244
244
|
end # with target_klass
|
@@ -129,7 +129,7 @@ class TextDocumentTest < Zena::Unit::TestCase
|
|
129
129
|
#header { background:url('bird.jpg') }
|
130
130
|
#pv { background:url('bird_pv.jpg') }
|
131
131
|
#footer { background:url('/projects list/a wiki with Zena/flower.jpg') }
|
132
|
-
#back { background:url('
|
132
|
+
#back { background:url('../../../projects list/a wiki with Zena/flower.jpg') }
|
133
133
|
#no_stamp { background:url('/en/image30_pv.jpg') }
|
134
134
|
END_CSS
|
135
135
|
node.text = start.dup
|