freshtrack 0.4.2 → 0.5.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.
@@ -1,38 +1,38 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
2
2
 
3
3
  describe FreshBooks::TimeEntry do
4
- before :each do
4
+ before do
5
5
  @time_entry = FreshBooks::TimeEntry.new
6
6
  end
7
7
 
8
8
  describe 'attributes' do
9
9
  it 'should have a time_entry_id' do
10
- @time_entry.should respond_to(:time_entry_id)
10
+ @time_entry.should.respond_to(:time_entry_id)
11
11
  end
12
12
 
13
13
  it 'should have a project_id' do
14
- @time_entry.should respond_to(:project_id)
14
+ @time_entry.should.respond_to(:project_id)
15
15
  end
16
16
 
17
17
  it 'should have a task_id' do
18
- @time_entry.should respond_to(:task_id)
18
+ @time_entry.should.respond_to(:task_id)
19
19
  end
20
20
 
21
21
  it 'should have hours' do
22
- @time_entry.should respond_to(:hours)
22
+ @time_entry.should.respond_to(:hours)
23
23
  end
24
24
 
25
25
  it 'should have a date' do
26
- @time_entry.should respond_to(:date)
26
+ @time_entry.should.respond_to(:date)
27
27
  end
28
28
 
29
29
  it 'should have notes' do
30
- @time_entry.should respond_to(:notes)
30
+ @time_entry.should.respond_to(:notes)
31
31
  end
32
32
  end
33
33
 
34
34
  describe 'type mappings' do
35
- before :each do
35
+ before do
36
36
  @mapping = FreshBooks::TimeEntry::TYPE_MAPPINGS
37
37
  end
38
38
 
@@ -58,25 +58,25 @@ describe FreshBooks::TimeEntry do
58
58
  end
59
59
 
60
60
  describe 'creating an instance' do
61
- before :each do
62
- @response = stub('response', :success? => nil)
63
- FreshBooks.stubs(:call_api).returns(@response)
61
+ before do
62
+ @response = mock('response', :success? => nil)
63
+ FreshBooks.stub!(:call_api).and_return(@response)
64
64
  end
65
65
 
66
66
  it 'should issue a request with the instance' do
67
- FreshBooks.expects(:call_api).with('time_entry.create', 'time_entry' => @time_entry).returns(@response)
67
+ FreshBooks.should.receive(:call_api).with('time_entry.create', 'time_entry' => @time_entry).and_return(@response)
68
68
  @time_entry.create
69
69
  end
70
70
 
71
71
  describe 'with a successful request' do
72
- before :each do
72
+ before do
73
73
  @time_entry_id = 5
74
- @response.stubs(:elements).returns([stub('pre element'), stub('element', :text => @time_entry_id.to_s), stub('post element')])
75
- @response.stubs(:success?).returns(true)
74
+ @response.stub!(:elements).and_return([mock('pre element'), mock('element', :text => @time_entry_id.to_s), mock('post element')])
75
+ @response.stub!(:success?).and_return(true)
76
76
  end
77
77
 
78
78
  it 'should set the ID from the response' do
79
- @time_entry.expects(:time_entry_id=).with(@time_entry_id)
79
+ @time_entry.should.receive(:time_entry_id=).with(@time_entry_id)
80
80
  @time_entry.create
81
81
  end
82
82
 
@@ -86,265 +86,265 @@ describe FreshBooks::TimeEntry do
86
86
  end
87
87
 
88
88
  describe 'with an unsuccessful request' do
89
- before :each do
90
- @response.stubs(:success?).returns(false)
89
+ before do
90
+ @response.stub!(:success?).and_return(false)
91
91
  end
92
92
 
93
93
  it 'should not set the ID' do
94
- @time_entry.expects(:time_entry_id=).never
94
+ @time_entry.should.receive(:time_entry_id=).never
95
95
  @time_entry.create
96
96
  end
97
97
 
98
98
  it 'should return nil' do
99
- @time_entry.create.should be_nil
99
+ @time_entry.create.should.be.nil
100
100
  end
