friends 0.39 → 0.40

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Friends
4
- VERSION = "0.39".freeze
4
+ VERSION = "0.40".freeze
5
5
  end
@@ -48,19 +48,19 @@ clean_describe "graph" do
48
48
 
49
49
  it "graphs all activities" do
50
50
  stdout_only <<-OUTPUT
51
- Nov 2014 |█
52
- Dec 2014 |█
53
- Jan 2015 |████
54
- Feb 2015 |
55
- Mar 2015 |
56
- Apr 2015 |
57
- May 2015 |
58
- Jun 2015 |
59
- Jul 2015 |
60
- Aug 2015 |
61
- Sep 2015 |
62
- Oct 2015 |
63
51
  Nov 2015 |█
52
+ Oct 2015 |
53
+ Sep 2015 |
54
+ Aug 2015 |
55
+ Jul 2015 |
56
+ Jun 2015 |
57
+ May 2015 |
58
+ Apr 2015 |
59
+ Mar 2015 |
60
+ Feb 2015 |
61
+ Jan 2015 |████
62
+ Dec 2014 |█
63
+ Nov 2014 |█
64
64
  OUTPUT
65
65
  end
66
66
 
@@ -88,19 +88,19 @@ Nov 2015 |█
88
88
  let(:location_name) { "paris" }
89
89
  it "matches location case-insensitively" do
90
90
  stdout_only <<-OUTPUT
91
- Nov 2014 |∙|
92
- Dec 2014 |█
93
- Jan 2015 |███∙|
94
- Feb 2015 |
95
- Mar 2015 |
96
- Apr 2015 |
97
- May 2015 |
98
- Jun 2015 |
99
- Jul 2015 |
100
- Aug 2015 |
101
- Sep 2015 |
102
- Oct 2015 |
103
91
  Nov 2015 |∙|
92
+ Oct 2015 |
93
+ Sep 2015 |
94
+ Aug 2015 |
95
+ Jul 2015 |
96
+ Jun 2015 |
97
+ May 2015 |
98
+ Apr 2015 |
99
+ Mar 2015 |
100
+ Feb 2015 |
101
+ Jan 2015 |███∙|
102
+ Dec 2014 |█
103
+ Nov 2014 |∙|
104
104
  OUTPUT
105
105
  end
106
106
  end
@@ -130,19 +130,19 @@ Nov 2015 |∙|
130
130
 
131
131
  it "matches friend case-insensitively" do
132
132
  stdout_only <<-OUTPUT
133
- Nov 2014 |█
134
- Dec 2014 |∙|
135
- Jan 2015 |█∙∙∙|
136
- Feb 2015 |
137
- Mar 2015 |
138
- Apr 2015 |
139
- May 2015 |
140
- Jun 2015 |
141
- Jul 2015 |
142
- Aug 2015 |
143
- Sep 2015 |
144
- Oct 2015 |
145
133
  Nov 2015 |∙|
134
+ Oct 2015 |
135
+ Sep 2015 |
136
+ Aug 2015 |
137
+ Jul 2015 |
138
+ Jun 2015 |
139
+ May 2015 |
140
+ Apr 2015 |
141
+ Mar 2015 |
142
+ Feb 2015 |
143
+ Jan 2015 |█∙∙∙|
144
+ Dec 2014 |∙|
145
+ Nov 2014 |█
146
146
  OUTPUT
147
147
  end
148
148
  end
@@ -154,19 +154,19 @@ Nov 2015 |∙|
154
154
 
155
155
  it "matches all friends case-insensitively" do
156
156
  stdout_only <<-OUTPUT
157
- Nov 2014 |∙|
158
- Dec 2014 |∙|
159
- Jan 2015 |█∙∙∙|
160
- Feb 2015 |
161
- Mar 2015 |
162
- Apr 2015 |
163
- May 2015 |
164
- Jun 2015 |
165
- Jul 2015 |
166
- Aug 2015 |
167
- Sep 2015 |
168
- Oct 2015 |
169
157
  Nov 2015 |∙|
