git_statistics 0.7.0 → 0.8.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/bin/git-statistics +1 -1
- data/bin/git_statistics +1 -1
- data/lib/git_statistics.rb +33 -35
- data/lib/git_statistics/collector.rb +13 -16
- data/lib/git_statistics/commit_summary.rb +13 -16
- data/lib/git_statistics/commits.rb +34 -36
- data/lib/git_statistics/diff_summary.rb +13 -17
- data/lib/git_statistics/formatters/console.rb +22 -18
- data/lib/git_statistics/log.rb +3 -5
- data/lib/git_statistics/pipe.rb +1 -1
- data/lib/git_statistics/utilities.rb +7 -9
- data/lib/git_statistics/version.rb +1 -1
- data/spec/collector_spec.rb +107 -104
- data/spec/commit_summary_spec.rb +110 -84
- data/spec/commits_spec.rb +251 -218
- data/spec/formatters/console_spec.rb +141 -127
- data/spec/log_spec.rb +19 -21
- data/spec/pipe_spec.rb +30 -25
- data/spec/utilities_spec.rb +42 -40
- metadata +37 -37
data/spec/commits_spec.rb
CHANGED
@@ -3,357 +3,390 @@ require 'fileutils'
|
|
3
3
|
include GitStatistics
|
4
4
|
|
5
5
|
describe Commits do
|
6
|
-
let(:limit) {100}
|
7
|
-
let(:fresh) {true}
|
8
|
-
let(:pretty) {false}
|
6
|
+
let(:limit) { 100 }
|
7
|
+
let(:fresh) { true }
|
8
|
+
let(:pretty) { false }
|
9
9
|
let(:repo) { GIT_REPO }
|
10
|
-
let(:collector) {Collector.new(repo, limit, fresh, pretty)}
|
10
|
+
let(:collector) { Collector.new(repo, limit, fresh, pretty) }
|
11
11
|
|
12
|
-
let(:commits) {collector.commits}
|
12
|
+
let(:commits) { collector.commits }
|
13
13
|
|
14
|
-
let(:fixture_file) {
|
15
|
-
let(:save_file) { File.join(collector.commits_path,
|
16
|
-
let(:email) {false}
|
17
|
-
let(:merge) {false}
|
18
|
-
let(:sort) {:commits}
|
14
|
+
let(:fixture_file) { 'multiple_authors.json' }
|
15
|
+
let(:save_file) { File.join(collector.commits_path, '0.json') }
|
16
|
+
let(:email) { false }
|
17
|
+
let(:merge) { false }
|
18
|
+
let(:sort) { :commits }
|
19
19
|
let(:stats) do
|
20
20
|
setup_commits(commits, fixture_file, save_file, pretty)
|
21
21
|
commits.calculate_statistics(email, merge)
|
22
22
|
commits.author_top_n_type(sort)
|
23
23
|
end
|
24
24
|
|
25
|
-
describe
|
25
|
+
describe '#files_in_path' do
|
26
26
|
let(:path) { '/tmp/example' }
|
27
27
|
subject { commits.files_in_path }
|
28
|
-
|
28
|
+
|
29
|
+
it do
|
29
30
|
Dir.mktmpdir do |dir|
|
30
31
|
Dir.chdir(dir) do
|
31
32
|
FileUtils.touch '0.json'
|
32
33
|
FileUtils.touch '1.json'
|
33
|
-
commits.
|
34
|
-
|
34
|
+
allow(commits).to receive(:path) { dir }
|
35
|
+
|
36
|
+
expect(subject.count).to eq(2)
|
37
|
+
expect(subject).to_not include('.')
|
38
|
+
expect(subject).to_not include('..')
|
35
39
|
end
|
36
40
|
end
|
37
41
|
end
|
38
|
-
its(:count) { should == 2 }
|
39
|
-
it { should_not include '.' }
|
40
|
-
it { should_not include '..' }
|
41
42
|
end
|
42
43
|
|
43
|
-
describe
|
44
|
-
let(:commits) {collector.commits.load(fixture(fixture_file).file)}
|
44
|
+
describe '#flush_commits' do
|
45
|
+
let(:commits) { collector.commits.load(fixture(fixture_file).file) }
|
45
46
|
|
46
47
|
def commit_size_changes_from(beginning, opts = {})
|
47
|
-
commits.size.
|
48
|
+
expect(commits.size).to eq(beginning)
|
48
49
|
commits.flush_commits
|
49
|
-
commits.size.
|
50
|
+
expect(commits.size).to eq(opts[:to])
|
50
51
|
end
|
51
52
|
|
52
|
-
context
|
53
|
-
let(:limit) {2}
|
53
|
+
context 'with commits exceeding limit' do
|
54
|
+
let(:limit) { 2 }
|
54
55
|
it { commit_size_changes_from(3, to: 0) }
|
55
56
|
end
|
56
57
|
|
57
|
-
context
|
58
|
-
let(:limit) {3}
|
58
|
+
context 'with commits equal to limit' do
|
59
|
+
let(:limit) { 3 }
|
59
60
|
it { commit_size_changes_from(3, to: 0) }
|
60
61
|
end
|
61
62
|
|
62
|
-
context
|
63
|
-
let(:limit) {5}
|
63
|
+
context 'with commits less than limit' do
|
64
|
+
let(:limit) { 5 }
|
64
65
|
it { commit_size_changes_from(3, to: 3) }
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
68
|
-
describe
|
69
|
-
let(:commits) {collector.commits.load(fixture(fixture_file).file)}
|
70
|
-
let(:type) {:author}
|
69
|
+
describe '#process_commits' do
|
70
|
+
let(:commits) { collector.commits.load(fixture(fixture_file).file) }
|
71
|
+
let(:type) { :author }
|
71
72
|
subject { commits.stats[author_name] }
|
72
73
|
|
73
74
|
before do
|
74
75
|
commits.process_commits(type, merge)
|
75
76
|
end
|
76
77
|
|
77
|
-
context
|
78
|
-
let(:merge) {true}
|
79
|
-
|
80
|
-
context
|
81
|
-
let(:author_name) {
|
82
|
-
|
83
|
-
it
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
78
|
+
context 'with merge' do
|
79
|
+
let(:merge) { true }
|
80
|
+
|
81
|
+
context 'on first author' do
|
82
|
+
let(:author_name) { 'Kevin Jalbert' }
|
83
|
+
|
84
|
+
it do
|
85
|
+
expect(subject[:additions]).to eq(153)
|
86
|
+
expect(subject[:deletions]).to eq(5)
|
87
|
+
expect(subject[:commits]).to eq(2)
|
88
|
+
expect(subject[:added_files]).to eq(3)
|
89
|
+
expect(subject[:merges]).to eq(1)
|
90
|
+
|
91
|
+
expect(subject[:languages][:Markdown][:additions]).to eq(18)
|
92
|
+
expect(subject[:languages][:Markdown][:deletions]).to eq(1)
|
93
|
+
expect(subject[:languages][:Markdown][:added_files]).to eq(1)
|
94
|
+
expect(subject[:languages][:Ruby][:additions]).to eq(135)
|
95
|
+
expect(subject[:languages][:Ruby][:deletions]).to eq(4)
|
96
|
+
expect(subject[:languages][:Ruby][:added_files]).to eq(2)
|
97
|
+
end
|
94
98
|
end
|
95
99
|
|
96
|
-
context
|
97
|
-
let(:author_name) {
|
98
|
-
it {subject[:additions].should == 64}
|
99
|
-
it {subject[:deletions].should == 16}
|
100
|
-
it {subject[:commits].should == 1}
|
100
|
+
context 'on second author' do
|
101
|
+
let(:author_name) { 'John Smith' }
|
101
102
|
|
102
|
-
it
|
103
|
-
|
104
|
-
|
103
|
+
it do
|
104
|
+
expect(subject[:additions]).to eq(64)
|
105
|
+
expect(subject[:deletions]).to eq(16)
|
106
|
+
expect(subject[:commits]).to eq(1)
|
107
|
+
|
108
|
+
expect(subject[:languages][:Ruby][:additions]).to eq(64)
|
109
|
+
expect(subject[:languages][:Ruby][:deletions]).to eq(16)
|
110
|
+
expect(subject[:languages][:Ruby][:added_files]).to eq(0)
|
111
|
+
end
|
105
112
|
end
|
106
113
|
end
|
107
114
|
|
108
|
-
context
|
109
|
-
let(:merge) {false}
|
110
|
-
|
111
|
-
context
|
112
|
-
let(:author_name) {
|
113
|
-
|
114
|
-
it
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
115
|
+
context 'without merge' do
|
116
|
+
let(:merge) { false }
|
117
|
+
|
118
|
+
context 'on first author' do
|
119
|
+
let(:author_name) { 'Kevin Jalbert' }
|
120
|
+
|
121
|
+
it do
|
122
|
+
expect(subject[:additions]).to eq(73)
|
123
|
+
expect(subject[:deletions]).to eq(0)
|
124
|
+
expect(subject[:commits]).to eq(1)
|
125
|
+
expect(subject[:added_files]).to eq(2)
|
126
|
+
|
127
|
+
expect(subject[:languages][:Markdown][:additions]).to eq(11)
|
128
|
+
expect(subject[:languages][:Markdown][:deletions]).to eq(0)
|
129
|
+
expect(subject[:languages][:Markdown][:added_files]).to eq(1)
|
130
|
+
expect(subject[:languages][:Ruby][:additions]).to eq(62)
|
131
|
+
expect(subject[:languages][:Ruby][:deletions]).to eq(0)
|
132
|
+
expect(subject[:languages][:Ruby][:added_files]).to eq(1)
|
133
|
+
end
|
124
134
|
end
|
125
135
|
|
126
|
-
context
|
127
|
-
let(:author_name) {
|
128
|
-
it {subject[:additions].should == 64}
|
129
|
-
it {subject[:deletions].should == 16}
|
130
|
-
it {subject[:commits].should == 1}
|
136
|
+
context 'on second author' do
|
137
|
+
let(:author_name) { 'John Smith' }
|
131
138
|
|
132
|
-
it
|
133
|
-
|
139
|
+
it do
|
140
|
+
expect(subject[:additions]).to eq(64)
|
141
|
+
expect(subject[:deletions]).to eq(16)
|
142
|
+
expect(subject[:commits]).to eq(1)
|
143
|
+
|
144
|
+
expect(subject[:languages][:Ruby][:additions]).to eq(64)
|
145
|
+
expect(subject[:languages][:Ruby][:deletions]).to eq(16)
|
146
|
+
end
|
134
147
|
end
|
135
148
|
end
|
136
149
|
end
|
137
150
|
|
138
|
-
describe
|
139
|
-
let(:sort) {:deletions}
|
140
|
-
subject {stats[author]}
|
151
|
+
describe '#author_top_n_type' do
|
152
|
+
let(:sort) { :deletions }
|
153
|
+
subject { stats[author] }
|
141
154
|
|
142
|
-
context
|
143
|
-
context
|
155
|
+
context 'with valid data' do
|
156
|
+
context 'on first author' do
|
144
157
|
let(:author) { 'John Smith' }
|
145
|
-
it {stats.has_key?(author).should be_true}
|
146
|
-
it {subject[:commits].should == 1}
|
147
|
-
it {subject[:deletions].should == 16}
|
148
|
-
it {subject[:additions].should == 64}
|
149
158
|
|
150
|
-
it
|
151
|
-
|
159
|
+
it do
|
160
|
+
expect(stats.key?(author)).to be true
|
161
|
+
expect(subject[:commits]).to eq(1)
|
162
|
+
expect(subject[:deletions]).to eq(16)
|
163
|
+
expect(subject[:additions]).to eq(64)
|
164
|
+
|
165
|
+
expect(subject[:languages][:Ruby][:additions]).to eq(64)
|
166
|
+
expect(subject[:languages][:Ruby][:deletions]).to eq(16)
|
167
|
+
end
|
152
168
|
end
|
153
169
|
|
154
|
-
context
|
155
|
-
let(:author) {
|
156
|
-
|
157
|
-
it
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
170
|
+
context 'on second author' do
|
171
|
+
let(:author) { 'Kevin Jalbert' }
|
172
|
+
|
173
|
+
it do
|
174
|
+
expect(stats.key?(author)).to be true
|
175
|
+
expect(subject[:commits]).to eq(1)
|
176
|
+
expect(subject[:additions]).to eq(73)
|
177
|
+
expect(subject[:deletions]).to eq(0)
|
178
|
+
expect(subject[:added_files]).to eq(2)
|
179
|
+
|
180
|
+
expect(subject[:languages][:Markdown][:additions]).to eq(11)
|
181
|
+
expect(subject[:languages][:Markdown][:deletions]).to eq(0)
|
182
|
+
expect(subject[:languages][:Markdown][:added_files]).to eq(1)
|
183
|
+
expect(subject[:languages][:Ruby][:additions]).to eq(62)
|
184
|
+
expect(subject[:languages][:Ruby][:deletions]).to eq(0)
|
185
|
+
expect(subject[:languages][:Ruby][:added_files]).to eq(1)
|
186
|
+
end
|
168
187
|
end
|
169
188
|
end
|
170
189
|
|
171
|
-
context
|
172
|
-
let(:sort) {:wrong}
|
173
|
-
it { stats.
|
190
|
+
context 'with invalid type' do
|
191
|
+
let(:sort) { :wrong }
|
192
|
+
it { expect(stats).to be nil }
|
174
193
|
end
|
175
194
|
|
176
|
-
context
|
177
|
-
let(:fixture_file) {nil}
|
178
|
-
it { stats.
|
195
|
+
context 'with invalid data' do
|
196
|
+
let(:fixture_file) { nil }
|
197
|
+
it { expect(stats).to be nil }
|
179
198
|
end
|
180
199
|
end
|
181
200
|
|
182
|
-
describe
|
183
|
-
let(:fixture_file) {
|
184
|
-
subject {stats[author]}
|
185
|
-
|
186
|
-
context
|
187
|
-
let(:email) {true}
|
188
|
-
let(:author) {
|
189
|
-
|
190
|
-
it
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
+
describe '#calculate_statistics' do
|
202
|
+
let(:fixture_file) { 'single_author_pretty.json' }
|
203
|
+
subject { stats[author] }
|
204
|
+
|
205
|
+
context 'with email' do
|
206
|
+
let(:email) { true }
|
207
|
+
let(:author) { 'kevin.j.jalbert@gmail.com' }
|
208
|
+
|
209
|
+
it do
|
210
|
+
expect(stats.key?(author)).to be true
|
211
|
+
expect(subject[:commits]).to eq(1)
|
212
|
+
expect(subject[:additions]).to eq(73)
|
213
|
+
expect(subject[:deletions]).to eq(0)
|
214
|
+
expect(subject[:added_files]).to eq(2)
|
215
|
+
|
216
|
+
expect(subject[:languages][:Markdown][:additions]).to eq(11)
|
217
|
+
expect(subject[:languages][:Markdown][:deletions]).to eq(0)
|
218
|
+
expect(subject[:languages][:Ruby][:additions]).to eq(62)
|
219
|
+
expect(subject[:languages][:Ruby][:deletions]).to eq(0)
|
220
|
+
expect(subject[:languages][:Ruby][:added_files]).to eq(1)
|
221
|
+
end
|
201
222
|
end
|
202
223
|
|
203
|
-
context
|
204
|
-
let(:merge) {true}
|
205
|
-
let(:author) {
|
206
|
-
|
207
|
-
it
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
224
|
+
context 'with merge' do
|
225
|
+
let(:merge) { true }
|
226
|
+
let(:author) { 'Kevin Jalbert' }
|
227
|
+
|
228
|
+
it do
|
229
|
+
expect(stats.key?(author)).to be true
|
230
|
+
expect(subject[:commits]).to eq(2)
|
231
|
+
expect(subject[:additions]).to eq(153)
|
232
|
+
expect(subject[:deletions]).to eq(5)
|
233
|
+
expect(subject[:added_files]).to eq(3)
|
234
|
+
expect(subject[:merges]).to eq(1)
|
235
|
+
|
236
|
+
expect(subject[:languages][:Markdown][:additions]).to eq(18)
|
237
|
+
expect(subject[:languages][:Markdown][:deletions]).to eq(1)
|
238
|
+
expect(subject[:languages][:Ruby][:additions]).to eq(135)
|
239
|
+
expect(subject[:languages][:Ruby][:deletions]).to eq(4)
|
240
|
+
expect(subject[:languages][:Ruby][:added_files]).to eq(2)
|
241
|
+
end
|
219
242
|
end
|
220
243
|
end
|
221
244
|
|
222
|
-
describe
|
223
|
-
context
|
224
|
-
let(:data)
|
245
|
+
describe '#add_language_stats' do
|
246
|
+
context 'with file language' do
|
247
|
+
let(:data) do
|
225
248
|
data = Hash.new(0)
|
226
249
|
data[:languages] = {}
|
227
250
|
|
228
|
-
file = {:
|
229
|
-
|
251
|
+
file = { additions: 10,
|
252
|
+
deletions: 5 }
|
230
253
|
|
231
|
-
file[:language] =
|
254
|
+
file[:language] = 'Ruby'
|
232
255
|
|
233
|
-
|
234
|
-
|
256
|
+
commits.add_language_stats(data, file)
|
257
|
+
end
|
235
258
|
|
236
|
-
it
|
237
|
-
|
259
|
+
it do
|
260
|
+
expect(data[:languages][:Ruby][:additions]).to eq(10)
|
261
|
+
expect(data[:languages][:Ruby][:deletions]).to eq(5)
|
262
|
+
end
|
238
263
|
end
|
239
264
|
|
240
|
-
context
|
241
|
-
let(:data)
|
265
|
+
context 'with multiple files' do
|
266
|
+
let(:data) do
|
242
267
|
data = Hash.new(0)
|
243
268
|
data[:languages] = {}
|
244
269
|
|
245
|
-
file = {:
|
246
|
-
|
270
|
+
file = { additions: 10,
|
271
|
+
deletions: 5 }
|
247
272
|
|
248
273
|
# First file is "Ruby"
|
249
|
-
file[:language] =
|
274
|
+
file[:language] = 'Ruby'
|
250
275
|
data = commits.add_language_stats(data, file)
|
251
276
|
|
252
277
|
# Second file is "Java"
|
253
|
-
file[:language] =
|
278
|
+
file[:language] = 'Java'
|
254
279
|
data = commits.add_language_stats(data, file)
|
255
280
|
|
256
281
|
# Third file is "Ruby"
|
257
|
-
file[:language] =
|
258
|
-
|
259
|
-
|
282
|
+
file[:language] = 'Ruby'
|
283
|
+
commits.add_language_stats(data, file)
|
284
|
+
end
|
260
285
|
|
261
|
-
it
|
262
|
-
|
263
|
-
|
264
|
-
|
286
|
+
it do
|
287
|
+
expect(data[:languages][:Ruby][:additions]).to eq(20)
|
288
|
+
expect(data[:languages][:Ruby][:deletions]).to eq(10)
|
289
|
+
expect(data[:languages][:Java][:additions]).to eq(10)
|
290
|
+
expect(data[:languages][:Java][:deletions]).to eq(5)
|
291
|
+
end
|
265
292
|
end
|
266
293
|
end
|
267
294
|
|
268
|
-
describe
|
269
|
-
context
|
270
|
-
let(:data)
|
271
|
-
commit = {:
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
295
|
+
describe '#add_commit_stats' do
|
296
|
+
context 'with valid commit' do
|
297
|
+
let(:data) do
|
298
|
+
commit = { additions: 10,
|
299
|
+
deletions: 5,
|
300
|
+
new_files: 0,
|
301
|
+
removed_files: 0,
|
302
|
+
merge: false }
|
276
303
|
|
277
304
|
data = Hash.new(0)
|
278
|
-
|
279
|
-
|
305
|
+
commits.add_commit_stats(data, commit)
|
306
|
+
end
|
280
307
|
|
281
|
-
it
|
282
|
-
|
283
|
-
|
284
|
-
|
308
|
+
it do
|
309
|
+
expect(data[:commits]).to eq(1)
|
310
|
+
expect(data[:additions]).to eq(10)
|
311
|
+
expect(data[:deletions]).to eq(5)
|
312
|
+
expect(data[:merges]).to eq(0)
|
313
|
+
end
|
285
314
|
end
|
286
315
|
|
287
|
-
context
|
288
|
-
let(:data)
|
289
|
-
commit = {:
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
316
|
+
context 'with multiple commits (one merge commit)' do
|
317
|
+
let(:data) do
|
318
|
+
commit = { additions: 10,
|
319
|
+
deletions: 5,
|
320
|
+
new_files: 0,
|
321
|
+
removed_files: 0,
|
322
|
+
merge: false }
|
294
323
|
|
295
324
|
data = Hash.new(0)
|
296
325
|
data = commits.add_commit_stats(data, commit)
|
297
326
|
|
298
327
|
# Second commit has merge status
|
299
328
|
commit[:merge] = true
|
300
|
-
|
301
|
-
|
329
|
+
commits.add_commit_stats(data, commit)
|
330
|
+
end
|
302
331
|
|
303
|
-
it
|
304
|
-
|
305
|
-
|
306
|
-
|
332
|
+
it do
|
333
|
+
expect(data[:commits]).to eq(2)
|
334
|
+
expect(data[:additions]).to eq(20)
|
335
|
+
expect(data[:deletions]).to eq(10)
|
336
|
+
expect(data[:merges]).to eq(1)
|
337
|
+
end
|
307
338
|
end
|
308
339
|
|
309
|
-
context
|
310
|
-
let(:data)
|
311
|
-
commit = {:
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
340
|
+
context 'with commit that has file status changes' do
|
341
|
+
let(:data) do
|
342
|
+
commit = { additions: 10,
|
343
|
+
deletions: 5,
|
344
|
+
added_files: 1,
|
345
|
+
deleted_files: 2,
|
346
|
+
merge: false }
|
316
347
|
|
317
348
|
data = Hash.new(0)
|
318
|
-
|
319
|
-
|
349
|
+
commits.add_commit_stats(data, commit)
|
350
|
+
end
|
320
351
|
|
321
|
-
it
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
352
|
+
it do
|
353
|
+
expect(data[:commits]).to eq(1)
|
354
|
+
expect(data[:additions]).to eq(10)
|
355
|
+
expect(data[:deletions]).to eq(5)
|
356
|
+
expect(data[:added_files]).to eq(1)
|
357
|
+
expect(data[:deleted_files]).to eq(2)
|
358
|
+
end
|
326
359
|
end
|
327
360
|
end
|
328
361
|
|
329
|
-
describe
|
362
|
+
describe '#save and #load' do
|
330
363
|
let(:fixture_contents) { fixture(fixture_file).io.join("\n") }
|
331
|
-
let(:tmpfile_contents) { File.read(
|
364
|
+
let(:tmpfile_contents) { File.read('tmp.json') }
|
332
365
|
|
333
366
|
before do
|
334
367
|
commits.load(fixture(fixture_file).file)
|
335
|
-
commits.save(
|
368
|
+
commits.save('tmp.json', pretty)
|
336
369
|
end
|
337
370
|
|
338
371
|
after do
|
339
|
-
FileUtils.remove_file(
|
372
|
+
FileUtils.remove_file('tmp.json')
|
340
373
|
end
|
341
374
|
|
342
|
-
context
|
343
|
-
let(:fixture_file) {
|
375
|
+
context 'with pretty' do
|
376
|
+
let(:fixture_file) { 'single_author_pretty.json' }
|
344
377
|
let(:pretty) { true }
|
345
378
|
|
346
379
|
it do
|
347
|
-
JSON.parse(fixture_contents).
|
380
|
+
expect(JSON.parse(fixture_contents)).to eq(JSON.parse(tmpfile_contents))
|
348
381
|
end
|
349
382
|
end
|
350
383
|
|
351
|
-
context
|
352
|
-
let(:fixture_file) {
|
384
|
+
context 'with no pretty' do
|
385
|
+
let(:fixture_file) { 'multiple_authors.json' }
|
353
386
|
let(:pretty) { false }
|
354
387
|
|
355
388
|
it do
|
356
|
-
JSON.parse(fixture_contents).
|
389
|
+
expect(JSON.parse(fixture_contents)).to eq(JSON.parse(tmpfile_contents))
|
357
390
|
end
|
358
391
|
end
|
359
392
|
end
|