couch_potato 0.7.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/.gitignore +1 -0
  2. data/.travis.yml +7 -3
  3. data/CHANGES.md +14 -0
  4. data/README.md +17 -12
  5. data/Rakefile +1 -17
  6. data/active_support_3_2 +7 -1
  7. data/active_support_4_0 +11 -0
  8. data/couch_potato.gemspec +2 -3
  9. data/lib/couch_potato/database.rb +0 -3
  10. data/lib/couch_potato/forbidden_attributes_protection.rb +15 -0
  11. data/lib/couch_potato/persistence/simple_property.rb +5 -1
  12. data/lib/couch_potato/persistence/type_caster.rb +2 -0
  13. data/lib/couch_potato/persistence.rb +9 -5
  14. data/lib/couch_potato/rspec/matchers/list_as_matcher.rb +1 -2
  15. data/lib/couch_potato/rspec/matchers/map_reduce_to_matcher.rb +114 -0
  16. data/lib/couch_potato/rspec/matchers/map_to_matcher.rb +1 -2
  17. data/lib/couch_potato/rspec/matchers/reduce_to_matcher.rb +7 -9
  18. data/lib/couch_potato/rspec/matchers.rb +23 -7
  19. data/lib/couch_potato/version.rb +1 -1
  20. data/lib/couch_potato/view/base_view_spec.rb +6 -2
  21. data/lib/couch_potato/view/custom_view_spec.rb +20 -19
  22. data/lib/couch_potato/view/model_view_spec.rb +10 -5
  23. data/lib/couch_potato/view/raw_view_spec.rb +2 -6
  24. data/lib/couch_potato.rb +1 -0
  25. data/spec/default_property_spec.rb +6 -0
  26. data/spec/property_spec.rb +13 -3
  27. data/spec/reload_spec.rb +14 -0
  28. data/spec/spec_helper.rb +6 -0
  29. data/spec/unit/base_view_spec_spec.rb +21 -14
  30. data/spec/unit/custom_view_spec_spec.rb +24 -0
  31. data/spec/unit/forbidden_attributes_protection_spec.rb +53 -0
  32. data/spec/unit/model_view_spec_spec.rb +24 -1
  33. data/spec/unit/persistence_spec.rb +40 -0
  34. data/spec/unit/rspec_matchers_spec.rb +126 -5
  35. data/spec/views_spec.rb +16 -10
  36. metadata +62 -35
  37. data/Gemfile.lock +0 -54
  38. data/active_support_3_0 +0 -4
  39. data/active_support_3_0.lock +0 -54
  40. data/active_support_3_1 +0 -4
  41. data/active_support_3_1.lock +0 -57
  42. data/active_support_3_2.lock +0 -55
  43. data/lib/couch_potato/rspec/matchers/print_r.js +0 -60
  44. data/rails/init.rb +0 -4
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couch_potato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-22 00:00:00.000000000 Z
12
+ date: 2013-05-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &70144114426360 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,21 +21,31 @@ dependencies:
21
21
  version: '1.6'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70144114426360
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.6'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: couchrest
27
- requirement: &70144114425700 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
- - - ! '>='
35
+ - - ~>
31
36
  - !ruby/object:Gem::Version
32
- version: 1.0.1
37
+ version: 1.2.0
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70144114425700
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.2.0
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: activemodel
38
- requirement: &70144114425020 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,21 +53,31 @@ dependencies:
43
53
  version: '0'
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70144114425020
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: rspec
49
- requirement: &70144114423960 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
- - - ! '>='
67
+ - - ~>
53
68
  - !ruby/object:Gem::Version
54
- version: '2.0'
69
+ version: 2.11.0
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *70144114423960
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 2.11.0
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: timecop
60
- requirement: &70144114423380 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: '0'
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *70144114423380
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: tzinfo
71
- requirement: &70144114422720 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ! '>='
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: '0'
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *70144114422720
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: rake
82
- requirement: &70144114422160 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ! '>='
@@ -87,18 +117,12 @@ dependencies:
87
117
  version: '0'