101
101
  end
102
102
  end
103
103
 
104
104
  describe 'updating an instance' do
105
- before :each do
106
- @response = stub('response', :success? => nil)
107
- FreshBooks.stubs(:call_api).returns(@response)
105
+ before do
106
+ @response = mock('response', :success? => nil)
107
+ FreshBooks.stub!(:call_api).and_return(@response)
108
108
  end
109
109
 
110
110
  it 'should issue a request with the instance' do
111
- FreshBooks.expects(:call_api).with('time_entry.update', 'time_entry' => @time_entry).returns(@response)
111
+ FreshBooks.should.receive(:call_api).with('time_entry.update', 'time_entry' => @time_entry).and_return(@response)
112
112
  @time_entry.update
113
113
  end
114
114
 
115
115
  describe 'with a successful request' do
116
- before :each do
117
- @response.stubs(:success?).returns(true)
116
+ before do
117
+ @response.stub!(:success?).and_return(true)
118
118
  end
119
119
 
120
120
  it 'should return true' do
121
- @time_entry.update.should be(true)
121
+ @time_entry.update.should == true
122
122
  end
123
123
  end
124
124
 
125
125
  describe 'with an unsuccessful request' do
126
- before :each do
127
- @response.stubs(:success?).returns(false)
126
+ before do
127
+ @response.stub!(:success?).and_return(false)
128
128
  end
129
129
 
130
130
  it 'should return false' do
131
- @time_entry.update.should be(false)
131
+ @time_entry.update.should == false
132
132
  end
133
133
  end
134
134
  end
135
135
 
136
136
  describe 'deleting an instance' do
137
- before :each do
137
+ before do
138
138
  @time_entry_id = '5'
139
- @response = stub('response', :success? => nil)
140
- FreshBooks.stubs(:call_api).returns(@response)
139
+ @response = mock('response', :success? => nil)
140
+ FreshBooks.stub!(:call_api).and_return(@response)
141
141
  end
142
142
 
143
143
  describe 'from the class' do
144
144
  it 'should require an argument' do
145
- lambda { FreshBooks::TimeEntry.delete }.should raise_error(ArgumentError)
145
+ lambda { FreshBooks::TimeEntry.delete }.should.raise(ArgumentError)
146
146
  end
147
147
 
148
148
  it 'should accept an argument' do
149
- lambda { FreshBooks::TimeEntry.delete('arg') }.should_not raise_error(ArgumentError)
149
+ lambda { FreshBooks::TimeEntry.delete('arg') }.should.not.raise(ArgumentError)
150
150
  end
151
151
 
152
152
  it 'should issue a request with the supplied ID' do
153
- FreshBooks.expects(:call_api).with('time_entry.delete', 'time_entry_id' => @time_entry_id).returns(@response)
153
+ FreshBooks.should.receive(:call_api).with('time_entry.delete', 'time_entry_id' => @time_entry_id).and_return(@response)
154
154
  FreshBooks::TimeEntry.delete(@time_entry_id)
155
155
  end
156
156
 
157
157
  describe 'with a successful request' do
158
- before :each do
159
- @response.stubs(:success?).returns(true)
158
+ before do
159
+ @response.stub!(:success?).and_return(true)
160
160
  end
161
161
 
162
162
  it 'should return true' do
163
- FreshBooks::TimeEntry.delete(@time_entry_id).should be(true)
163
+ FreshBooks::TimeEntry.delete(@time_entry_id).should == true
164
164
  end
165
165
  end
166
166
 
167
167
  describe 'with an unsuccessful request' do
168
- before :each do
169
- @response.stubs(:success?).returns(false)
168
+ before do
169
+ @response.stub!(:success?).and_return(false)
170
170
  end
171
171
 
172
172
  it 'should return false' do
173
- FreshBooks::TimeEntry.delete(@time_entry_id).should be(false)
173
+ FreshBooks::TimeEntry.delete(@time_entry_id).should == false
174
174
  end
175
175
  end
176
176
  end
177
177
 
178
178
  describe 'from the instance' do