158
+ Oct 2015 |
159
+ Sep 2015 |
160
+ Aug 2015 |
161
+ Jul 2015 |
162
+ Jun 2015 |
163
+ May 2015 |
164
+ Apr 2015 |
165
+ Mar 2015 |
166
+ Feb 2015 |
167
+ Jan 2015 |█∙∙∙|
168
+ Dec 2014 |∙|
169
+ Nov 2014 |∙|
170
170
  OUTPUT
171
171
  end
172
172
  end
@@ -177,19 +177,19 @@ Nov 2015 |∙|
177
177
 
178
178
  it "matches tag case-sensitively" do
179
179
  stdout_only <<-OUTPUT
180
- Nov 2014 |∙|
181
- Dec 2014 |█
182
- Jan 2015 |█∙∙∙|
183
- Feb 2015 |
184
- Mar 2015 |
185
- Apr 2015 |
186
- May 2015 |
187
- Jun 2015 |
188
- Jul 2015 |
189
- Aug 2015 |
190
- Sep 2015 |
191
- Oct 2015 |
192
180
  Nov 2015 |█
181
+ Oct 2015 |
182
+ Sep 2015 |
183
+ Aug 2015 |
184
+ Jul 2015 |
185
+ Jun 2015 |
186
+ May 2015 |
187
+ Apr 2015 |
188
+ Mar 2015 |
189
+ Feb 2015 |
190
+ Jan 2015 |█∙∙∙|
191
+ Dec 2014 |█
192
+ Nov 2014 |∙|
193
193
  OUTPUT
194
194
  end
195
195
 
@@ -200,19 +200,19 @@ Nov 2015 |█
200
200
 
201
201
  it "matches all tags case-sensitively" do
202
202
  stdout_only <<-OUTPUT
203
- Nov 2014 |∙|
204
- Dec 2014 |█
205
- Jan 2015 |∙∙∙∙|
206
- Feb 2015 |
207
- Mar 2015 |
208
- Apr 2015 |
209
- May 2015 |
210
- Jun 2015 |
211
- Jul 2015 |
212
- Aug 2015 |
213
- Sep 2015 |
214
- Oct 2015 |
215
203
  Nov 2015 |∙|
204
+ Oct 2015 |
205
+ Sep 2015 |
206
+ Aug 2015 |
207
+ Jul 2015 |
208
+ Jun 2015 |
209
+ May 2015 |
210
+ Apr 2015 |
211
+ Mar 2015 |
212
+ Feb 2015 |
213
+ Jan 2015 |∙∙∙∙|
214
+ Dec 2014 |█
215
+ Nov 2014 |∙|
216
216
  OUTPUT
217
217
  end
218
218
  end
@@ -223,17 +223,17 @@ Nov 2015 |∙|
223
223
 
224
224
  it "graphs activities on and after the specified date" do
225
225
  stdout_only <<-OUTPUT
226
- Jan 2015 |███
227
- Feb 2015 |
228
- Mar 2015 |
229
- Apr 2015 |
230
- May 2015 |
231
- Jun 2015 |
232
- Jul 2015 |
233
- Aug 2015 |
234
- Sep 2015 |
235
- Oct 2015 |
236
226
  Nov 2015 |█
227
+ Oct 2015 |
228
+ Sep 2015 |
229
+ Aug 2015 |
230
+ Jul 2015 |
231
+ Jun 2015 |
232
+ May 2015 |
233
+ Apr 2015 |
234
+ Mar 2015 |
235
+ Feb 2015 |
236
+ Jan 2015 |███
237
237
  OUTPUT
238
238
  end
239
239
  end
@@ -243,9 +243,9 @@ Nov 2015 |█
243
243
 
244
244
  it "graphs activities before and on the specified date" do
245
245
  stdout_only <<-OUTPUT
246
- Nov 2014 |█
247
- Dec 2014 |█
248
246
  Jan 2015 |███