88
118
  type: :development
89
119
  prerelease: false
90
- version_requirements: *70144114422160
91
- - !ruby/object:Gem::Dependency
92
- name: therubyracer
93
- requirement: &70144114421380 !ruby/object:Gem::Requirement
120
+ version_requirements: !ruby/object:Gem::Requirement
94
121
  none: false
95
122
  requirements:
96
123
  - - ! '>='
97
124
  - !ruby/object:Gem::Version
98
125
  version: '0'
99
- type: :development
100
- prerelease: false
101
- version_requirements: *70144114421380
102
126
  description: Ruby persistence layer for CouchDB
103
127
  email: alex@upstre.am
104
128
  executables: []
@@ -110,22 +134,18 @@ files:
110
134
  - CHANGES.md
111
135
  - CREDITS
112
136
  - Gemfile
113
- - Gemfile.lock
114
137
  - MIT-LICENSE.txt
115
138
  - README.md
116
139
  - Rakefile
117
- - active_support_3_0
118
- - active_support_3_0.lock
119
- - active_support_3_1
120
- - active_support_3_1.lock
121
140
  - active_support_3_2
122
- - active_support_3_2.lock
141
+ - active_support_4_0
123
142
  - couch_potato.gemspec
124
143
  - init.rb
125
144
  - lib/core_ext/date.rb
126
145
  - lib/core_ext/time.rb
127
146
  - lib/couch_potato.rb
128
147
  - lib/couch_potato/database.rb
148
+ - lib/couch_potato/forbidden_attributes_protection.rb
129
149
  - lib/couch_potato/persistence.rb
130
150
  - lib/couch_potato/persistence/active_model_compliance.rb
131
151
  - lib/couch_potato/persistence/attachments.rb
@@ -142,8 +162,8 @@ files:
142
162
  - lib/couch_potato/rspec/matchers.rb
143
163
  - lib/couch_potato/rspec/matchers/json2.js
144
164
  - lib/couch_potato/rspec/matchers/list_as_matcher.rb
165
+ - lib/couch_potato/rspec/matchers/map_reduce_to_matcher.rb
145
166
  - lib/couch_potato/rspec/matchers/map_to_matcher.rb
146
- - lib/couch_potato/rspec/matchers/print_r.js
147
167
  - lib/couch_potato/rspec/matchers/reduce_to_matcher.rb
148
168
  - lib/couch_potato/rspec/stub_db.rb
149
169
  - lib/couch_potato/validation.rb
@@ -156,7 +176,6 @@ files:
156
176
  - lib/couch_potato/view/properties_view_spec.rb
157
177
  - lib/couch_potato/view/raw_view_spec.rb
158
178
  - lib/couch_potato/view/view_query.rb
159
- - rails/init.rb
160
179
  - rails/reload_classes.rb
161
180
  - spec/attachments_spec.rb
162
181
  - spec/callbacks_spec.rb
@@ -168,6 +187,7 @@ files:
168
187
  - spec/property_spec.rb
169
188
  - spec/rails_spec.rb
170
189
  - spec/railtie_spec.rb
190
+ - spec/reload_spec.rb
171
191
  - spec/spec.opts
172
192
  - spec/spec_helper.rb
173
193
  - spec/unit/active_model_compliance_spec.rb
@@ -176,14 +196,17 @@ files:
176
196
  - spec/unit/callbacks_spec.rb
177
197
  - spec/unit/couch_potato_spec.rb
178
198
  - spec/unit/create_spec.rb
199
+ - spec/unit/custom_view_spec_spec.rb
179
200
  - spec/unit/custom_views_spec.rb
180
201
  - spec/unit/database_spec.rb
181
202
  - spec/unit/date_spec.rb
182
203
  - spec/unit/dirty_attributes_spec.rb
204
+ - spec/unit/forbidden_attributes_protection_spec.rb
183
205
  - spec/unit/initialize_spec.rb
184
206
  - spec/unit/json_spec.rb
185
207
  - spec/unit/lists_spec.rb