179
- before :each do
180
- @time_entry.stubs(:time_entry_id).returns(@time_entry_id)
181
- FreshBooks::TimeEntry.stubs(:delete)
179
+ before do
180
+ @time_entry.stub!(:time_entry_id).and_return(@time_entry_id)
181
+ FreshBooks::TimeEntry.stub!(:delete)
182
182
  end
183
183
 
184
184
  it 'should delegate to the class' do
185
- FreshBooks::TimeEntry.expects(:delete)
185
+ FreshBooks::TimeEntry.should.receive(:delete)
186
186
  @time_entry.delete
187
187
  end
188
188
 
189
189
  it 'should pass its ID to the class method' do
190
- FreshBooks::TimeEntry.expects(:delete).with(@time_entry_id)
190
+ FreshBooks::TimeEntry.should.receive(:delete).with(@time_entry_id)
191
191
  @time_entry.delete
192
192
  end
193
193
 
194
194
  it 'should return the result from the class method' do
195
- val = stub('return val')
196
- FreshBooks::TimeEntry.stubs(:delete).returns(val)
195
+ val = mock('return val')
196
+ FreshBooks::TimeEntry.stub!(:delete).and_return(val)
197
197
  @time_entry.delete.should == val
198
198
  end
199
199
  end
200
200
  end
201
201
 
202
202
  describe 'getting an instance' do
203
- before :each do
203
+ before do
204
204
  @time_entry_id = 1
205
- @element = stub('element')
206
- @response = stub('response', :elements => [stub('pre element'), @element, stub('post element')], :success? => nil)
207
- FreshBooks.stubs(:call_api).returns(@response)
205
+ @element = mock('element')
206
+ @response = mock('response', :elements => [mock('pre element'), @element, mock('post element')], :success? => nil)
207
+ FreshBooks.stub!(:call_api).and_return(@response)
208
208
  end
209
209
 
210
210
  it 'should require an argument' do
211
- lambda { FreshBooks::TimeEntry.get }.should raise_error(ArgumentError)
211
+ lambda { FreshBooks::TimeEntry.get }.should.raise(ArgumentError)
212
212
  end
213
213
 
214
214
  it 'should accept an argument' do
215
- lambda { FreshBooks::TimeEntry.get(@time_entry_id) }.should_not raise_error(ArgumentError)
215
+ lambda { FreshBooks::TimeEntry.get(@time_entry_id) }.should.not.raise(ArgumentError)
216
216
  end
217
217
 
218
218
  it 'should issue a request for the supplied ID' do
219
- FreshBooks.expects(:call_api).with('time_entry.get', 'time_entry_id' => @time_entry_id).returns(@response)
219
+ FreshBooks.should.receive(:call_api).with('time_entry.get', 'time_entry_id' => @time_entry_id).and_return(@response)
220
220
  FreshBooks::TimeEntry.get(@time_entry_id)
221
221
  end
222
222
 
223
223
  describe 'with a successful request' do
224
- before :each do
225
- @response.stubs(:success?).returns(true)
224
+ before do
225
+ @response.stub!(:success?).and_return(true)
226
226
  end
227
227
 
228
228
  it 'should instantiate a new time_entry instance from the request' do
229
- FreshBooks::TimeEntry.expects(:new_from_xml).with(@element)
229
+ FreshBooks::TimeEntry.should.receive(:new_from_xml).with(@element)
230
230
  FreshBooks::TimeEntry.get(@time_entry_id)
231
231
  end
232
232
 
233
233
  it 'should return the time_entry instance' do
234
- val = stub('return val')
235
- FreshBooks::TimeEntry.stubs(:new_from_xml).returns(val)
234
+ val = mock('return val')
235
+ FreshBooks::TimeEntry.stub!(:new_from_xml).and_return(val)
236
236
  FreshBooks::TimeEntry.get(@time_entry_id).should == val
237
237
  end
238
238
  end
239
239
 
240
240
  describe 'with an unsuccessful request' do
241
- before :each do
242
- @response.stubs(:success?).returns(false)
241
+ before do
242
+ @response.stub!(:success?).and_return(false)
243
243
  end
