dao 2.1.0 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -0
- data/TODO +39 -0
- data/dao.gemspec +4 -4
- data/lib/dao.rb +8 -4
- data/lib/dao/active_record.rb +46 -4
- data/lib/dao/api/interfaces.rb +19 -4
- data/lib/dao/data.rb +3 -53
- data/lib/dao/errors.rb +26 -19
- data/lib/dao/exceptions.rb +23 -1
- data/lib/dao/form.rb +55 -11
- data/lib/dao/params.rb +41 -51
- data/lib/dao/presenter.rb +129 -0
- data/lib/dao/rails.rb +49 -1
- data/lib/dao/rails/lib/generators/dao/dao_generator.rb +1 -2
- data/lib/dao/rails/lib/generators/dao/templates/api.rb +1 -1
- data/lib/dao/rails/lib/generators/dao/templates/api_controller.rb +25 -31
- data/lib/dao/rails/lib/generators/dao/templates/dao.js +34 -25
- data/lib/dao/rails/lib/generators/dao/templates/dao_helper.rb +2 -1
- data/lib/dao/result.rb +27 -2
- data/lib/dao/status.rb +10 -2
- data/lib/dao/support.rb +1 -1
- data/lib/dao/validations.rb +143 -8
- data/test/dao_test.rb +56 -1
- metadata +15 -13
data/test/dao_test.rb
CHANGED
@@ -150,6 +150,61 @@ Testing Dao do
|
|
150
150
|
}
|
151
151
|
end
|
152
152
|
|
153
|
+
testing 'that parsing folds in top level keys by default' do
|
154
|
+
params = {
|
155
|
+
'key(a)' => 40,
|
156
|
+
'key(b)' => 2,
|
157
|
+
'a' => 'clobbered',
|
158
|
+
'b' => 'clobbered',
|
159
|
+
'c' => 42
|
160
|
+
}
|
161
|
+
parsed = Dao.parse(:key, params)
|
162
|
+
expected = {'a' => 40, 'b' => 2, 'c' => 42}
|
163
|
+
assert{ parsed =~ expected }
|
164
|
+
end
|
165
|
+
|
166
|
+
testing 'that parsing can have folding turned off' do
|
167
|
+
params = {
|
168
|
+
'key(a)' => 40,
|
169
|
+
'key(b)' => 2,
|
170
|
+
'a' => 'clobbered',
|
171
|
+
'b' => 'clobbered',
|
172
|
+
'c' => 42
|
173
|
+
}
|
174
|
+
parsed = Dao.parse(:key, params, :fold => false)
|
175
|
+
expected = {'a' => 40, 'b' => 2}
|
176
|
+
assert{ parsed =~ expected }
|
177
|
+
end
|
178
|
+
|
179
|
+
testing 'that parse folding can be white list-ly selective' do
|
180
|
+
params = {
|
181
|
+
'key(a)' => 40,
|
182
|
+
'key(b)' => 2,
|
183
|
+
'a' => 'clobbered',
|
184
|
+
'b' => 'clobbered',
|
185
|
+
'c' => 42,
|
186
|
+
'd' => 'not included...'
|
187
|
+
}
|
188
|
+
parsed = Dao.parse(:key, params, :include => [:c])
|
189
|
+
expected = {'a' => 40, 'b' => 2, 'c' => 42}
|
190
|
+
assert{ parsed =~ expected }
|
191
|
+
end
|
192
|
+
|
193
|
+
testing 'that parse folding can be black list-ly selective' do
|
194
|
+
params = {
|
195
|
+
'key(a)' => 40,
|
196
|
+
'key(b)' => 2,
|
197
|
+
'a' => 'clobbered',
|
198
|
+
'b' => 'clobbered',
|
199
|
+
'c' => 42,
|
200
|
+
'd' => 'rejected...',
|
201
|
+
'e' => 'rejected...'
|
202
|
+
}
|
203
|
+
parsed = Dao.parse(:key, params, :except => [:d, :e])
|
204
|
+
expected = {'a' => 40, 'b' => 2, 'c' => 42}
|
205
|
+
assert{ parsed =~ expected }
|
206
|
+
end
|
207
|
+
|
153
208
|
# errors.rb
|
154
209
|
#
|
155
210
|
testing 'that clear does not drop sticky errors' do
|
@@ -219,7 +274,7 @@ Testing Dao do
|
|
219
274
|
assert{ result.valid? }
|
220
275
|
|
221
276
|
data.set(:password => 'haxor')
|
222
|
-
assert{ !result.valid? }
|
277
|
+
assert{ !result.valid?(:validate => true) }
|
223
278
|
|
224
279
|
errors.add(:name, 'ara')
|
225
280
|
assert{ not result.valid? }
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dao
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 2.
|
8
|
+
- 2
|
9
|
+
- 3
|
10
|
+
version: 2.2.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ara T. Howard
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-04-15 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -42,12 +42,12 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
45
|
+
hash: 19
|
46
46
|
segments:
|
47
47
|
- 2
|
48
|
-
-
|
49
|
-
-
|
50
|
-
version: 2.
|
48
|
+
- 7
|
49
|
+
- 0
|
50
|
+
version: 2.7.0
|
51
51
|
type: :runtime
|
52
52
|
version_requirements: *id002
|
53
53
|
- !ruby/object:Gem::Dependency
|
@@ -58,12 +58,12 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
hash:
|
61
|
+
hash: 61
|
62
62
|
segments:
|
63
63
|
- 0
|
64
|
-
-
|
65
|
-
-
|
66
|
-
version: 0.
|
64
|
+
- 8
|
65
|
+
- 1
|
66
|
+
version: 0.8.1
|
67
67
|
type: :runtime
|
68
68
|
version_requirements: *id003
|
69
69
|
description: "description: dao kicks the ass"
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- lib/dao/mongo_mapper.rb
|
99
99
|
- lib/dao/params.rb
|
100
100
|
- lib/dao/path.rb
|
101
|
+
- lib/dao/presenter.rb
|
101
102
|
- lib/dao/rails/app/api.rb
|
102
103
|
- lib/dao/rails/app/controllers/api_controller.rb
|
103
104
|
- lib/dao/rails/lib/generators/dao/api_generator.rb
|
@@ -169,6 +170,7 @@ files:
|
|
169
170
|
- test/dao_test.rb
|
170
171
|
- test/helper.rb
|
171
172
|
- test/testing.rb
|
173
|
+
- TODO
|
172
174
|
has_rdoc: true
|
173
175
|
homepage: http://github.com/ahoward/dao
|
174
176
|
licenses: []
|