usaidwat 1.1.1 → 1.2.0
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.
- checksums.yaml +4 -4
- data/Rakefile +7 -2
- data/features/fixtures/user_mipadi.json +16 -0
- data/features/fixtures/user_testuser.json +3 -0
- data/features/log.feature +485 -0
- data/features/step_definitions/reddit_steps.rb +1 -1
- data/features/tally.feature +117 -0
- data/features/user.feature +33 -0
- data/lib/usaidwat/application.rb +88 -18
- data/lib/usaidwat/client.rb +32 -1
- data/lib/usaidwat/either.rb +41 -0
- data/lib/usaidwat/ext/time.rb +55 -4
- data/lib/usaidwat/formatter.rb +38 -14
- data/lib/usaidwat/service.rb +17 -9
- data/lib/usaidwat/version.rb +1 -1
- data/spec/usaidwat/client_spec.rb +92 -6
- data/spec/usaidwat/either_spec.rb +52 -0
- data/spec/usaidwat/formatter_spec.rb +94 -1
- data/spec/usaidwat/time_spec.rb +165 -1
- data/usaidwat.gemspec +5 -3
- metadata +34 -21
- data/features/browse.feature +0 -361
data/features/browse.feature
DELETED
@@ -1,361 +0,0 @@
|
|
1
|
-
Feature: Browse comments
|
2
|
-
|
3
|
-
As a Redditor
|
4
|
-
I want to quickly be able to list another Redditor's comments
|
5
|
-
In order to see what they like to talk about
|
6
|
-
|
7
|
-
Scenario: List all comments
|
8
|
-
Given the Reddit service returns comments for the user "mipadi"
|
9
|
-
And time is frozen at Jun 24, 2015 11:05 AM
|
10
|
-
When I run `usaidwat log mipadi`
|
11
|
-
Then it should pass with:
|
12
|
-
"""
|
13
|
-
wikipedia
|
14
|
-
http://www.reddit.com/r/wikipedia/comments/142t4w/z/c79peed
|
15
|
-
Heisenbug: a software bug that seems to disappear or alter its behavior when one
|
16
|
-
over 3 years ago
|
17
|
-
|
18
|
-
Yep. My first experience with a Heisenbug occurred in a C++ program, and disappeared when I tried to print a variable with printf (only to reappear when that call was removed).
|
19
|
-
|
20
|
-
|
21
|
-
nyc
|
22
|
-
http://www.reddit.com/r/nyc/comments/141zqc/z/c79dxg6
|
23
|
-
NYC taxi roof lights get overhaul - A light simply will mean the cab is availab
|
24
|
-
over 3 years ago
|
25
|
-
|
26
|
-
It has a fare when the lights are off.
|
27
|
-
|
28
|
-
|
29
|
-
worldnews
|
30
|
-
http://www.reddit.com/r/worldnews/comments/140mra/z/c797jq4
|
31
|
-
Palestinians win upgraded UN status by wide margin
|
32
|
-
over 3 years ago
|
33
|
-
|
34
|
-
The Judgment of Solomon Accords.
|
35
|
-
"""
|
36
|
-
|
37
|
-
Scenario: List all comments with comment bodies unformatted
|
38
|
-
Given the Reddit service returns comments for the user "mipadi"
|
39
|
-
And time is frozen at Jun 24, 2015 11:05 AM
|
40
|
-
When I run `usaidwat log --raw mipadi`
|
41
|
-
Then it should pass with:
|
42
|
-
"""
|
43
|
-
wikipedia
|
44
|
-
http://www.reddit.com/r/wikipedia/comments/142t4w/z/c79peed
|
45
|
-
Heisenbug: a software bug that seems to disappear or alter its behavior when one
|
46
|
-
over 3 years ago
|
47
|
-
|
48
|
-
Yep. My first experience with a Heisenbug occurred in a C++ program, and disappeared when I tried to print a variable with printf (only to reappear when that call was removed).
|
49
|
-
|
50
|
-
|
51
|
-
nyc
|
52
|
-
http://www.reddit.com/r/nyc/comments/141zqc/z/c79dxg6
|
53
|
-
NYC taxi roof lights get overhaul - A light simply will mean the cab is availab
|
54
|
-
over 3 years ago
|
55
|
-
|
56
|
-
It has a fare when the lights are *off.*
|
57
|
-
|
58
|
-
|
59
|
-
worldnews
|
60
|
-
http://www.reddit.com/r/worldnews/comments/140mra/z/c797jq4
|
61
|
-
Palestinians win upgraded UN status by wide margin
|
62
|
-
over 3 years ago
|
63
|
-
|
64
|
-
The Judgment of Solomon Accords.
|
65
|
-
"""
|
66
|
-
|
67
|
-
Scenario: Output comments on line line
|
68
|
-
Given the Reddit service returns comments for the user "mipadi"
|
69
|
-
And time is frozen at Jun 24, 2015 11:05 AM
|
70
|
-
When I run `usaidwat log --oneline mipadi`
|
71
|
-
Then it should pass with:
|
72
|
-
"""
|
73
|
-
wikipedia Heisenbug: a software bug that seems to disappear or alter its behavio
|
74
|
-
nyc NYC taxi roof lights get overhaul - A light simply will mean the cab is ava
|
75
|
-
worldnews Palestinians win upgraded UN status by wide margin
|
76
|
-
"""
|
77
|
-
|
78
|
-
Scenario: Search for a specific comment
|
79
|
-
Given the Reddit service returns comments for the user "mipadi"
|
80
|
-
And time is frozen at Jun 24, 2015 11:05 AM
|
81
|
-
When I run `usaidwat log --grep='Heisenbug' mipadi`
|
82
|
-
Then it should pass with:
|
83
|
-
"""
|
84
|
-
wikipedia
|
85
|
-
http://www.reddit.com/r/wikipedia/comments/142t4w/z/c79peed
|
86
|
-
Heisenbug: a software bug that seems to disappear or alter its behavior when one
|
87
|
-
over 3 years ago
|
88
|
-
|
89
|
-
Yep. My first experience with a Heisenbug occurred in a C++ program, and disappeared when I tried to print a variable with printf (only to reappear when that call was removed).
|
90
|
-
"""
|
91
|
-
|
92
|
-
Scenario: Search for a specific comment with wrong case
|
93
|
-
Given the Reddit service returns comments for the user "mipadi"
|
94
|
-
And time is frozen at Jun 24, 2015 11:05 AM
|
95
|
-
When I run `usaidwat log --grep='heisenbug' mipadi`
|
96
|
-
Then it should pass with:
|
97
|
-
"""
|
98
|
-
wikipedia
|
99
|
-
http://www.reddit.com/r/wikipedia/comments/142t4w/z/c79peed
|
100
|
-
Heisenbug: a software bug that seems to disappear or alter its behavior when one
|
101
|
-
over 3 years ago
|
102
|
-
|
103
|
-
Yep. My first experience with a Heisenbug occurred in a C++ program, and disappeared when I tried to print a variable with printf (only to reappear when that call was removed).
|
104
|
-
"""
|
105
|
-
|
106
|
-
Scenario: Search for a specific comment with no matches
|
107
|
-
Given the Reddit service returns comments for the user "mipadi"
|
108
|
-
And time is frozen at Jun 24, 2015 11:05 AM
|
109
|
-
When I run `usaidwat log --grep='oogabooga' mipadi`
|
110
|
-
Then it should pass with:
|
111
|
-
"""
|
112
|
-
mipadi has no comments matching /oogabooga/.
|
113
|
-
"""
|
114
|
-
|
115
|
-
Scenario: List all comments for a user that does not exist
|
116
|
-
Given the Reddit service does not have a user "testuser"
|
117
|
-
When I run `usaidwat log testuser`
|
118
|
-
Then it should fail with:
|
119
|
-
"""
|
120
|
-
No such user: testuser
|
121
|
-
"""
|
122
|
-
|
123
|
-
Scenario: List all comments when user has no comments
|
124
|
-
Given the Reddit service returns comments for the user "blank"
|
125
|
-
When I run `usaidwat log blank`
|
126
|
-
Then it should pass with:
|
127
|
-
"""
|
128
|
-
blank has no comments.
|
129
|
-
"""
|
130
|
-
|
131
|
-
Scenario: Search for a comment for a user that does not exist
|
132
|
-
Given the Reddit service does not have a user "testuser"
|
133
|
-
When I run `usaidwat log --grep='Heisenbug' testuser`
|
134
|
-
Then it should fail with:
|
135
|
-
"""
|
136
|
-
No such user: testuser
|
137
|
-
"""
|
138
|
-
|
139
|
-
Scenario: Search for a comment when user has no comments
|
140
|
-
Given the Reddit service returns comments for the user "blank"
|
141
|
-
When I run `usaidwat log --grep='Heisenbug' blank`
|
142
|
-
Then it should pass with:
|
143
|
-
"""
|
144
|
-
blank has no comments matching /Heisenbug/.
|
145
|
-
"""
|
146
|
-
|
147
|
-
Scenario: Tally comments
|
148
|
-
Given the Reddit service returns comments for the user "mipadi"
|
149
|
-
When I run `usaidwat tally mipadi`
|
150
|
-
Then it should pass with:
|
151
|
-
"""
|
152
|
-
apple 6
|
153
|
-
AskReddit 61
|
154
|
-
battlefield3 2
|
155
|
-
books 2
|
156
|
-
django 1
|
157
|
-
Games 1
|
158
|
-
nyc 1
|
159
|
-
personalfinance 1
|
160
|
-
photography 1
|
161
|
-
programming 20
|
162
|
-
redditcasual 1
|
163
|
-
wikipedia 1
|
164
|
-
worldnews 2
|
165
|
-
"""
|
166
|
-
|
167
|
-
Scenario: Sort comments
|
168
|
-
Given the Reddit service returns comments for the user "mipadi"
|
169
|
-
When I run `usaidwat tally -c mipadi`
|
170
|
-
Then it should pass with:
|
171
|
-
"""
|
172
|
-
AskReddit 61
|
173
|
-
programming 20
|
174
|
-
apple 6
|
175
|
-
battlefield3 2
|
176
|
-
books 2
|
177
|
-
worldnews 2
|
178
|
-
django 1
|
179
|
-
Games 1
|
180
|
-
nyc 1
|
181
|
-
personalfinance 1
|
182
|
-
photography 1
|
183
|
-
redditcasual 1
|
184
|
-
wikipedia 1
|
185
|
-
"""
|
186
|
-
|
187
|
-
Scenario: Tally comments when user has no comments
|
188
|
-
Given the Reddit service returns comments for the user "blank"
|
189
|
-
When I run `usaidwat tally -c blank`
|
190
|
-
Then it should pass with:
|
191
|
-
"""
|
192
|
-
blank has no comments.
|
193
|
-
"""
|
194
|
-
|
195
|
-
Scenario: Sort comments when user has no comments
|
196
|
-
Given the Reddit service returns comments for the user "blank"
|
197
|
-
When I run `usaidwat tally -c blank`
|
198
|
-
Then it should pass with:
|
199
|
-
"""
|
200
|
-
blank has no comments.
|
201
|
-
"""
|
202
|
-
|
203
|
-
Scenario: Search for a comment when tallying
|
204
|
-
Given the Reddit service returns comments for the user "mipadi"
|
205
|
-
When I run `usaidwat tally --grep='Heisenbug' mipadi`
|
206
|
-
Then it should fail with:
|
207
|
-
"""
|
208
|
-
invalid option: --grep=Heisenbug
|
209
|
-
"""
|
210
|
-
|
211
|
-
Scenario: Search for a comment when sorting
|
212
|
-
Given the Reddit service returns comments for the user "mipadi"
|
213
|
-
When I run `usaidwat tally -c --grep='Heisenbug' mipadi`
|
214
|
-
Then it should fail with:
|
215
|
-
"""
|
216
|
-
invalid option: --grep=Heisenbug
|
217
|
-
"""
|
218
|
-
|
219
|
-
Scenario: Sort comments when a user does not exist
|
220
|
-
Given the Reddit service does not have a user "testuser"
|
221
|
-
When I run `usaidwat tally testuser`
|
222
|
-
Then it should fail with:
|
223
|
-
"""
|
224
|
-
No such user: testuser
|
225
|
-
"""
|
226
|
-
|
227
|
-
Scenario: List comments for a particular subreddit
|
228
|
-
Given the Reddit service returns comments for the user "mipadi"
|
229
|
-
And time is frozen at Jun 24, 2015 11:05 AM
|
230
|
-
When I run `usaidwat log mipadi AskReddit`
|
231
|
-
Then it should pass with:
|
232
|
-
"""
|
233
|
-
AskReddit
|
234
|
-
http://www.reddit.com/r/AskReddit/comments/141kt9/z/c795rwz
|
235
|
-
Do colleges actually teach students how to think critically? Or even to think/qu
|
236
|
-
over 3 years ago
|
237
|
-
|
238
|
-
I think it depends on where you go and what you study, but yes, I think they do teach you to think critically, especially in humanities courses and seminars. Maybe it's just because I went to a small, private liberal arts college rather than a huge school, but critical thinking was definitely a part of my education.
|
239
|
-
|
240
|
-
|
241
|
-
AskReddit
|
242
|
-
http://www.reddit.com/r/AskReddit/comments/140t5c/z/c795nw3
|
243
|
-
I'm from Tennessee and most of our jokes are geared toward Mississippi and Alaba
|
244
|
-
over 3 years ago
|
245
|
-
|
246
|
-
You're from New Jersey? Which exit?
|
247
|
-
|
248
|
-
|
249
|
-
AskReddit
|
250
|
-
http://www.reddit.com/r/AskReddit/comments/140h3z/z/c795muo
|
251
|
-
Today I was going 80mph in a 55 when an unmarked police car pulled up next to me
|
252
|
-
over 3 years ago
|
253
|
-
|
254
|
-
You didn't slow down for very long though, did you?
|
255
|
-
"""
|
256
|
-
|
257
|
-
Scenario: Search in comments for a particular subreddit
|
258
|
-
Given the Reddit service returns comments for the user "mipadi"
|
259
|
-
And time is frozen at Jun 24, 2015 11:05 AM
|
260
|
-
When I run `usaidwat log --grep='New Jersey' mipadi AskReddit`
|
261
|
-
Then it should pass with:
|
262
|
-
"""
|
263
|
-
AskReddit
|
264
|
-
http://www.reddit.com/r/AskReddit/comments/140t5c/z/c795nw3
|
265
|
-
I'm from Tennessee and most of our jokes are geared toward Mississippi and Alaba
|
266
|
-
over 3 years ago
|
267
|
-
|
268
|
-
You're from New Jersey? Which exit?
|
269
|
-
"""
|
270
|
-
|
271
|
-
Scenario: Search in comments for a particular subreddit with wrong case
|
272
|
-
Given the Reddit service returns comments for the user "mipadi"
|
273
|
-
And time is frozen at Jun 24, 2015 11:05 AM
|
274
|
-
When I run `usaidwat log --grep='new jersey' mipadi AskReddit`
|
275
|
-
Then it should pass with:
|
276
|
-
"""
|
277
|
-
AskReddit
|
278
|
-
http://www.reddit.com/r/AskReddit/comments/140t5c/z/c795nw3
|
279
|
-
I'm from Tennessee and most of our jokes are geared toward Mississippi and Alaba
|
280
|
-
over 3 years ago
|
281
|
-
|
282
|
-
You're from New Jersey? Which exit?
|
283
|
-
"""
|
284
|
-
|
285
|
-
Scenario: List comments for a particular subreddit specified with the wrong case
|
286
|
-
Given the Reddit service returns comments for the user "mipadi"
|
287
|
-
And time is frozen at Jun 24, 2015 11:05 AM
|
288
|
-
When I run `usaidwat log mipadi askreddit`
|
289
|
-
Then it should pass with:
|
290
|
-
"""
|
291
|
-
AskReddit
|
292
|
-
http://www.reddit.com/r/AskReddit/comments/141kt9/z/c795rwz
|
293
|
-
Do colleges actually teach students how to think critically? Or even to think/qu
|
294
|
-
over 3 years ago
|
295
|
-
|
296
|
-
I think it depends on where you go and what you study, but yes, I think they do teach you to think critically, especially in humanities courses and seminars. Maybe it's just because I went to a small, private liberal arts college rather than a huge school, but critical thinking was definitely a part of my education.
|
297
|
-
|
298
|
-
|
299
|
-
AskReddit
|
300
|
-
http://www.reddit.com/r/AskReddit/comments/140t5c/z/c795nw3
|
301
|
-
I'm from Tennessee and most of our jokes are geared toward Mississippi and Alaba
|
302
|
-
over 3 years ago
|
303
|
-
|
304
|
-
You're from New Jersey? Which exit?
|
305
|
-
|
306
|
-
|
307
|
-
AskReddit
|
308
|
-
http://www.reddit.com/r/AskReddit/comments/140h3z/z/c795muo
|
309
|
-
Today I was going 80mph in a 55 when an unmarked police car pulled up next to me
|
310
|
-
over 3 years ago
|
311
|
-
|
312
|
-
You didn't slow down for very long though, did you?
|
313
|
-
"""
|
314
|
-
|
315
|
-
Scenario: List comments for a subreddit with no comments
|
316
|
-
Given the Reddit service returns comments for the user "mipadi"
|
317
|
-
When I run `usaidwat log mipadi nsfw`
|
318
|
-
Then it should pass with:
|
319
|
-
"""
|
320
|
-
No comments by mipadi for nsfw.
|
321
|
-
"""
|
322
|
-
|
323
|
-
Scenario: Tally comments with subreddit
|
324
|
-
Given the Reddit service returns comments for the user "mipadi"
|
325
|
-
When I run `usaidwat tally mipadi AskReddit`
|
326
|
-
Then it should fail with:
|
327
|
-
"""
|
328
|
-
You cannot specify a subreddit when tallying comments
|
329
|
-
"""
|
330
|
-
|
331
|
-
Scenario: Sort comments with subreddit
|
332
|
-
Given the Reddit service returns comments for the user "mipadi"
|
333
|
-
When I run `usaidwat tally -c mipadi AskReddit`
|
334
|
-
Then it should fail with:
|
335
|
-
"""
|
336
|
-
You cannot specify a subreddit when tallying comments
|
337
|
-
"""
|
338
|
-
|
339
|
-
Scenario: Pass no arguments when tallying
|
340
|
-
Given the Reddit service returns comments for the user "mipadi"
|
341
|
-
When I run `usaidwat tally`
|
342
|
-
Then it should fail with:
|
343
|
-
"""
|
344
|
-
You must specify a username
|
345
|
-
"""
|
346
|
-
|
347
|
-
Scenario: Pass no arguments when sorting
|
348
|
-
Given the Reddit service returns comments for the user "mipadi"
|
349
|
-
When I run `usaidwat tally -c`
|
350
|
-
Then it should fail with:
|
351
|
-
"""
|
352
|
-
You must specify a username
|
353
|
-
"""
|
354
|
-
|
355
|
-
Scenario: Pass no arguments when searching
|
356
|
-
Given the Reddit service returns comments for the user "mipadi"
|
357
|
-
When I run `usaidwat log --grep mipadi`
|
358
|
-
Then it should fail with:
|
359
|
-
"""
|
360
|
-
You must specify a username
|
361
|
-
"""
|