244
244
 
245
245
  it 'should return nil' do
246
- FreshBooks::TimeEntry.get(@time_entry_id).should be_nil
246
+ FreshBooks::TimeEntry.get(@time_entry_id).should.be.nil
247
247
  end
248
248
  end
249
249
  end
250
250
 
251
251
  describe 'getting a list' do
252
- before :each do
252
+ before do
253
253
  @time_entry_id = 1
254
- @elements = Array.new(3) { stub('list element') }
255
- @response = stub('response', :elements => [stub('pre element'), stub('element', :elements => @elements), stub('post element')], :success? => nil)
256
- FreshBooks.stubs(:call_api).returns(@response)
254
+ @elements = Array.new(3) { mock('list element') }
255
+ @response = mock('response', :elements => [mock('pre element'), mock('element', :elements => @elements), mock('post element')], :success? => nil)
256
+ FreshBooks.stub!(:call_api).and_return(@response)
257
257
  end
258
258
 
259
259
  it 'should not require an argument' do
260
- lambda { FreshBooks::TimeEntry.list }.should_not raise_error(ArgumentError)
260
+ lambda { FreshBooks::TimeEntry.list }.should.not.raise(ArgumentError)
261
261
  end
262
262
 
263
263
  it 'should accept an argument' do
264
- lambda { FreshBooks::TimeEntry.list('arg') }.should_not raise_error(ArgumentError)
264
+ lambda { FreshBooks::TimeEntry.list('arg') }.should.not.raise(ArgumentError)
265
265
  end
266
266
 
267
267
  it 'should issue a request for the time_entry list' do
268
- FreshBooks.expects(:call_api).with('time_entry.list', {}).returns(@response)
268
+ FreshBooks.should.receive(:call_api).with('time_entry.list', {}).and_return(@response)
269
269
  FreshBooks::TimeEntry.list
270
270
  end
271
271
 
272
272
  it 'should pass the argument to the request' do
273
- arg = stub('arg')
274
- FreshBooks.expects(:call_api).with('time_entry.list', arg).returns(@response)
273
+ arg = mock('arg')
274
+ FreshBooks.should.receive(:call_api).with('time_entry.list', arg).and_return(@response)
275
275
  FreshBooks::TimeEntry.list(arg)
276
276
  end
277
277
 
278
278
  describe 'with a successful request' do
279
- before :each do
280
- @response.stubs(:success?).returns(true)
279
+ before do
280
+ @response.stub!(:success?).and_return(true)
281
281
  end
282
282
 
283
283
  it 'should instantiate new time_entry instances from the request' do
284
284
  @elements.each do |element|
285
- FreshBooks::TimeEntry.expects(:new_from_xml).with(element)
285
+ FreshBooks::TimeEntry.should.receive(:new_from_xml).with(element)
286
286
  end
287
287
  FreshBooks::TimeEntry.list
288
288
  end
289
289
 
290
290
  it 'should return the time_entry instances' do
291
- vals = Array.new(@elements.length) { stub('return val') }
291
+ vals = Array.new(@elements.length) { mock('return val') }
292
292
  @elements.each_with_index do |element, i|
293
- FreshBooks::TimeEntry.stubs(:new_from_xml).with(element).returns(vals[i])
293
+ FreshBooks::TimeEntry.stub!(:new_from_xml).with(element).and_return(vals[i])
294
294
  end
295
295
  FreshBooks::TimeEntry.list.should == vals
296
296
  end
297
297
  end
298
298
 
299
299
  describe 'with an unsuccessful request' do
300
- before :each do
301
- @response.stubs(:success?).returns(false)
300
+ before do
301
+ @response.stub!(:success?).and_return(false)
302
302
  end
303
303
 
304
304
  it 'should return nil' do
305
- FreshBooks::TimeEntry.list.should be_nil
305
+ FreshBooks::TimeEntry.list.should.be.nil
306
306
  end
307
307
  end
308
308
  end
309
309
 
310
310
  it 'should have a task' do