247
+ Dec 2014 |█
248
+ Nov 2014 |█
249
249
  OUTPUT
250
250
  end
251
251
  end
@@ -257,17 +257,17 @@ Jan 2015 |███
257
257
  # If we just rounded to the month, there would be three unfiltered activities in
258
258
  # January displayed (due to the one on 1/5/2015). Instead, we correctly display two.
259
259
  stdout_only <<-OUTPUT
260
- Jan 2015 |█∙∙|
261
- Feb 2015 |
262
- Mar 2015 |
263
- Apr 2015 |
264
- May 2015 |
265
- Jun 2015 |
266
- Jul 2015 |
267
- Aug 2015 |
268
- Sep 2015 |
269
- Oct 2015 |
270
260
  Nov 2015 |█
261
+ Oct 2015 |
262
+ Sep 2015 |
263
+ Aug 2015 |
264
+ Jul 2015 |
265
+ Jun 2015 |
266
+ May 2015 |
267
+ Apr 2015 |
268
+ Mar 2015 |
269
+ Feb 2015 |
270
+ Jan 2015 |█∙∙|
271
271
  OUTPUT
272
272
  end
273
273
  end
@@ -36,27 +36,6 @@ clean_describe "list activities" do
36
36
  OUTPUT
37
37
  end
38
38
 
39
- describe "--limit" do
40
- subject { run_cmd("list activities --limit #{limit}") }
41
-
42
- describe "when limit is less than 1" do
43
- let(:limit) { 0 }
44
- it "prints an error message" do
45
- stderr_only "Error: Limit must be positive"
46
- end
47
- end
48
-
49
- describe "when limit is 1 or greater" do
50
- let(:limit) { 2 }
51
- it "limits output to the number specified" do
52
- stdout_only <<-OUTPUT
53
- 2015-01-04: Got lunch with Grace Hopper and George Washington Carver. @food
54
- 2015-11-01: Grace Hopper and I went to Marie's Diner. George had to cancel at the last minute. @food
55
- OUTPUT
56
- end
57
- end
58
- end
59
-
60
39
  describe "--in" do
61
40
  subject { run_cmd("list activities --in #{location_name}") }
62
41
 
@@ -109,53 +109,5 @@ FILE
109
109
  lines.last.must_include "3. Friend"
110
110
  end
111
111
  end
112
-
113
- describe "--limit" do
114
- subject { run_cmd("list favorite friends --limit #{limit}") }
115
-
116
- describe "when limit is less than 1" do
117
- let(:limit) { 0 }
118
- it "prints an error message" do
119
- stderr_only "Error: Favorites limit must be positive"
120
- end
121
- end
122
-
123
- describe "when limit is 1" do
124
- let(:limit) { 1 }
125
-
126
- it "uses correct friend pluralization" do
127
- stdout_only "Your favorite friend is Grace Hopper (3 activities)"
128
- end
129
-
130
- describe "when favorite friend only has one activity" do
131
- let(:content) do
132
- <<-FILE
133
- ### Activities:
134
- - 2017-01-01: Did some math with **Grace Hopper**.
135
-
136
- ### Friends:
137
- - George Washington Carver
138
- - Grace Hopper (a.k.a. The Admiral a.k.a. Amazing Grace) [Paris] @navy @science
139
- - Marie Curie [Atlantis] @science
140
- FILE
141
- end
142
-
143
- it "uses correct activity pluralization" do
144
- stdout_only "Your favorite friend is Grace Hopper (1 activity)"
145
- end
146
- end
147
- end
148
-
149
- describe "when limit is greater than 1" do
150
- let(:limit) { 2 }
151
- it "limits output to the number specified" do
152
- stdout_only <<-OUTPUT
153
- Your favorite friends:
154
- 1. Grace Hopper (3 activities)
155
- 2. George Washington Carver (2)
156
- OUTPUT
157
- end
158
- end
159
- end
160
112
  end
161
113
  end
