flog 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +7 -0
- data/Rakefile +8 -11
- data/bin/flog +0 -2
- data/lib/flog.rb +67 -73
- data/test/test_flog.rb +1361 -1013
- data/test/test_flog_command.rb +282 -282
- data/test/test_flog_integration.rb +904 -904
- metadata +12 -8
- metadata.gz.sig +0 -0
data/test/test_flog_command.rb
CHANGED
@@ -1,343 +1,343 @@
|
|
1
1
|
require 'test/test_helper'
|
2
2
|
require 'flog'
|
3
3
|
|
4
|
-
describe 'flog command' do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should run' do
|
24
|
-
lambda { run_command }.wont_raise_error(Errno::ENOENT)
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'should not alter the include path' do
|
28
|
-
@paths = $:.dup
|
29
|
-
run_command
|
30
|
-
$:.must_equal @paths
|
31
|
-
end
|
32
|
-
|
33
|
-
# it 'should create a Flog instance' do
|
34
|
-
# Flog.expects(:new).returns(@flog)
|
35
|
-
# run_command
|
4
|
+
# describe 'flog command' do
|
5
|
+
# before :each do
|
6
|
+
# @flog = stub('Flog',
|
7
|
+
# :flog_files => true,
|
8
|
+
# :report => true,
|
9
|
+
# :exit => nil,
|
10
|
+
# :puts => nil)
|
11
|
+
# # Flog.stubs(:new).returns(@flog)
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
# def run_command
|
15
|
+
# # HACK eval File.read(File.join(File.dirname(__FILE__), *%w[.. bin flog]))
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# describe 'when no command-line arguments are specified' do
|
19
|
+
# before :each do
|
20
|
+
# ARGV.clear
|
36
21
|
# end
|
37
22
|
#
|
38
|
-
# it 'should
|
39
|
-
#
|
40
|
-
# run_command
|
23
|
+
# it 'should run' do
|
24
|
+
# lambda { run_command }.wont_raise_error(Errno::ENOENT)
|
41
25
|
# end
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
run_command
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should pass '-' (for the file path) to flog_files on the instance" do
|
49
|
-
@flog.expects(:flog_files).with(['-'])
|
50
|
-
run_command
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'should call report on the Flog instance' do
|
54
|
-
@flog.expects(:report)
|
55
|
-
run_command
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'should exit with status 0' do
|
59
|
-
self.expects(:exit).with(0)
|
60
|
-
run_command
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe "when -a is specified on the command-line" do
|
65
|
-
before :each do
|
66
|
-
ARGV.replace ['-a']
|
67
|
-
end
|
68
|
-
|
69
|
-
# it 'should create a Flog instance' do
|
70
|
-
# Flog.expects(:new).returns(@flog)
|
26
|
+
#
|
27
|
+
# it 'should not alter the include path' do
|
28
|
+
# @paths = $:.dup
|
71
29
|
# run_command
|
30
|
+
# $:.must_equal @paths
|
72
31
|
# end
|
73
32
|
#
|
74
|
-
# it
|
75
|
-
# Flog.expects(:new).
|
33
|
+
# # it 'should create a Flog instance' do
|
34
|
+
# # Flog.expects(:new).returns(@flog)
|
35
|
+
# # run_command
|
36
|
+
# # end
|
37
|
+
# #
|
38
|
+
# # it 'should not have any options flags set' do
|
39
|
+
# # Flog.expects(:new).with({}).returns(@flog)
|
40
|
+
# # run_command
|
41
|
+
# # end
|
42
|
+
#
|
43
|
+
# it 'should call flog_files on the Flog instance' do
|
44
|
+
# @flog.expects(:flog_files)
|
76
45
|
# run_command
|
77
46
|
# end
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
run_command
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
describe "when --all is specified on the command-line" do
|
86
|
-
before :each do
|
87
|
-
ARGV.replace ['--all']
|
88
|
-
end
|
89
|
-
|
90
|
-
# it 'should create a Flog instance' do
|
91
|
-
# Flog.expects(:new).returns(@flog)
|
47
|
+
#
|
48
|
+
# it "should pass '-' (for the file path) to flog_files on the instance" do
|
49
|
+
# @flog.expects(:flog_files).with(['-'])
|
92
50
|
# run_command
|
93
51
|
# end
|
94
52
|
#
|
95
|
-
# it
|
96
|
-
#
|
53
|
+
# it 'should call report on the Flog instance' do
|
54
|
+
# @flog.expects(:report)
|
97
55
|
# run_command
|
98
56
|
# end
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
run_command
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
describe "when -s is specified on the command-line" do
|
107
|
-
before :each do
|
108
|
-
ARGV.replace ['-s']
|
109
|
-
end
|
110
|
-
|
111
|
-
# it 'should create a Flog instance' do
|
112
|
-
# Flog.expects(:new).returns(@flog)
|
57
|
+
#
|
58
|
+
# it 'should exit with status 0' do
|
59
|
+
# self.expects(:exit).with(0)
|
113
60
|
# run_command
|
114
61
|
# end
|
62
|
+
# end
|
115
63
|
#
|
116
|
-
#
|
117
|
-
#
|
118
|
-
#
|
64
|
+
# describe "when -a is specified on the command-line" do
|
65
|
+
# before :each do
|
66
|
+
# ARGV.replace ['-a']
|
119
67
|
# end
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
#
|
133
|
-
# Flog.expects(:new).returns(@flog)
|
68
|
+
#
|
69
|
+
# # it 'should create a Flog instance' do
|
70
|
+
# # Flog.expects(:new).returns(@flog)
|
71
|
+
# # run_command
|
72
|
+
# # end
|
73
|
+
# #
|
74
|
+
# # it "should set the option to show all methods" do
|
75
|
+
# # Flog.expects(:new).with(:all => true).returns(@flog)
|
76
|
+
# # run_command
|
77
|
+
# # end
|
78
|
+
#
|
79
|
+
# it 'should exit with status 0' do
|
80
|
+
# self.expects(:exit).with(0)
|
134
81
|
# run_command
|
135
82
|
# end
|
83
|
+
# end
|
136
84
|
#
|
137
|
-
#
|
138
|
-
#
|
139
|
-
#
|
85
|
+
# describe "when --all is specified on the command-line" do
|
86
|
+
# before :each do
|
87
|
+
# ARGV.replace ['--all']
|
140
88
|
# end
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
#
|
154
|
-
# Flog.expects(:new).returns(@flog)
|
89
|
+
#
|
90
|
+
# # it 'should create a Flog instance' do
|
91
|
+
# # Flog.expects(:new).returns(@flog)
|
92
|
+
# # run_command
|
93
|
+
# # end
|
94
|
+
# #
|
95
|
+
# # it "should set the option to show all methods" do
|
96
|
+
# # Flog.expects(:new).with(:all => true).returns(@flog)
|
97
|
+
# # run_command
|
98
|
+
# # end
|
99
|
+
#
|
100
|
+
# it 'should exit with status 0' do
|
101
|
+
# self.expects(:exit).with(0)
|
155
102
|
# run_command
|
156
103
|
# end
|
104
|
+
# end
|
157
105
|
#
|
158
|
-
#
|
159
|
-
#
|
160
|
-
#
|
106
|
+
# describe "when -s is specified on the command-line" do
|
107
|
+
# before :each do
|
108
|
+
# ARGV.replace ['-s']
|
161
109
|
# end
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
#
|
175
|
-
# Flog.expects(:new).returns(@flog)
|
110
|
+
#
|
111
|
+
# # it 'should create a Flog instance' do
|
112
|
+
# # Flog.expects(:new).returns(@flog)
|
113
|
+
# # run_command
|
114
|
+
# # end
|
115
|
+
# #
|
116
|
+
# # it "should set the option to show only the score" do
|
117
|
+
# # Flog.expects(:new).with(:score => true).returns(@flog)
|
118
|
+
# # run_command
|
119
|
+
# # end
|
120
|
+
#
|
121
|
+
# it 'should exit with status 0' do
|
122
|
+
# self.expects(:exit).with(0)
|
176
123
|
# run_command
|
177
124
|
# end
|
125
|
+
# end
|
178
126
|
#
|
179
|
-
#
|
180
|
-
#
|
181
|
-
#
|
127
|
+
# describe "when --score is specified on the command-line" do
|
128
|
+
# before :each do
|
129
|
+
# ARGV.replace ['--score']
|
182
130
|
# end
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
#
|
196
|
-
# Flog.expects(:new).returns(@flog)
|
131
|
+
#
|
132
|
+
# # it 'should create a Flog instance' do
|
133
|
+
# # Flog.expects(:new).returns(@flog)
|
134
|
+
# # run_command
|
135
|
+
# # end
|
136
|
+
# #
|
137
|
+
# # it "should set the option to show only the score" do
|
138
|
+
# # Flog.expects(:new).with(:score => true).returns(@flog)
|
139
|
+
# # run_command
|
140
|
+
# # end
|
141
|
+
#
|
142
|
+
# it 'should exit with status 0' do
|
143
|
+
# self.expects(:exit).with(0)
|
197
144
|
# run_command
|
198
145
|
# end
|
146
|
+
# end
|
199
147
|
#
|
200
|
-
#
|
201
|
-
#
|
202
|
-
#
|
148
|
+
# describe "when -m is specified on the command-line" do
|
149
|
+
# before :each do
|
150
|
+
# ARGV.replace ['-m']
|
203
151
|
# end
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
#
|
217
|
-
# it 'should create a Flog instance' do
|
218
|
-
# Flog.expects(:new).returns(@flog)
|
152
|
+
#
|
153
|
+
# # it 'should create a Flog instance' do
|
154
|
+
# # Flog.expects(:new).returns(@flog)
|
155
|
+
# # run_command
|
156
|
+
# # end
|
157
|
+
# #
|
158
|
+
# # it "should set the option to report on methods only" do
|
159
|
+
# # Flog.expects(:new).with(:methods => true).returns(@flog)
|
160
|
+
# # run_command
|
161
|
+
# # end
|
162
|
+
#
|
163
|
+
# it 'should exit with status 0' do
|
164
|
+
# self.expects(:exit).with(0)
|
219
165
|
# run_command
|
220
166
|
# end
|
221
|
-
|
222
|
-
#
|
223
|
-
#
|
224
|
-
#
|
225
|
-
#
|
167
|
+
# end
|
168
|
+
#
|
169
|
+
# describe "when --methods-only is specified on the command-line" do
|
170
|
+
# before :each do
|
171
|
+
# ARGV.replace ['--methods-only']
|
226
172
|
# end
|
227
|
-
|
228
|
-
#
|
173
|
+
#
|
174
|
+
# # it 'should create a Flog instance' do
|
175
|
+
# # Flog.expects(:new).returns(@flog)
|
176
|
+
# # run_command
|
177
|
+
# # end
|
178
|
+
# #
|
179
|
+
# # it "should set the option to report on methods only" do
|
180
|
+
# # Flog.expects(:new).with(:methods => true).returns(@flog)
|
181
|
+
# # run_command
|
182
|
+
# # end
|
183
|
+
#
|
229
184
|
# it 'should exit with status 0' do
|
230
185
|
# self.expects(:exit).with(0)
|
231
186
|
# run_command
|
232
187
|
# end
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
#
|
246
|
-
#
|
247
|
-
#
|
188
|
+
# end
|
189
|
+
#
|
190
|
+
# describe "when -v is specified on the command-line" do
|
191
|
+
# before :each do
|
192
|
+
# ARGV.replace ['-v']
|
193
|
+
# end
|
194
|
+
#
|
195
|
+
# # it 'should create a Flog instance' do
|
196
|
+
# # Flog.expects(:new).returns(@flog)
|
197
|
+
# # run_command
|
198
|
+
# # end
|
199
|
+
# #
|
200
|
+
# # it "should set the option to be verbose" do
|
201
|
+
# # Flog.expects(:new).with(:verbose => true).returns(@flog)
|
202
|
+
# # run_command
|
203
|
+
# # end
|
204
|
+
#
|
205
|
+
# it 'should exit with status 0' do
|
206
|
+
# self.expects(:exit).with(0)
|
248
207
|
# run_command
|
249
208
|
# end
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
#
|
268
|
-
#
|
269
|
-
#
|
209
|
+
# end
|
210
|
+
#
|
211
|
+
# describe "when --verbose is specified on the command-line" do
|
212
|
+
# before :each do
|
213
|
+
# ARGV.replace ['--verbose']
|
214
|
+
# end
|
215
|
+
#
|
216
|
+
# # HACK
|
217
|
+
# # it 'should create a Flog instance' do
|
218
|
+
# # Flog.expects(:new).returns(@flog)
|
219
|
+
# # run_command
|
220
|
+
# # end
|
221
|
+
#
|
222
|
+
# # HACK
|
223
|
+
# # it "should set the option to be verbose" do
|
224
|
+
# # Flog.expects(:new).with(:verbose => true).returns(@flog)
|
225
|
+
# # run_command
|
226
|
+
# # end
|
227
|
+
#
|
228
|
+
# # HACK
|
229
|
+
# # it 'should exit with status 0' do
|
230
|
+
# # self.expects(:exit).with(0)
|
231
|
+
# # run_command
|
232
|
+
# # end
|
233
|
+
# end
|
234
|
+
#
|
235
|
+
# describe "when -h is specified on the command-line" do
|
236
|
+
# before :each do
|
237
|
+
# ARGV.replace ['-h']
|
238
|
+
# end
|
239
|
+
#
|
240
|
+
# it "should display help information" do
|
241
|
+
# self.expects(:puts)
|
270
242
|
# run_command
|
271
243
|
# end
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
ARGV.replace ['-I /tmp,/etc']
|
282
|
-
@paths = $:.dup
|
283
|
-
end
|
284
|
-
|
285
|
-
# HACK - very little value to begin with
|
286
|
-
# it "should append each ':' separated path to $:" do
|
244
|
+
#
|
245
|
+
# # HACK: useless anyhow
|
246
|
+
# # it 'should not create a Flog instance' do
|
247
|
+
# # Flog.expects(:new).never
|
248
|
+
# # run_command
|
249
|
+
# # end
|
250
|
+
#
|
251
|
+
# it 'should exit with status 0' do
|
252
|
+
# self.expects(:exit).with(0)
|
287
253
|
# run_command
|
288
|
-
# $:.wont_equal @paths
|
289
254
|
# end
|
290
|
-
|
291
|
-
#
|
292
|
-
#
|
255
|
+
# end
|
256
|
+
#
|
257
|
+
# describe "when --help is specified on the command-line" do
|
258
|
+
# before :each do
|
259
|
+
# ARGV.replace ['--help']
|
260
|
+
# end
|
261
|
+
#
|
262
|
+
# it "should display help information" do
|
263
|
+
# self.expects(:puts)
|
293
264
|
# run_command
|
294
265
|
# end
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
ARGV.replace ['-b']
|
305
|
-
end
|
306
|
-
|
307
|
-
# it 'should create a Flog instance' do
|
308
|
-
# Flog.expects(:new).returns(@flog)
|
266
|
+
#
|
267
|
+
# # HACK: useless anyhow
|
268
|
+
# # it 'should not create a Flog instance' do
|
269
|
+
# # Flog.expects(:new).never
|
270
|
+
# # run_command
|
271
|
+
# # end
|
272
|
+
#
|
273
|
+
# it 'should exit with status 0' do
|
274
|
+
# self.expects(:exit).with(0)
|
309
275
|
# run_command
|
310
276
|
# end
|
277
|
+
# end
|
278
|
+
#
|
279
|
+
# describe 'when -I is specified on the command-line' do
|
280
|
+
# before :each do
|
281
|
+
# ARGV.replace ['-I /tmp,/etc']
|
282
|
+
# @paths = $:.dup
|
283
|
+
# end
|
284
|
+
#
|
285
|
+
# # HACK - very little value to begin with
|
286
|
+
# # it "should append each ':' separated path to $:" do
|
287
|
+
# # run_command
|
288
|
+
# # $:.wont_equal @paths
|
289
|
+
# # end
|
311
290
|
#
|
312
|
-
# it
|
313
|
-
# Flog.expects(:new).
|
291
|
+
# # it 'should create a Flog instance' do
|
292
|
+
# # Flog.expects(:new).returns(@flog)
|
293
|
+
# # run_command
|
294
|
+
# # end
|
295
|
+
#
|
296
|
+
# it 'should exit with status 0' do
|
297
|
+
# self.expects(:exit).with(0)
|
314
298
|
# run_command
|
315
299
|
# end
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
# it
|
329
|
-
# Flog.expects(:new).returns(@flog)
|
300
|
+
# end
|
301
|
+
#
|
302
|
+
# describe 'when -b is specified on the command-line' do
|
303
|
+
# before :each do
|
304
|
+
# ARGV.replace ['-b']
|
305
|
+
# end
|
306
|
+
#
|
307
|
+
# # it 'should create a Flog instance' do
|
308
|
+
# # Flog.expects(:new).returns(@flog)
|
309
|
+
# # run_command
|
310
|
+
# # end
|
311
|
+
# #
|
312
|
+
# # it "should set the option to provide 'blame' information" do
|
313
|
+
# # Flog.expects(:new).with(:blame => true).returns(@flog)
|
314
|
+
# # run_command
|
315
|
+
# # end
|
316
|
+
#
|
317
|
+
# it 'should exit with status 0' do
|
318
|
+
# self.expects(:exit).with(0)
|
330
319
|
# run_command
|
331
320
|
# end
|
321
|
+
# end
|
322
|
+
#
|
323
|
+
# describe 'when --blame is specified on the command-line' do
|
324
|
+
# before :each do
|
325
|
+
# ARGV.replace ['--blame']
|
326
|
+
# end
|
332
327
|
#
|
333
|
-
# it
|
334
|
-
# Flog.expects(:new).
|
328
|
+
# # it 'should create a Flog instance' do
|
329
|
+
# # Flog.expects(:new).returns(@flog)
|
330
|
+
# # run_command
|
331
|
+
# # end
|
332
|
+
# #
|
333
|
+
# # it "should set the option to provide 'blame' information" do
|
334
|
+
# # Flog.expects(:new).with(:blame => true).returns(@flog)
|
335
|
+
# # run_command
|
336
|
+
# # end
|
337
|
+
#
|
338
|
+
# it 'should exit with status 0' do
|
339
|
+
# self.expects(:exit).with(0)
|
335
340
|
# run_command
|
336
341
|
# end
|
337
|
-
|
338
|
-
|
339
|
-
self.expects(:exit).with(0)
|
340
|
-
run_command
|
341
|
-
end
|
342
|
-
end
|
343
|
-
end
|
342
|
+
# end
|
343
|
+
# end
|