186
208
  - spec/unit/model_view_spec_spec.rb
209
+ - spec/unit/persistence_spec.rb
187
210
  - spec/unit/properties_view_spec_spec.rb
188
211
  - spec/unit/rspec_matchers_spec.rb
189
212
  - spec/unit/rspec_stub_db_spec.rb
@@ -214,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
237
  version: '0'
215
238
  requirements: []
216
239
  rubyforge_project:
217
- rubygems_version: 1.8.11
240
+ rubygems_version: 1.8.24
218
241
  signing_key:
219
242
  specification_version: 3
220
243
  summary: Ruby persistence layer for CouchDB
@@ -229,6 +252,7 @@ test_files:
229
252
  - spec/property_spec.rb
230
253
  - spec/rails_spec.rb
231
254
  - spec/railtie_spec.rb
255
+ - spec/reload_spec.rb
232
256
  - spec/spec.opts
233
257
  - spec/spec_helper.rb
234
258
  - spec/unit/active_model_compliance_spec.rb
@@ -237,14 +261,17 @@ test_files:
237
261
  - spec/unit/callbacks_spec.rb
238
262
  - spec/unit/couch_potato_spec.rb
239
263
  - spec/unit/create_spec.rb
264
+ - spec/unit/custom_view_spec_spec.rb
240
265
  - spec/unit/custom_views_spec.rb
241
266
  - spec/unit/database_spec.rb
242
267
  - spec/unit/date_spec.rb
243
268
  - spec/unit/dirty_attributes_spec.rb
269
+ - spec/unit/forbidden_attributes_protection_spec.rb
244
270
  - spec/unit/initialize_spec.rb
245
271
  - spec/unit/json_spec.rb
246
272
  - spec/unit/lists_spec.rb
247
273
  - spec/unit/model_view_spec_spec.rb
274
+ - spec/unit/persistence_spec.rb
248
275
  - spec/unit/properties_view_spec_spec.rb
249
276
  - spec/unit/rspec_matchers_spec.rb
250
277
  - spec/unit/rspec_stub_db_spec.rb
