flog 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,343 +1,343 @@
1
1
  require 'test/test_helper'
2
2
  require 'flog'
3
3
 
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
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 not have any options flags set' do
39
- # Flog.expects(:new).with({}).returns(@flog)
40
- # run_command
23
+ # it 'should run' do
24
+ # lambda { run_command }.wont_raise_error(Errno::ENOENT)
41
25
  # end
42
-
43
- it 'should call flog_files on the Flog instance' do
44
- @flog.expects(:flog_files)
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 "should set the option to show all methods" do
75
- # Flog.expects(:new).with(:all => true).returns(@flog)
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
- it 'should exit with status 0' do
80
- self.expects(:exit).with(0)
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 "should set the option to show all methods" do
96
- # Flog.expects(:new).with(:all => true).returns(@flog)
53
+ # it 'should call report on the Flog instance' do
54
+ # @flog.expects(:report)
97
55
  # run_command
98
56
  # end
99
-
100
- it 'should exit with status 0' do
101
- self.expects(:exit).with(0)
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
- # it "should set the option to show only the score" do
117
- # Flog.expects(:new).with(:score => true).returns(@flog)
118
- # run_command
64
+ # describe "when -a is specified on the command-line" do
65
+ # before :each do
66
+ # ARGV.replace ['-a']
119
67
  # end
120
-
121
- it 'should exit with status 0' do
122
- self.expects(:exit).with(0)
123
- run_command
124
- end
125
- end
126
-
127
- describe "when --score is specified on the command-line" do
128
- before :each do
129
- ARGV.replace ['--score']
130
- end
131
-
132
- # it 'should create a Flog instance' do
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
- # it "should set the option to show only the score" do
138
- # Flog.expects(:new).with(:score => true).returns(@flog)
139
- # run_command
85
+ # describe "when --all is specified on the command-line" do
86
+ # before :each do
87
+ # ARGV.replace ['--all']
140
88
  # end
141
-
142
- it 'should exit with status 0' do
143
- self.expects(:exit).with(0)
144
- run_command
145
- end
146
- end
147
-
148
- describe "when -m is specified on the command-line" do
149
- before :each do
150
- ARGV.replace ['-m']
151
- end
152
-
153
- # it 'should create a Flog instance' do
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
- # it "should set the option to report on methods only" do
159
- # Flog.expects(:new).with(:methods => true).returns(@flog)
160
- # run_command
106
+ # describe "when -s is specified on the command-line" do
107
+ # before :each do
108
+ # ARGV.replace ['-s']
161
109
  # end
162
-
163
- it 'should exit with status 0' do
164
- self.expects(:exit).with(0)
165
- run_command
166
- end
167
- end
168
-
169
- describe "when --methods-only is specified on the command-line" do
170
- before :each do
171
- ARGV.replace ['--methods-only']
172
- end
173
-
174
- # it 'should create a Flog instance' do
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
- # it "should set the option to report on methods only" do
180
- # Flog.expects(:new).with(:methods => true).returns(@flog)
181
- # run_command
127
+ # describe "when --score is specified on the command-line" do
128
+ # before :each do
129
+ # ARGV.replace ['--score']
182
130
  # end
183
-
184
- it 'should exit with status 0' do
185
- self.expects(:exit).with(0)
186
- run_command
187
- end
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)
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
- # it "should set the option to be verbose" do
201
- # Flog.expects(:new).with(:verbose => true).returns(@flog)
202
- # run_command
148
+ # describe "when -m is specified on the command-line" do
149
+ # before :each do
150
+ # ARGV.replace ['-m']
203
151
  # end
204
-
205
- it 'should exit with status 0' do
206
- self.expects(:exit).with(0)
207
- run_command
208
- end
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)
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
- # HACK
223
- # it "should set the option to be verbose" do
224
- # Flog.expects(:new).with(:verbose => true).returns(@flog)
225
- # run_command
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
- # HACK
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
- 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)
242
- run_command
243
- end
244
-
245
- # HACK: useless anyhow
246
- # it 'should not create a Flog instance' do
247
- # Flog.expects(:new).never
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
- it 'should exit with status 0' do
252
- self.expects(:exit).with(0)
253
- run_command
254
- end
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)
264
- run_command
265
- end
266
-
267
- # HACK: useless anyhow
268
- # it 'should not create a Flog instance' do
269
- # Flog.expects(:new).never
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
- it 'should exit with status 0' do
274
- self.expects(:exit).with(0)
275
- run_command
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
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
- # it 'should create a Flog instance' do
292
- # Flog.expects(:new).returns(@flog)
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
- it 'should exit with status 0' do
297
- self.expects(:exit).with(0)
298
- run_command
299
- end
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)
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 "should set the option to provide 'blame' information" do
313
- # Flog.expects(:new).with(:blame => true).returns(@flog)
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
- it 'should exit with status 0' do
318
- self.expects(:exit).with(0)
319
- run_command
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
327
-
328
- # it 'should create a Flog instance' do
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 "should set the option to provide 'blame' information" do
334
- # Flog.expects(:new).with(:blame => true).returns(@flog)
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
- it 'should exit with status 0' do
339
- self.expects(:exit).with(0)
340
- run_command
341
- end
342
- end
343
- end
342
+ # end
343
+ # end