zeddb 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,64 @@
1
+ ##
2
+ # Copyright (c) Zedkit.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
5
+ # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
6
+ # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
+ # Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
+ # Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ ##
17
+
18
+ require 'helper'
19
+
20
+ class TestAssociations < Test::Unit::TestCase
21
+ def test_get
22
+ ma = ZedDB::ModelAssociations.get(:user_key => @uu['user_key'],
23
+ :uuid => pmodels.find {|i| i['name'] == 'bucket' }['associations'][0]['uuid'])
24
+ assert ma.is_a? Hash
25
+ assert_equal pmodels.find {|i| i['name'] == 'bucket' }['associations'][0]['uuid'], ma['uuid']
26
+ assert_equal 'HM', ma['type']['code']
27
+ assert_equal 'BT', ma['inverse']['code']
28
+ end
29
+ def test_get_with_block
30
+ md = pmodels.find {|i| i['name'] == 'bucket' }
31
+ ZedDB::ModelAssociations.get(:user_key => @uu['user_key'], :uuid => md['associations'][0]['uuid']) do |ma|
32
+ assert ma.is_a? Hash
33
+ assert_equal pmodels.find {|i| i['name'] == 'bucket' }['associations'][0]['uuid'], ma['uuid']
34
+ assert_equal 'HM', ma['type']['code']
35
+ assert_equal 'BT', ma['inverse']['code']
36
+ end
37
+ end
38
+
39
+ def test_create_association_already_in_place
40
+ ma = ZedDB::ModelAssociations.create(:user_key => @uu['user_key'],
41
+ :association => { :first => pmodels.find {|i| i['name'] == 'bucket' }['uuid'],
42
+ :code => 'HM', :inverse => 'BT',
43
+ :second => pmodels.find {|i| i['name'] == 'item' }['uuid'] })
44
+ assert_not_nil ma
45
+ assert_equal 'ERROR', ma['status']['result']
46
+ assert_equal "The models submitted are already associated.", ma['errors']['attributes']['association']
47
+ end
48
+ def test_create
49
+ end
50
+ def test_create_with_block
51
+ end
52
+
53
+ def test_delete
54
+ ma = ZedDB::ModelAssociations.delete(:user_key => @uu['user_key'],
55
+ :uuid => pmodels.find {|i| i['name'] == 'bucket' }['associations'][0]['uuid'])
56
+ assert_equal ma, {}
57
+ end
58
+ def test_delete_with_block
59
+ ZedDB::ModelAssociations.delete(:user_key => @uu['user_key'],
60
+ :uuid => pmodels.find {|i| i['name'] == 'bucket' }['associations'][0]['uuid']) do |ma|
61
+ assert_equal ma, {}
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,36 @@
1
+ ##
2
+ # Copyright (c) Zedkit.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
5
+ # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
6
+ # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
+ # Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
+ # Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ ##
17
+
18
+ require 'helper'
19
+
20
+ class TestEntities < Test::Unit::TestCase
21
+ def test_get_entities
22
+ dbes = ZedDB.entities(@uu['user_key'])
23
+ assert_not_nil dbes['data_types']
24
+ assert_not_nil dbes['validations']
25
+ assert_not_nil dbes['transformers']
26
+ assert_not_nil dbes['associations']
27
+ end
28
+ def test_entities_with_block
29
+ ZedDB.entities(@uu['user_key']) do |dbes|
30
+ assert_not_nil dbes['data_types']
31
+ assert_not_nil dbes['validations']
32
+ assert_not_nil dbes['transformers']
33
+ assert_not_nil dbes['associations']
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,79 @@
1
+ ##
2
+ # Copyright (c) Zedkit.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
5
+ # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
6
+ # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
+ # Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
+ # Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ ##
17
+
18
+ require 'helper'
19
+
20
+ class TestModelItems < Test::Unit::TestCase
21
+ def test_get
22
+ md = ZedDB::Models.get(:user_key => @uu['user_key'], :uuid => pmodels.find {|i| i['name'] == 'item' }['uuid'])
23
+ mi = ZedDB::ModelItems.get(:user_key => @uu['user_key'], :uuid => md['items'][0]['uuid'])
24
+ assert_equal 32, mi['uuid'].length
25
+ assert_equal 'cool', mi['name']
26
+ assert_equal 'STRING', mi['type']['code']
27
+ end
28
+ def test_get_with_block
29
+ md = ZedDB::Models.get(:user_key => @uu['user_key'], :uuid => pmodels.find {|i| i['name'] == 'item' }['uuid'])
30
+ ZedDB::ModelItems.get(:user_key => @uu['user_key'], :uuid => md['items'][0]['uuid']) do |mi|
31
+ assert_equal 32, mi['uuid'].length
32
+ assert_equal 'cool', mi['name']
33
+ end
34
+ end
35
+
36
+ def test_create
37
+ md = ZedDB::Models.get(:user_key => @uu['user_key'], :uuid => pmodels.find {|i| i['name'] == 'item' }['uuid'])
38
+ mi = ZedDB::ModelItems.create(:user_key => @uu['user_key'],
39
+ :model => { :uuid => md['uuid'] }, :item => { :type => 'STRING', :name => 'Whatever' })
40
+ assert_equal 32, mi['uuid'].length
41
+ assert_equal 'whatever', mi['name']
42
+ assert_equal 'STRING', mi['type']['code']
43
+ end
44
+ def test_create_with_block
45
+ md = ZedDB::Models.get(:user_key => @uu['user_key'], :uuid => pmodels.find {|i| i['name'] == 'item' }['uuid'])
46
+ ZedDB::ModelItems.create(:user_key => @uu['user_key'],
47
+ :model => { :uuid => md['uuid'] }, :item => { :type => 'STRING', :name => 'Whatever' }) do |mi|
48
+ assert_equal 32, mi['uuid'].length
49
+ assert_equal 'whatever', mi['name']
50
+ end
51
+ end
52
+
53
+ def test_update
54
+ md = ZedDB::Models.get(:user_key => @uu['user_key'], :uuid => pmodels.find {|i| i['name'] == 'item' }['uuid'])
55
+ mi = ZedDB::ModelItems.update(:user_key => @uu['user_key'],
56
+ :uuid => md['items'][0]['uuid'], :item => { :name => 'newname' })
57
+ assert_equal md['items'][0]['uuid'], mi['uuid']
58
+ assert_equal 'newname', mi['name']
59
+ end
60
+ def test_update_with_block
61
+ md = ZedDB::Models.get(:user_key => @uu['user_key'], :uuid => pmodels.find {|i| i['name'] == 'item' }['uuid'])
62
+ ZedDB::ModelItems.update(:user_key => @uu['user_key'],
63
+ :uuid => md['items'][0]['uuid'], :item => { :name => 'newname' }) do |mi|
64
+ assert_equal md['items'][0]['uuid'], mi['uuid']
65
+ end
66
+ end
67
+
68
+ def test_delete
69
+ md = ZedDB::Models.get(:user_key => @uu['user_key'], :uuid => pmodels.find {|i| i['name'] == 'item' }['uuid'])
70
+ mi = ZedDB::ModelItems.delete(:user_key => @uu['user_key'], :uuid => md['items'][0]['uuid'])
71
+ assert_equal mi, {}
72
+ end
73
+ def test_delete_with_block
74
+ md = ZedDB::Models.get(:user_key => @uu['user_key'], :uuid => pmodels.find {|i| i['name'] == 'item' }['uuid'])
75
+ ZedDB::ModelItems.delete(:user_key => @uu['user_key'], :uuid => md['items'][0]['uuid']) do |mi|
76
+ assert_equal mi, {}
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,72 @@
1
+ ##
2
+ # Copyright (c) Zedkit.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
5
+ # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
6
+ # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
+ # Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
+ # Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ ##
17
+
18
+ require 'helper'
19
+
20
+ class TestModels < Test::Unit::TestCase
21
+ def test_get
22
+ md = ZedDB::Models.get(:user_key => @uu['user_key'], :uuid => pmodels.find {|i| i['name'] == 'bucket' }['uuid'])
23
+ assert_equal 32, md['uuid'].length
24
+ assert_equal 'bucket', md['name']
25
+ end
26
+ def test_get_with_block
27
+ ZedDB::Models.get(:user_key => @uu['user_key'], :uuid => pmodels.find {|i| i['name'] == 'bucket' }['uuid']) do |md|
28
+ assert_equal 32, md['uuid'].length
29
+ assert_equal 'bucket', md['name']
30
+ end
31
+ end
32
+
33
+ def test_create
34
+ md = ZedDB::Models.create(:user_key => @uu['user_key'],
35
+ :project => { :uuid => @uu['projects'][0] }, :model => { :name => 'newmodel' })
36
+ assert_equal 32, md['uuid'].length
37
+ assert_equal 'newmodel', md['name']
38
+ end
39
+ def test_create_with_block
40
+ ZedDB::Models.create(:user_key => @uu['user_key'],
41
+ :project => { :uuid => @uu['projects'][0] }, :model => { :name => 'newmodel' }) do |md|
42
+ assert_equal 32, md['uuid'].length
43
+ assert_equal 'newmodel', md['name']
44
+ end
45
+ end
46
+
47
+ def test_update
48
+ ms = pmodels
49
+ md = ZedDB::Models.update(:user_key => @uu['user_key'], :uuid => ms.find {|m| m['name'] == 'bucket' }['uuid'],
50
+ :model => { :name => 'newname' })
51
+ assert_equal ms.find {|m| m['name'] == 'bucket' }['uuid'], md['uuid']
52
+ assert_equal 'newname', md['name']
53
+ end
54
+ def test_update_with_block
55
+ ms = pmodels
56
+ ZedDB::Models.update(:user_key => @uu['user_key'], :uuid => ms.find {|m| m['name'] == 'bucket' }['uuid'],
57
+ :model => { :name => 'newname' }) do |md|
58
+ assert_equal ms.find {|m| m['name'] == 'bucket' }['uuid'], md['uuid']
59
+ assert_equal 'newname', md['name']
60
+ end
61
+ end
62
+
63
+ def test_delete
64
+ md = ZedDB::Models.delete(:user_key => @uu['user_key'], :uuid => pmodels.find {|m| m['name'] == 'bucket' }['uuid'])
65
+ assert_equal md, {}
66
+ end
67
+ def test_delete_with_block
68
+ ZedDB::Models.delete(:user_key => @uu['user_key'], :uuid => pmodels.find {|m| m['name'] == 'bucket' }['uuid']) do |md|
69
+ assert_equal md, {}
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,35 @@
1
+ ##
2
+ # Copyright (c) Zedkit.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
5
+ # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
6
+ # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
+ # Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
+ # Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ ##
17
+
18
+ require 'helper'
19
+
20
+ class TestProjects < Test::Unit::TestCase
21
+ def test_get_models
22
+ ms = Zedkit::Projects::Models.get(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] })
23
+ assert_equal 3, ms.length
24
+ assert ms[0].member? 'name'
25
+ assert ms[0].member? 'uuid'
26
+ assert ms[1].member? 'name'
27
+ assert ms[1].member? 'uuid'
28
+ end
29
+ def test_get_models_with_block
30
+ Zedkit::Projects::Models.get(:user_key => @uu['user_key'], :project => { :uuid => @uu['projects'][0] }) do |ms|
31
+ assert ms.member? 'name'
32
+ assert ms.member? 'uuid'
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,60 @@
1
+ ##
2
+ # Copyright (c) Zedkit.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
5
+ # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
6
+ # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
+ # Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
+ # Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ ##
17
+
18
+ require 'helper'
19
+
20
+ class TestTransformers < Test::Unit::TestCase
21
+ def test_get
22
+ mt = ZedDB::ModelTransformers.get(:user_key => @uu['user_key'], :item => { :uuid => item_model['items'][0]['uuid'] },
23
+ :uuid => item_model['items'][0]['transformers'][0]['uuid'])
24
+ assert_equal item_model['items'][0]['uuid'], mt['item']['uuid']
25
+ assert_equal 'DN', mt['transformer']['code']
26
+ end
27
+ def test_get_with_block
28
+ ZedDB::ModelTransformers.get(:user_key => @uu['user_key'], :item => { :uuid => item_model['items'][0]['uuid'] },
29
+ :uuid => item_model['items'][0]['transformers'][0]['uuid']) do |mt|
30
+ assert_equal item_model['items'][0]['uuid'], mt['item']['uuid']
31
+ assert_equal 'DN', mt['transformer']['code']
32
+ end
33
+ end
34
+
35
+ def test_create_transformer_already_in_place
36
+ mt = ZedDB::ModelTransformers.create(:user_key => @uu['user_key'],
37
+ :item => { :uuid => pmodels.find {|i| i['name'] == 'item' }['items'][0]['uuid'] },
38
+ :transformer => { :code => 'DN' })
39
+ assert_not_nil mt
40
+ assert_equal 'ERROR', mt['status']['result']
41
+ assert_equal 'The model item tranformer is already in use with the model data item.',
42
+ mt['errors']['attributes']['transformer']
43
+ end
44
+ def test_create
45
+ end
46
+ def test_create_with_block
47
+ end
48
+
49
+ def test_delete
50
+ mt = ZedDB::ModelTransformers.delete(:user_key => @uu['user_key'], :item => { :uuid => item_model['items'][0]['uuid'] },
51
+ :uuid => item_model['items'][0]['transformers'][0]['uuid'])
52
+ assert_equal mt, {}
53
+ end
54
+ def test_delete_with_block
55
+ ZedDB::ModelTransformers.delete(:user_key => @uu['user_key'], :item => { :uuid => item_model['items'][0]['uuid'] },
56
+ :uuid => item_model['items'][0]['transformers'][0]['uuid']) do |mt|
57
+ assert_equal mt, {}
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,73 @@
1
+ ##
2
+ # Copyright (c) Zedkit.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
5
+ # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
6
+ # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
+ # Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
+ # Software.
11
+ #
12
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ ##
17
+
18
+ require 'helper'
19
+
20
+ class TestValidations < Test::Unit::TestCase
21
+ def test_get
22
+ mv = ZedDB::ModelValidations.get(:user_key => @uu['user_key'], :item => { :uuid => item_model['items'][0]['uuid'] },
23
+ :uuid => item_model['items'][0]['validations'][0]['uuid'])
24
+ assert_equal item_model['items'][0]['uuid'], mv['item']['uuid']
25
+ assert_equal 'SB', mv['validation']['code']
26
+ end
27
+ def test_get_with_block
28
+ ZedDB::ModelValidations.get(:user_key => @uu['user_key'], :item => { :uuid => item_model['items'][0]['uuid'] },
29
+ :uuid => item_model['items'][0]['validations'][0]['uuid']) do |mv|
30
+ assert_equal item_model['items'][0]['uuid'], mv['item']['uuid']
31
+ assert_equal 'SB', mv['validation']['code']
32
+ end
33
+ end
34
+
35
+ def test_create_model_validation_already_in_place
36
+ mv = ZedDB::ModelValidations.create(:user_key => @uu['user_key'], :item => { :uuid => item_model['items'][0]['uuid'] },
37
+ :validation => { :code => 'SB' })
38
+ assert_not_nil mv
39
+ assert_equal 'ERROR', mv['status']['result']
40
+ assert_equal 'The model item validation is already in use with the model data item.',
41
+ mv['errors']['attributes']['validation']
42
+ end
43
+ def test_create
44
+ end
45
+ def test_create_with_block
46
+ end
47
+
48
+ def test_update
49
+ mv = ZedDB::ModelValidations.update(:user_key => @uu['user_key'], :item => { :uuid => item_model['items'][0]['uuid'] },
50
+ :uuid => item_model['items'][0]['validations'][0]['uuid'],
51
+ :validation => { :qualifier => 'stuff' })
52
+ assert_equal 'stuff', mv['qualifier']
53
+ end
54
+ def test_update_with_block
55
+ ZedDB::ModelValidations.update(:user_key => @uu['user_key'], :item => { :uuid => item_model['items'][0]['uuid'] },
56
+ :uuid => item_model['items'][0]['validations'][0]['uuid'],
57
+ :validation => { :qualifier => 'stuff' }) do |mv|
58
+ assert_equal 'stuff', mv['qualifier']
59
+ end
60
+ end
61
+
62
+ def test_delete
63
+ mv = ZedDB::ModelValidations.delete(:user_key => @uu['user_key'], :item => { :uuid => item_model['items'][0]['uuid'] },
64
+ :uuid => item_model['items'][0]['validations'][0]['uuid'])
65
+ assert_equal mv, {}
66
+ end
67
+ def test_delete_with_block
68
+ ZedDB::ModelValidations.delete(:user_key => @uu['user_key'], :item => { :uuid => item_model['items'][0]['uuid'] },
69
+ :uuid => item_model['items'][0]['validations'][0]['uuid']) do |mv|
70
+ assert_equal mv, {}
71
+ end
72
+ end
73
+ end
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zeddb
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 1
8
+ - 3
9
+ version: 1.1.3
10
+ platform: ruby
11
+ authors:
12
+ - Zedkit
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-12-14 00:00:00 -08:00
18
+ default_executable: zeddb
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: zedkit
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 1
30
+ - 1
31
+ - 3
32
+ version: 1.1.3
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: json
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ segments:
44
+ - 1
45
+ - 4
46
+ - 4
47
+ version: 1.4.4
48
+ type: :runtime
49
+ version_requirements: *id002
50
+ description: gem to access the ZedDB within Zedkit applications to CRUD application models, the KVS and queues
51
+ email: support@zedkit.com
52
+ executables:
53
+ - zeddb
54
+ extensions: []
55
+
56
+ extra_rdoc_files:
57
+ - LICENSE
58
+ - README.rdoc
59
+ files:
60
+ - LICENSE
61
+ - README.rdoc
62
+ - Rakefile
63
+ - VERSION
64
+ - bin/zeddb
65
+ - lib/cli/config.rb
66
+ - lib/cli/model_associations.rb
67
+ - lib/cli/model_items.rb
68
+ - lib/cli/model_transformer.rb
69
+ - lib/cli/model_validations.rb
70
+ - lib/cli/models.rb
71
+ - lib/cli/projects.rb
72
+ - lib/cli/runner.rb
73
+ - lib/cli/text.rb
74
+ - lib/zeddb.rb
75
+ - lib/zeddb/instances/model.rb
76
+ - lib/zeddb/instances/model_item.rb
77
+ - lib/zeddb/instances/model_transformer.rb
78
+ - lib/zeddb/instances/model_validation.rb
79
+ - lib/zeddb/instances/project.rb
80
+ - lib/zeddb/resources/model_associations.rb
81
+ - lib/zeddb/resources/model_items.rb
82
+ - lib/zeddb/resources/model_transformers.rb
83
+ - lib/zeddb/resources/model_validations.rb
84
+ - lib/zeddb/resources/models.rb
85
+ - lib/zeddb/resources/projects.rb
86
+ - test/helper.rb
87
+ - test/test_associations.rb
88
+ - test/test_entities.rb
89
+ - test/test_model_items.rb
90
+ - test/test_models.rb
91
+ - test/test_projects.rb
92
+ - test/test_transformers.rb
93
+ - test/test_validations.rb
94
+ has_rdoc: true
95
+ homepage: http://github.com/zedkit/zeddb
96
+ licenses: []
97
+
98
+ post_install_message:
99
+ rdoc_options: []
100
+
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ segments:
109
+ - 0
110
+ version: "0"
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ none: false
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ segments:
117
+ - 0
118
+ version: "0"
119
+ requirements: []
120
+
121
+ rubyforge_project: zeddb
122
+ rubygems_version: 1.3.7
123
+ signing_key:
124
+ specification_version: 3
125
+ summary: gem to access ZedDB within Zedkit applications
126
+ test_files:
127
+ - test/helper.rb
128
+ - test/test_associations.rb
129
+ - test/test_entities.rb
130
+ - test/test_model_items.rb
131
+ - test/test_models.rb
132
+ - test/test_projects.rb
133
+ - test/test_transformers.rb
134
+ - test/test_validations.rb