data/Gemfile.lock DELETED
@@ -1,54 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- couch_potato (0.7.0)
5
- activemodel
6
- couchrest (>= 1.0.1)
7
- json (~> 1.6)
8
-
9
- GEM
10
- remote: http://rubygems.org/
11
- specs:
12
- activemodel (3.2.8)
13
- activesupport (= 3.2.8)
14
- builder (~> 3.0.0)
15
- activesupport (3.2.8)
16
- i18n (~> 0.6)
17
- multi_json (~> 1.0)
18
- builder (3.0.0)
19
- couchrest (1.1.3)
20
- mime-types (~> 1.15)
21
- multi_json (~> 1.0)
22
- rest-client (~> 1.6.1)
23
- diff-lcs (1.1.3)
24
- i18n (0.6.0)
25
- json (1.7.5)
26
- libv8 (3.3.10.4)
27
- mime-types (1.19)
28
- multi_json (1.3.6)
29
- rake (0.9.2.2)
30
- rest-client (1.6.7)
31
- mime-types (>= 1.16)
32
- rspec (2.11.0)
33
- rspec-core (~> 2.11.0)
34
- rspec-expectations (~> 2.11.0)
35
- rspec-mocks (~> 2.11.0)
36
- rspec-core (2.11.1)
37
- rspec-expectations (2.11.2)
38
- diff-lcs (~> 1.1.3)
39
- rspec-mocks (2.11.2)
40
- therubyracer (0.10.2)
41
- libv8 (~> 3.3.10)
42
- timecop (0.4.5)
43
- tzinfo (0.3.33)
44
-
45
- PLATFORMS
46
- ruby
47
-
48
- DEPENDENCIES
49
- couch_potato!
50
- rake
51
- rspec (>= 2.0)
52
- therubyracer
53
- timecop
54
- tzinfo
data/active_support_3_0 DELETED
@@ -1,4 +0,0 @@
1
- source :rubygems
2
-
3
- gem 'activemodel', '~>3.0'
4
- gemspec
@@ -1,54 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- couch_potato (0.7.0)
5
- activemodel
6
- couchrest (>= 1.0.1)
7
- json (~> 1.6)
8
-
9
- GEM
10
- remote: http://rubygems.org/
11
- specs:
12
- activemodel (3.0.6)
13
- activesupport (= 3.0.6)
14
- builder (~> 2.1.2)
15
- i18n (~> 0.5.0)
16
- activesupport (3.0.6)
17
- builder (2.1.2)
18
- couchrest (1.1.3)
19
- mime-types (~> 1.15)
20
- multi_json (~> 1.0)
21
- rest-client (~> 1.6.1)
22
- diff-lcs (1.1.2)
23
- i18n (0.5.0)
24
- json (1.7.5)
25
- libv8 (3.3.10.4)
26
- mime-types (1.19)
27
- multi_json (1.3.6)
28
- rake (0.8.7)
29
- rest-client (1.6.7)
30
- mime-types (>= 1.16)
31
- rspec (2.5.0)
32
- rspec-core (~> 2.5.0)
33
- rspec-expectations (~> 2.5.0)
34
- rspec-mocks (~> 2.5.0)
35
- rspec-core (2.5.1)
36
- rspec-expectations (2.5.0)
37
- diff-lcs (~> 1.1.2)
38
- rspec-mocks (2.5.0)
39
- therubyracer (0.10.1)
40
- libv8 (~> 3.3.10)
41
- timecop (0.3.5)
42
- tzinfo (0.3.26)
43
-
44
- PLATFORMS
45
- ruby
46
-
47
- DEPENDENCIES
48
- activemodel (~> 3.0)
49
- couch_potato!
50
- rake
51
- rspec (>= 2.0)
52
- therubyracer
53
- timecop
54
- tzinfo
data/active_support_3_1 DELETED
@@ -1,4 +0,0 @@
1
- source :rubygems
2
-
3
- gem "activemodel", "~> 3.1.0"
4
- gemspec
@@ -1,57 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- couch_potato (0.7.0)
5
- activemodel
6
- couchrest (>= 1.0.1)
7
- json (~> 1.6)
8
-
9
- GEM
10
- remote: http://rubygems.org/
11
- specs:
12
- activemodel (3.1.0)
13
- activesupport (= 3.1.0)
14
- bcrypt-ruby (~> 3.0.0)
15
- builder (~> 3.0.0)
16
- i18n (~> 0.6)
17
- activesupport (3.1.0)
18
- multi_json (~> 1.0)
19
- bcrypt-ruby (3.0.1)
20
- builder (3.0.0)
21
- couchrest (1.1.3)
22
- mime-types (~> 1.15)
23
- multi_json (~> 1.0)
24
- rest-client (~> 1.6.1)
25
- diff-lcs (1.1.2)
26
- i18n (0.6.0)
27
- json (1.7.5)
28
- libv8 (3.3.10.4)
29
- mime-types (1.19)
30
- multi_json (1.0.3)
31
- rake (0.9.2)
32
- rest-client (1.6.7)
33
- mime-types (>= 1.16)
34
- rspec (2.6.0)
35
- rspec-core (~> 2.6.0)
36
- rspec-expectations (~> 2.6.0)
37
- rspec-mocks (~> 2.6.0)
38
- rspec-core (2.6.4)
39
- rspec-expectations (2.6.0)
40
- diff-lcs (~> 1.1.2)
41
- rspec-mocks (2.6.0)
42
- therubyracer (0.10.1)
43
- libv8 (~> 3.3.10)
44
- timecop (0.3.5)
45
- tzinfo (0.3.29)
46
-
47
- PLATFORMS
48
- ruby
49
-
50
- DEPENDENCIES
51
- activemodel (~> 3.1.0)
52
- couch_potato!
53
- rake
54
- rspec (>= 2.0)
55
- therubyracer
56
- timecop
57
- tzinfo
@@ -1,55 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- couch_potato (0.7.0)
5
- activemodel
6
- couchrest (>= 1.0.1)
7
- json (~> 1.6)
8
-
9
- GEM
10
- remote: http://rubygems.org/
11
- specs:
12
- activemodel (3.2.1)
13
- activesupport (= 3.2.1)
14
- builder (~> 3.0.0)
15
- activesupport (3.2.1)
16
- i18n (~> 0.6)
17
- multi_json (~> 1.0)
18
- builder (3.0.0)
19
- couchrest (1.1.3)
20
- mime-types (~> 1.15)
21
- multi_json (~> 1.0)
22
- rest-client (~> 1.6.1)
23
- diff-lcs (1.1.3)
24
- i18n (0.6.0)
25
- json (1.7.5)
26
- libv8 (3.3.10.4)
27
- mime-types (1.19)
28
- multi_json (1.0.4)
29
- rake (0.9.2.2)
30
- rest-client (1.6.7)
31
- mime-types (>= 1.16)
32
- rspec (2.8.0)
33
- rspec-core (~> 2.8.0)
34
- rspec-expectations (~> 2.8.0)
35
- rspec-mocks (~> 2.8.0)
36
- rspec-core (2.8.0)
37
- rspec-expectations (2.8.0)
38
- diff-lcs (~> 1.1.2)
39
- rspec-mocks (2.8.0)
40
- therubyracer (0.10.1)
41
- libv8 (~> 3.3.10)
42
- timecop (0.3.5)
43
- tzinfo (0.3.31)
44
-
45
- PLATFORMS
46
- ruby
47
-
48
- DEPENDENCIES
49
- activemodel (~> 3.2)
50
- couch_potato!
51
- rake
52
- rspec (>= 2.0)
53
- therubyracer
54
- timecop
55
- tzinfo
@@ -1,60 +0,0 @@
1
- // taken and adapted from http://scriptnode.com/article/javascript-print_r-or-var_dump-equivalent/
2
-
3
- /**
4
- * Concatenates the values of a variable into an easily readable string
5
- * by Matt Hackett [scriptnode.com]
6
- * @param {Object} x The variable to debug
7
- * @param {Number} max The maximum number of recursions allowed (keep low, around 5 for HTML elements to prevent errors) [default: 10]
8
- * @param {String} sep The separator to use between [default: a single space ' ']
9
- * @param {Number} l The current level deep (amount of recursion). Do not use this parameter: it's for the function's own use
10
- */
11
- function print_r(x, max, sep, l) {
12
-
13
- l = l || 0;
14
- max = max || 10;
15
- sep = sep || ' ';
16
-
17
- if (l > max) {
18
- throw("Too much recursion");
19
- };
20
-
21
- var r = '';
22
-
23
- if (x === null) {
24
- r += "null";
25
- } else if (is_array(x)) {
26
- r += '[' + x.map(function(i) {
27
- return print_r(i, max, sep, (l + 1));
28
- }).join(', ') + ']';
29
- } else if(is_object(x)) {
30
- r += '{'
31
- var pairs = [];
32
- for (i in x) {
33
- pairs.push('"' + i + '": ' + print_r(x[i], max, sep, (l + 1)));
34
- }
35
- r += pairs.join(', ');
36
- r += '}';
37
- } else if(is_string(x)) {
38
- r += '"' + x + "\"";
39
- } else {
40
- r += x;
41
- };
42
-
43
- return r;
44
-
45
- function is_string(a) {
46
- return typeof a === 'string';
47
- };
48
-
49
- function is_array(a) {
50
- return (a &&
51
- typeof a === 'object' &&
52
- a.constructor === Array);
53
- };
54
-
55
- function is_object(a) {
56
- return a && typeof a == 'object'
57
- };
58
-
59
- };
60
-
data/rails/init.rb DELETED
@@ -1,4 +0,0 @@
1
- # this is for rails only
2
-
3
- require File.expand_path(File.dirname(__FILE__) + '/../lib/couch_potato')
4
- Rails.logger.info "** couch_potato: initialized from #{__FILE__}"