311
- @time_entry.should respond_to(:task)
311
+ @time_entry.should.respond_to(:task)
312
312
  end
313
313
 
314
314
  describe 'task' do
315
315
  it 'should find task based on task_id' do
316
- task_id = stub('task ID')
317
- @time_entry.stubs(:task_id).returns(task_id)
318
- FreshBooks::Task.expects(:get).with(task_id)
316
+ task_id = mock('task ID')
317
+ @time_entry.stub!(:task_id).and_return(task_id)
318
+ FreshBooks::Task.should.receive(:get).with(task_id)
319
319
  @time_entry.task
320
320
  end
321
321
 
322
322
  it 'should return found task' do
323
- task = stub('task')
324
- task_id = stub('task ID')
325
- @time_entry.stubs(:task_id).returns(task_id)
326
- FreshBooks::Task.expects(:get).with(task_id).returns(task)
323
+ task = mock('task')
324
+ task_id = mock('task ID')
325
+ @time_entry.stub!(:task_id).and_return(task_id)
326
+ FreshBooks::Task.should.receive(:get).with(task_id).and_return(task)
327
327
  @time_entry.task.should == task
328
328
  end
329
329
  end
330
330
 
331
331
  it 'should have a project' do
332
- @time_entry.should respond_to(:project)
332
+ @time_entry.should.respond_to(:project)
333
333
  end
334
334
 
335
335
  describe 'project' do
336
336
  it 'should find project based on project_id' do
337
- project_id = stub('project ID')
338
- @time_entry.stubs(:project_id).returns(project_id)
339
- FreshBooks::Project.expects(:get).with(project_id)
337
+ project_id = mock('project ID')
338
+ @time_entry.stub!(:project_id).and_return(project_id)
339
+ FreshBooks::Project.should.receive(:get).with(project_id)
340
340
  @time_entry.project
341
341
  end
342
342
 
343
343
  it 'should return found project' do
344
- project = stub('project')
345
- project_id = stub('project ID')
346
- @time_entry.stubs(:project_id).returns(project_id)
347
- FreshBooks::Project.expects(:get).with(project_id).returns(project)
344
+ project = mock('project')
345
+ project_id = mock('project ID')
346
+ @time_entry.stub!(:project_id).and_return(project_id)
347
+ FreshBooks::Project.should.receive(:get).with(project_id).and_return(project)
348
348
  @time_entry.project.should == project
349
349
  end
350
350
  end
@@ -1,46 +1,53 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper.rb')
2
2
 
3
- describe 'freshtrack command' do
4
- def run_command(*args)
5
- Object.const_set(:ARGV, args)
6
- begin
7
- eval File.read(File.join(File.dirname(__FILE__), *%w[.. bin freshtrack]))
8
- rescue SystemExit
9
- end
3
+ def run_command(*args)
4
+ Object.const_set(:ARGV, args)
5
+ begin
6
+ eval File.read(File.join(File.dirname(__FILE__), *%w[.. bin freshtrack]))
7
+ rescue SystemExit
10
8
  end
11
-
12
- before :each do
9
+ end
10
+
11
+ def pending(*args, &block)
12
+ end
13
+
14
+ describe 'freshtrack command' do
15
+ before do
13
16
  [:ARGV, :OPTIONS, :MANDATORY_OPTIONS].each do |const|
14
17
  Object.send(:remove_const, const) if Object.const_defined?(const)
15
18
  end
16
19
 
17
- Freshtrack.stubs(:init)
18
- Freshtrack.stubs(:track)
20
+ Freshtrack.stub!(:init)
21
+ Freshtrack.stub!(:track)
19
22
 
20
23
  @project = 'myproj'
21
24
  end
22
25
 
23
26
  it 'should exist' do
24
- lambda { run_command(@project) }.should_not raise_error(Errno::ENOENT)
27
+ lambda { run_command(@project) }.should.not.raise(Errno::ENOENT)
25
28
  end
26
29
 
27
30
  it 'should require a project' do