@@ -114,58 +114,5 @@ FILE
114
114
  lines.last.must_include "3. Location"
115
115
  end
116
116
  end
117
-
118
- describe "--limit" do
119
- subject { run_cmd("list favorite locations --limit #{limit}") }
120
-
121
- describe "when limit is less than 1" do
122
- let(:limit) { 0 }
123
- it "prints an error message" do
124
- stderr_only "Error: Favorites limit must be positive"
125
- end
126
- end
127
-
128
- describe "when limit is 1" do
129
- let(:limit) { 1 }
130
-
131
- it "uses correct location pluralization" do
132
- stdout_only "Your favorite location is Marie's Diner (2 activities)"
133
- end
134
-
135
- describe "when favorite location only has one activity" do
136
- let(:content) do
137
- <<-FILE
138
- ### Activities:
139
- - 2017-01-01: Did some math with **Grace Hopper** at _Marie's Diner_.
140
-
141
- ### Friends:
142
- - George Washington Carver
143
- - Grace Hopper (a.k.a. The Admiral a.k.a. Amazing Grace) [Paris] @navy @science
144
- - Marie Curie [Atlantis] @science
145
-
146
- ### Locations:
147
- - Atlantis
148
- - Marie's Diner
149
- - Paris
150
- FILE
151
- end
152
-
153
- it "uses correct activity pluralization" do
154
- stdout_only "Your favorite location is Marie's Diner (1 activity)"
155
- end
156
- end
157
- end
158
-
159
- describe "when limit is greater than 1" do
160
- let(:limit) { 2 }
161
- it "limits output to the number specified" do
162
- stdout_only <<-OUTPUT
163
- Your favorite locations:
164
- 1. Marie's Diner (2 activities)
165
- 2. Paris (1)
166
- OUTPUT
167
- end
168
- end
169
- end
170
117
  end
171
118
  end
@@ -35,27 +35,6 @@ clean_describe "list notes" do
35
35
  OUTPUT
36
36
  end
37
37
 
38
- describe "--limit" do
39
- subject { run_cmd("list notes --limit #{limit}") }
40
-
41
- describe "when limit is less than 1" do
42
- let(:limit) { 0 }
43
- it "prints an error message" do
44
- stderr_only "Error: Limit must be positive"
45
- end
46
- end
47
-
48
- describe "when limit is 1 or greater" do
49
- let(:limit) { 2 }
50
- it "limits output to the number specified" do
51
- stdout_only <<-OUTPUT
52
- 2015-01-04: Grace Hopper and George Washington Carver both won an award.
53
- 2015-06-06: Marie Curie just got accepted into a PhD program in Paris. @school
54
- OUTPUT
55
- end
56
- end
57
- end
58
-
59
38
  describe "--in" do
60
39
  subject { run_cmd("list notes --in #{location_name}") }
61
40
 
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "./test/helper"
4
+
5
+ clean_describe "paging" do
6
+ subject { run_cmd("stats", env_vars: env_vars) }
7
+
8
+ let(:content) { nil }
9
+ let(:expected_output) do
10
+ <<-OUTPUT
11
+ Total activities: 0
12
+ Total friends: 0
13
+ Total locations: 0
14
+ Total notes: 0
15
+ Total tags: 0
16
+ Total time elapsed: 0 days
17
+ OUTPUT
18
+ end
19
+
20
+ describe "when using the default pager" do
21
+ let(:env_vars) { "" }
22
+ it { stdout_only expected_output }
23
+ end
24
+
25
+ describe "when using a custom pager" do
26
+ let(:env_vars) { "FRIENDS_PAGER='head -n 3 | tail -n 2'" }
27
+ it { stdout_only expected_output.split("\n").take(3).drop(1).join("\n") }
28
+ end
29
+
30
+ describe "when using a nonexistent pager" do
31
+ let(:env_vars) { "FRIENDS_PAGER=garbage" }
32
+ it { stdout_only expected_output }
33
+ end
34
+ end