couch_visible 0.0.2 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/features/couch_publish_integration.feature +39 -0
- data/features/hide.feature +3 -2
- data/features/show.feature +2 -2
- data/features/step_definitions/couch_publish_integration.rb +11 -0
- data/features/step_definitions/couch_publish_integration.rbc +328 -0
- data/features/step_definitions/hide_steps.rb +4 -4
- data/features/step_definitions/hide_steps.rbc +24 -45
- data/features/step_definitions/show_steps.rb +4 -4
- data/features/step_definitions/show_steps.rbc +18 -39
- data/features/support/env.rb +7 -1
- data/lib/couch_visible.rb +6 -0
- data/lib/couch_visible.rbc +54 -6
- data/lib/couch_visible/conditions/published.rb +9 -0
- data/lib/couch_visible/conditions/unpublished.rb +9 -0
- data/lib/couch_visible/couch_visible.rb +13 -14
- data/lib/couch_visible/couch_visible.rbc +236 -218
- data/lib/couch_visible/integrations/couch_publish.rb +15 -0
- data/lib/couch_visible/maps/by_hidden.rb +16 -0
- data/lib/couch_visible/maps/by_hidden.rbc +305 -0
- data/lib/couch_visible/maps/by_shown.rb +15 -0
- data/lib/couch_visible/maps/by_shown.rbc +305 -0
- data/readme.markdown +93 -56
- metadata +38 -11
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.1.1
|
@@ -0,0 +1,39 @@
|
|
1
|
+
Feature: Integration with CouchPublish
|
2
|
+
Whenever I include CouchVisible into a model that already includes CouchPublish
|
3
|
+
Then I should be able to qualify my "(map|count)_by_(shown|hidden)" query proxies with "published" and "unpublished" modifiers
|
4
|
+
|
5
|
+
Scenario: Getting all published, shown documents
|
6
|
+
Given a model that includes CouchPublish and CouchVisible:
|
7
|
+
"""
|
8
|
+
class Query < CouchRest::Model::Base
|
9
|
+
include CouchPublish
|
10
|
+
include CouchVisible
|
11
|
+
end
|
12
|
+
"""
|
13
|
+
|
14
|
+
And two documents that are shown but not published:
|
15
|
+
"""
|
16
|
+
@shown_unpublished = [
|
17
|
+
Query.create.tap {|q| q.show!; q.save},
|
18
|
+
Query.create.tap {|q| q.show!; q.save}
|
19
|
+
]
|
20
|
+
"""
|
21
|
+
|
22
|
+
And three documents that are shown and published:
|
23
|
+
"""
|
24
|
+
@shown_published = [
|
25
|
+
Query.create.tap {|q| q.show!; q.publish!},
|
26
|
+
Query.create.tap {|q| q.show!; q.publish!},
|
27
|
+
Query.create.tap {|q| q.show!; q.publish!},
|
28
|
+
]
|
29
|
+
"""
|
30
|
+
|
31
|
+
Then "Query.map_by_shown.published.get!" should return the shown, published documents:
|
32
|
+
"""
|
33
|
+
Query.map_by_shown.published.get!.collect(&:id).sort.should == @shown_published.collect(&:id).sort
|
34
|
+
"""
|
35
|
+
|
36
|
+
Then "Query.map_by_shown.unpublished.get!" should return the shown, unpublished documents:
|
37
|
+
"""
|
38
|
+
Query.map_by_shown.unpublished.get!.collect(&:id).sort.should == @shown_unpublished.collect(&:id).sort
|
39
|
+
"""
|
data/features/hide.feature
CHANGED
@@ -16,14 +16,15 @@ Feature: Hiding a document
|
|
16
16
|
And I call the "hidden?" method on the document
|
17
17
|
Then I should get true
|
18
18
|
|
19
|
+
@focus
|
19
20
|
Scenario: Getting the list of all hidden documents
|
20
21
|
Given there are several hidden and visible documents
|
21
|
-
When I call the "
|
22
|
+
When I call the "map_by_hidden" method on my document model
|
22
23
|
Then I should receive the hidden documents
|
23
24
|
And I should not receive the shown documents
|
24
25
|
|
25
26
|
@focus
|
26
27
|
Scenario: Getting the count of all hidden documents
|
27
28
|
Given there are several hidden and visible documents
|
28
|
-
When I call the "
|
29
|
+
When I call the "count_by_hidden" method on my document model
|
29
30
|
Then I should receive the count of hidden documents
|
data/features/show.feature
CHANGED
@@ -18,12 +18,12 @@ Feature: Showing a document
|
|
18
18
|
|
19
19
|
Scenario: Getting the list of all shown documents
|
20
20
|
Given there are several hidden and visible documents
|
21
|
-
When I call the "
|
21
|
+
When I call the "map_by_shown" method
|
22
22
|
Then I should receive the shown documents
|
23
23
|
And I should not receive the hidden documents
|
24
24
|
|
25
25
|
@focus
|
26
26
|
Scenario: Getting the count of all shown documents
|
27
27
|
Given there are several hidden and visible documents
|
28
|
-
When I call the "
|
28
|
+
When I call the "count_by_shown" method on my document model
|
29
29
|
Then I should receive the count of shown documents
|
@@ -0,0 +1,328 @@
|
|
1
|
+
!RBIX
|
2
|
+
17831730954501249321
|
3
|
+
x
|
4
|
+
M
|
5
|
+
1
|
6
|
+
n
|
7
|
+
n
|
8
|
+
x
|
9
|
+
10
|
10
|
+
__script__
|
11
|
+
i
|
12
|
+
80
|
13
|
+
5
|
14
|
+
7
|
15
|
+
0
|
16
|
+
13
|
17
|
+
70
|
18
|
+
9
|
19
|
+
19
|
20
|
+
15
|
21
|
+
44
|
22
|
+
43
|
23
|
+
1
|
24
|
+
7
|
25
|
+
2
|
26
|
+
78
|
27
|
+
49
|
28
|
+
3
|
29
|
+
2
|
30
|
+
6
|
31
|
+
0
|
32
|
+
56
|
33
|
+
4
|
34
|
+
47
|
35
|
+
50
|
36
|
+
5
|
37
|
+
1
|
38
|
+
15
|
39
|
+
5
|
40
|
+
7
|
41
|
+
6
|
42
|
+
13
|
43
|
+
70
|
44
|
+
9
|
45
|
+
45
|
46
|
+
15
|
47
|
+
44
|
48
|
+
43
|
49
|
+
1
|
50
|
+
7
|
51
|
+
7
|
52
|
+
78
|
53
|
+
49
|
54
|
+
3
|
55
|
+
2
|
56
|
+
6
|
57
|
+
6
|
58
|
+
56
|
59
|
+
8
|
60
|
+
47
|
61
|
+
50
|
62
|
+
5
|
63
|
+
1
|
64
|
+
15
|
65
|
+
5
|
66
|
+
7
|
67
|
+
9
|
68
|
+
13
|
69
|
+
70
|
70
|
+
9
|
71
|
+
71
|
72
|
+
15
|
73
|
+
44
|
74
|
+
43
|
75
|
+
1
|
76
|
+
7
|
77
|
+
10
|
78
|
+
78
|
79
|
+
49
|
80
|
+
3
|
81
|
+
2
|
82
|
+
6
|
83
|
+
9
|
84
|
+
56
|
85
|
+
11
|
86
|
+
47
|
87
|
+
50
|
88
|
+
12
|
89
|
+
1
|
90
|
+
15
|
91
|
+
2
|
92
|
+
11
|
93
|
+
I
|
94
|
+
4
|
95
|
+
I
|
96
|
+
0
|
97
|
+
I
|
98
|
+
0
|
99
|
+
I
|
100
|
+
0
|
101
|
+
n
|
102
|
+
p
|
103
|
+
13
|
104
|
+
n
|
105
|
+
x
|
106
|
+
6
|
107
|
+
Regexp
|
108
|
+
s
|
109
|
+
27
|
110
|
+
^a model that includes .*:$
|
111
|
+
x
|
112
|
+
3
|
113
|
+
new
|
114
|
+
M
|
115
|
+
1
|
116
|
+
p
|
117
|
+
2
|
118
|
+
x
|
119
|
+
9
|
120
|
+
for_block
|
121
|
+
t
|
122
|
+
n
|
123
|
+
x
|
124
|
+
9
|
125
|
+
__block__
|
126
|
+
i
|
127
|
+
12
|
128
|
+
57
|
129
|
+
19
|
130
|
+
0
|
131
|
+
15
|
132
|
+
5
|
133
|
+
20
|
134
|
+
0
|
135
|
+
47
|
136
|
+
49
|
137
|
+
0
|
138
|
+
1
|
139
|
+
11
|
140
|
+
I
|
141
|
+
4
|
142
|
+
I
|
143
|
+
1
|
144
|
+
I
|
145
|
+
1
|
146
|
+
I
|
147
|
+
1
|
148
|
+
n
|
149
|
+
p
|
150
|
+
1
|
151
|
+
x
|
152
|
+
4
|
153
|
+
eval
|
154
|
+
p
|
155
|
+
5
|
156
|
+
I
|
157
|
+
0
|
158
|
+
I
|
159
|
+
1
|
160
|
+
I
|
161
|
+
4
|
162
|
+
I
|
163
|
+
2
|
164
|
+
I
|
165
|
+
c
|
166
|
+
x
|
167
|
+
95
|
168
|
+
/Users/mparker/work/github/couch_visible/features/step_definitions/couch_publish_integration.rb
|
169
|
+
p
|
170
|
+
1
|
171
|
+
x
|
172
|
+
6
|
173
|
+
string
|
174
|
+
x
|
175
|
+
5
|
176
|
+
Given
|
177
|
+
n
|
178
|
+
s
|
179
|
+
26
|
180
|
+
^.*documents that are .*:$
|
181
|
+
M
|
182
|
+
1
|
183
|
+
p
|
184
|
+
2
|
185
|
+
x
|
186
|
+
9
|
187
|
+
for_block
|
188
|
+
t
|
189
|
+
n
|
190
|
+
x
|
191
|
+
9
|
192
|
+
__block__
|
193
|
+
i
|
194
|
+
12
|
195
|
+
57
|
196
|
+
19
|
197
|
+
0
|
198
|
+
15
|
199
|
+
5
|
200
|
+
20
|
201
|
+
0
|
202
|
+
47
|
203
|
+
49
|
204
|
+
0
|
205
|
+
1
|
206
|
+
11
|
207
|
+
I
|
208
|
+
4
|
209
|
+
I
|
210
|
+
1
|
211
|
+
I
|
212
|
+
1
|
213
|
+
I
|
214
|
+
1
|
215
|
+
n
|
216
|
+
p
|
217
|
+
1
|
218
|
+
x
|
219
|
+
4
|
220
|
+
eval
|
221
|
+
p
|
222
|
+
5
|
223
|
+
I
|
224
|
+
0
|
225
|
+
I
|
226
|
+
5
|
227
|
+
I
|
228
|
+
4
|
229
|
+
I
|
230
|
+
6
|
231
|
+
I
|
232
|
+
c
|
233
|
+
x
|
234
|
+
95
|
235
|
+
/Users/mparker/work/github/couch_visible/features/step_definitions/couch_publish_integration.rb
|
236
|
+
p
|
237
|
+
1
|
238
|
+
x
|
239
|
+
6
|
240
|
+
string
|
241
|
+
n
|
242
|
+
s
|
243
|
+
21
|
244
|
+
^.* should return.*:$
|
245
|
+
M
|
246
|
+
1
|
247
|
+
p
|
248
|
+
2
|
249
|
+
x
|
250
|
+
9
|
251
|
+
for_block
|
252
|
+
t
|
253
|
+
n
|
254
|
+
x
|
255
|
+
9
|
256
|
+
__block__
|
257
|
+
i
|
258
|
+
12
|
259
|
+
57
|
260
|
+
19
|
261
|
+
0
|
262
|
+
15
|
263
|
+
5
|
264
|
+
20
|
265
|
+
0
|
266
|
+
47
|
267
|
+
49
|
268
|
+
0
|
269
|
+
1
|
270
|
+
11
|
271
|
+
I
|
272
|
+
4
|
273
|
+
I
|
274
|
+
1
|
275
|
+
I
|
276
|
+
1
|
277
|
+
I
|
278
|
+
1
|
279
|
+
n
|
280
|
+
p
|
281
|
+
1
|
282
|
+
x
|
283
|
+
4
|
284
|
+
eval
|
285
|
+
p
|
286
|
+
5
|
287
|
+
I
|
288
|
+
0
|
289
|
+
I
|
290
|
+
9
|
291
|
+
I
|
292
|
+
4
|
293
|
+
I
|
294
|
+
a
|
295
|
+
I
|
296
|
+
c
|
297
|
+
x
|
298
|
+
95
|
299
|
+
/Users/mparker/work/github/couch_visible/features/step_definitions/couch_publish_integration.rb
|
300
|
+
p
|
301
|
+
1
|
302
|
+
x
|
303
|
+
6
|
304
|
+
string
|
305
|
+
x
|
306
|
+
4
|
307
|
+
Then
|
308
|
+
p
|
309
|
+
7
|
310
|
+
I
|
311
|
+
0
|
312
|
+
I
|
313
|
+
1
|
314
|
+
I
|
315
|
+
1a
|
316
|
+
I
|
317
|
+
5
|
318
|
+
I
|
319
|
+
34
|
320
|
+
I
|
321
|
+
9
|
322
|
+
I
|
323
|
+
50
|
324
|
+
x
|
325
|
+
95
|
326
|
+
/Users/mparker/work/github/couch_visible/features/step_definitions/couch_publish_integration.rb
|
327
|
+
p
|
328
|
+
0
|
@@ -34,8 +34,8 @@ Given /^there are several hidden and visible documents$/ do
|
|
34
34
|
10.times { @shown_documents << TestDoc.new.tap {|d| d.show!; d.save} }
|
35
35
|
end
|
36
36
|
|
37
|
-
When /^I call the "
|
38
|
-
@result = TestDoc.
|
37
|
+
When /^I call the "map_by_hidden" method on my document model$/ do
|
38
|
+
@result = TestDoc.map_by_hidden!
|
39
39
|
end
|
40
40
|
|
41
41
|
Then /^I should receive the hidden documents$/ do
|
@@ -49,8 +49,8 @@ Then /^I should not receive the shown documents$/ do
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
When /^I call the "
|
53
|
-
@result = TestDoc.
|
52
|
+
When /^I call the "count_by_hidden" method on my document model$/ do
|
53
|
+
@result = TestDoc.count_by_hidden.get!
|
54
54
|
end
|
55
55
|
|
56
56
|
Then /^I should receive the count of hidden documents$/ do
|
@@ -1324,8 +1324,8 @@ p
|
|
1324
1324
|
0
|
1325
1325
|
n
|
1326
1326
|
s
|
1327
|
-
|
1328
|
-
^I call the "
|
1327
|
+
56
|
1328
|
+
^I call the "map_by_hidden" method on my document model$
|
1329
1329
|
M
|
1330
1330
|
1
|
1331
1331
|
p
|
@@ -1339,33 +1339,18 @@ x
|
|
1339
1339
|
9
|
1340
1340
|
__block__
|
1341
1341
|
i
|
1342
|
-
|
1342
|
+
9
|
1343
1343
|
45
|
1344
1344
|
0
|
1345
1345
|
1
|
1346
|
-
44
|
1347
|
-
43
|
1348
|
-
2
|
1349
|
-
79
|
1350
|
-
49
|
1351
|
-
3
|
1352
|
-
1
|
1353
|
-
13
|
1354
|
-
7
|
1355
|
-
4
|
1356
|
-
3
|
1357
1346
|
49
|
1358
|
-
5
|
1359
1347
|
2
|
1360
|
-
|
1361
|
-
49
|
1362
|
-
6
|
1363
|
-
1
|
1348
|
+
0
|
1364
1349
|
38
|
1365
|
-
|
1350
|
+
3
|
1366
1351
|
11
|
1367
1352
|
I
|
1368
|
-
|
1353
|
+
2
|
1369
1354
|
I
|
1370
1355
|
0
|
1371
1356
|
I
|
@@ -1375,26 +1360,14 @@ I
|
|
1375
1360
|
I
|
1376
1361
|
-2
|
1377
1362
|
p
|
1378
|
-
|
1363
|
+
4
|
1379
1364
|
x
|
1380
1365
|
7
|
1381
1366
|
TestDoc
|
1382
1367
|
n
|
1383
1368
|
x
|
1384
|
-
|
1385
|
-
|
1386
|
-
x
|
1387
|
-
16
|
1388
|
-
new_from_literal
|
1389
|
-
x
|
1390
|
-
6
|
1391
|
-
reduce
|
1392
|
-
x
|
1393
|
-
3
|
1394
|
-
[]=
|
1395
|
-
x
|
1396
|
-
9
|
1397
|
-
by_hidden
|
1369
|
+
14
|
1370
|
+
map_by_hidden!
|
1398
1371
|
x
|
1399
1372
|
7
|
1400
1373
|
@result
|
@@ -1405,7 +1378,7 @@ I
|
|
1405
1378
|
I
|
1406
1379
|
26
|
1407
1380
|
I
|
1408
|
-
|
1381
|
+
9
|
1409
1382
|
x
|
1410
1383
|
80
|
1411
1384
|
/Users/mparker/work/github/couch_visible/features/step_definitions/hide_steps.rb
|
@@ -1725,8 +1698,8 @@ p
|
|
1725
1698
|
0
|
1726
1699
|
n
|
1727
1700
|
s
|
1728
|
-
|
1729
|
-
^I call the "
|
1701
|
+
58
|
1702
|
+
^I call the "count_by_hidden" method on my document model$
|
1730
1703
|
M
|
1731
1704
|
1
|
1732
1705
|
p
|
@@ -1740,15 +1713,18 @@ x
|
|
1740
1713
|
9
|
1741
1714
|
__block__
|
1742
1715
|
i
|
1743
|
-
|
1716
|
+
12
|
1744
1717
|
45
|
1745
1718
|
0
|
1746
1719
|
1
|
1747
1720
|
49
|
1748
1721
|
2
|
1749
1722
|
0
|
1750
|
-
|
1723
|
+
49
|
1751
1724
|
3
|
1725
|
+
0
|
1726
|
+
38
|
1727
|
+
4
|
1752
1728
|
11
|
1753
1729
|
I
|
1754
1730
|
2
|
@@ -1761,14 +1737,17 @@ I
|
|
1761
1737
|
I
|
1762
1738
|
-2
|
1763
1739
|
p
|
1764
|
-
|
1740
|
+
5
|
1765
1741
|
x
|
1766
1742
|
7
|
1767
1743
|
TestDoc
|
1768
1744
|
n
|
1769
1745
|
x
|
1770
|
-
|
1771
|
-
|
1746
|
+
15
|
1747
|
+
count_by_hidden
|
1748
|
+
x
|
1749
|
+
4
|
1750
|
+
get!
|
1772
1751
|
x
|
1773
1752
|
7
|
1774
1753
|
@result
|
@@ -1779,7 +1758,7 @@ I
|
|
1779
1758
|
I
|
1780
1759
|
35
|
1781
1760
|
I
|
1782
|
-
|
1761
|
+
c
|
1783
1762
|
x
|
1784
1763
|
80
|
1785
1764
|
/Users/mparker/work/github/couch_visible/features/step_definitions/hide_steps.rb
|