28
- self.expects(:puts) { |text| text.match(/usage.+project/i) }
31
+ self.should.receive(:puts) { |text| text.match(/usage.+project/i) }
29
32
  run_command
30
33
  end
31
34
 
32
- it 'should init Freshtrack' do
33
- Freshtrack.expects(:init)
35
+ it 'should init Freshtrack with the given project' do
36
+ Freshtrack.should.receive(:init) do |arg|
37
+ arg.should == @project
38
+ end
34
39
  run_command(@project)
35
40
  end
36
41
 
37
42
  it 'should track time' do
38
- Freshtrack.expects(:track)
43
+ Freshtrack.should.receive(:track)
39
44
  run_command(@project)
40
45
  end
41
46
 
42
47
  it 'should track time for the given project' do
43
- Freshtrack.expects(:track).with(@project, anything)
48
+ Freshtrack.should.receive(:track) do |project, _|
49
+ project.should == @project
50
+ end
44
51
  run_command(@project)
45
52
  end
46
53
 
@@ -48,116 +55,141 @@ describe 'freshtrack command' do
48
55
  it "should pass on an 'after' time option given by --after" do
49
56
  time_option = '2008-08-26 09:47'
50
57
  time = Time.local(2008, 8, 26, 9, 47)
51
- Freshtrack.expects(:track).with(@project, has_entry(:after => time))
58
+ Freshtrack.should.receive(:track) do |project, opts|
59
+ project.should == @project
60
+ opts[:after].should == time
61
+ end
52
62
  run_command(@project, '--after', time_option)
53
63
  end
54
64
 
55
65
  it "should pass on a 'before' time option given by --before" do
56
66
  time_option = '2008-08-23 15:39'
57
67
  time = Time.local(2008, 8, 23, 15, 39)
58
- Freshtrack.expects(:track).with(@project, has_entry(:before => time))
68
+ Freshtrack.should.receive(:track) do |project, opts|
69
+ project.should == @project
70
+ opts[:before].should == time
71
+ end
59
72
  run_command(@project, '--before', time_option)
60
73
  end
61
74
 
62
75
  it 'should handle a time option given as a date' do
63
76
  time_option = '2008-08-23'
64
77
  time = Time.local(2008, 8, 23)
65
- Freshtrack.expects(:track).with(@project, has_entry(:before => time))
78
+ Freshtrack.should.receive(:track) do |project, opts|
79
+ project.should == @project
80
+ opts[:before].should == time
81
+ end
66
82
  run_command(@project, '--before', time_option)
67
83
  end
68
84
  end
69
85
 
70
86
  it 'should pass no options if none specified' do
71
- Freshtrack.expects(:track).with(@project, {})
87
+ Freshtrack.should.receive(:track).with(@project, {})
72
88
  run_command(@project)
73
89
  end
74
90
 
75
91
  describe 'when --aging specified' do
76
- before :each do
92
+ before do
77
93
  @aging_info = [
78
94
  { :id => 5, :number => '123', :age => 31, :client => 'blah', :status => 'viewed', :amount => 123.3, :owed => 5.67 },
79
95
  { :id => 53, :number => '234', :age => 43, :client => 'bang', :status => 'sent', :amount => 60.0, :owed => 60.0 },
80
96
  { :id => 20, :number => '938', :age => 3, :client => 'boom', :status => 'viewed', :amount => 100.0, :owed => 100.0 }
81
97
  ]
82
- Freshtrack.stubs(:invoice_aging).returns(@aging_info)
83
- self.stubs(:printf)
98
+ Freshtrack.stub!(:invoice_aging).and_return(@aging_info)
99
+ self.stub!(:printf)
84
100
  end
85
101
 
86
- def aging_run
87
- run_command('--aging')
102
+ def aging_run(project=nil)
103
+ args = [project, '--aging'].compact
104
+ run_command(*args)
88
105
  end
89
106
 
90
107
  it 'should not require a project' do
91
- self.expects(:puts) { |text| text.match(/usage.+project/i) }.never
108
+ self.should.receive(:puts) { |text| text.match(/usage.+project/i) }.never
92
109
  aging_run
93
110
  end
94
111
 
95
- it 'should init Freshtrack' do
96
- Freshtrack.expects(:init)
112
+ it 'should init Freshtrack with a project if given' do
113
+ Freshtrack.should.receive(:init) do |arg|
114
+ arg.should == @project
115
+ end
116
+ aging_run(@project)
117
+ end
118
+
119
+ it 'should init Freshtrack for no project if none given' do
120
+ Freshtrack.should.receive(:init) do |arg|
121
+ arg.should.be.nil
122
+ end
97
123
  aging_run
98
124
  end
99
125
 
100
126
  it 'should get the invoice aging information' do
101
- Freshtrack.expects(:invoice_aging).returns(@aging_info)
127
+ Freshtrack.should.receive(:invoice_aging).and_return(@aging_info)
102
128
  aging_run
103
129
  end
104
130
 
105
131
  it 'should print the number of each invoice' do
106
- pending 'making this actually test what it purports to'
132
+ pending 'making this actually test what it purports to' do
107
133
  @aging_info.each do |info|
108
- self.expects(:printf) { |*args| args.include?(info[:number]) }
134
+ self.should.receive(:printf) { |*args| args.should.include(info[:number]) }
109
135
  end
110
136
  aging_run
137
+ end
111
138
  end
112
139
 
113
140
  it 'should print the client of each invoice' do
114
- pending 'making this actually test what it purports to'
141
+ pending 'making this actually test what it purports to' do
115
142
  @aging_info.each do |info|
116
- self.expects(:printf) { |*args| args.include?(info[:client]) }
143
+ self.should.receive(:printf) { |*args| args.should.include(info[:client]) }
117
144
  end
118
145
  aging_run
146
+ end
119
147
  end
120
148
 
121
149
  it 'should print the age of each invoice' do
122
- pending 'making this actually test what it purports to'
150
+ pending 'making this actually test what it purports to' do
123
151
  @aging_info.each do |info|
124
- self.expects(:printf) { |*args| args.include?(info[:age]) }
152
+ self.should.receive(:printf) { |*args| args.should.include(info[:age]) }
125
153
  end
126
154
  aging_run
155
+ end
127
156
  end
128
157
 
129
158
  it 'should print the status of each invoice' do
130
- pending 'making this actually test what it purports to'
159
+ pending 'making this actually test what it purports to' do
131
160
  @aging_info.each do |info|
132
- self.expects(:printf) { |*args| args.include?(info[:status]) }
161
+ self.should.receive(:printf) { |*args| args.should.include(info[:status]) }
133
162
  end
134
163
  aging_run
164
+ end
135
165
  end
136
166
 
137
167
  it 'should print the amount of each invoice' do
138
- pending 'making this actually test what it purports to'
168
+ pending 'making this actually test what it purports to' do
139
169
  @aging_info.each do |info|
140
- self.expects(:printf) { |*args| args.include?(info[:amount]) }
170
+ self.should.receive(:printf) { |*args| args.should.include(info[:amount]) }
141
171
  end
142
172
  aging_run
173
+ end
143
174
  end
144
175
 
145
176
  it 'should print the owed of each invoice' do
146
- pending 'making this actually test what it purports to'
177
+ pending 'making this actually test what it purports to' do
147
178
  @aging_info.each do |info|
148
- self.expects(:printf) { |*args| args.include?(info[:owed]) }
179
+ self.should.receive(:printf) { |*args| args.should.include(info[:owed]) }
149
180
  end
150
181
  aging_run
182
+ end
151
183
  end
152
184
 
153
185
  it 'should not track time' do
154
- Freshtrack.expects(:track).never
186
+ Freshtrack.should.receive(:track).never
155
187
  aging_run
156
188
  end
157
189
 
158
190
  it 'should not track time even when given a project' do
159
- Freshtrack.expects(:track).never
160
- run_command('--aging', @project)
191
+ Freshtrack.should.receive(:track).never
192
+ aging_run(@project)
161
193
  end
162
194
  end
163
195
  end