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.
data/spec/spec_helper.rb CHANGED
@@ -1,24 +1,6 @@
1
- begin
2
- require 'spec'
3
- rescue LoadError
4
- require 'rubygems'
5
- gem 'rspec'
6
- require 'spec'
7
- end
8
-
9
- # this is my favorite way to require ever
10
- begin
11
- require 'mocha'
12
- rescue LoadError
13
- require 'rubygems'
14
- gem 'mocha'
15
- require 'mocha'
16
- end
17
-
18
- Spec::Runner.configure do |config|
19
- config.mock_with :mocha
20
- end
1
+ require 'rubygems'
2
+ require 'bacon'
3
+ require 'facon'
21
4
 
22
5
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
23
-
24
6
  require 'freshtrack'
@@ -2,17 +2,17 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
2
2
  require 'freshtrack/time_collectors/one_inch_punch'
3
3
 
4
4
  describe Freshtrack::TimeCollector::OneInchPunch do
5
- before :each do
5
+ before do
6
6
  @collector = Freshtrack::TimeCollector::OneInchPunch.new
7
7
  end
8
8
 
9
9
  describe 'when initialized' do
10
10
  it 'should accept options' do
11
- lambda { Freshtrack::TimeCollector::OneInchPunch.new(:before => Time.now) }.should_not raise_error(ArgumentError)
11
+ lambda { Freshtrack::TimeCollector::OneInchPunch.new(:before => Time.now) }.should.not.raise(ArgumentError)
12
12
  end
13
13
 
14
14
  it 'should not require options' do
15
- lambda { Freshtrack::TimeCollector::OneInchPunch.new }.should_not raise_error(ArgumentError)
15
+ lambda { Freshtrack::TimeCollector::OneInchPunch.new }.should.not.raise(ArgumentError)
16
16
  end
17
17
 
18
18
  it 'should provide access to the given options' do
@@ -26,117 +26,119 @@ describe Freshtrack::TimeCollector::OneInchPunch do
26
26
  end
27
27
 
28
28
  it 'should get time data' do
29
- @collector.should respond_to(:get_time_data)
29
+ @collector.should.respond_to(:get_time_data)
30
30
  end
31
31
 
32
32
  describe 'getting time data' do
33
- before :each do
33
+ before do
34
34
  @project = 'myproj'
35
- @time_data = stub('time data')
36
- Punch.stubs(:load)
37
- Punch.stubs(:list).returns(@time_data)
38
- @collector.stubs(:condense_time_data)
35
+ @time_data = mock('time data')
36
+ Punch.stub!(:load)
37
+ Punch.stub!(:list).and_return(@time_data)
38
+ @collector.stub!(:condense_time_data)
39
39
  end
40
40
 
41
41
  it 'should accept a project' do
42
- lambda { @collector.get_time_data(@project) }.should_not raise_error(ArgumentError)
42
+ lambda { @collector.get_time_data(@project) }.should.not.raise(ArgumentError)
43
43
  end
44
44
 
45
45
  it 'should require a project' do
46
- lambda { @collector.get_time_data }.should raise_error(ArgumentError)
46
+ lambda { @collector.get_time_data }.should.raise(ArgumentError)
47
47
  end
48
48
 
49
49
  it 'should have punch load the time data' do
50
- Punch.expects(:load)
50
+ Punch.should.receive(:load)
51
51
  @collector.get_time_data(@project)
52
52
  end
53
53
 
54
54
  it 'should get the time data from punch' do
55
- Punch.expects(:list)
55
+ Punch.should.receive(:list)
56
56
  @collector.get_time_data(@project)
57
57
  end
58
58
 
59
59
  it 'should pass the supplied project when getting the time data' do
60
- Punch.expects(:list).with(@project, anything)
60
+ Punch.should.receive(:list) do |project, _|
61
+ project.should == @project
62
+ end
61
63
  @collector.get_time_data(@project)
62
64
  end
63
65
 
64
66
  it 'should pass the supplied options on when getting the time data' do
65
67
  options = { :after => Time.now - 12345 }
66
- @collector.stubs(:options).returns(options)
67
- Punch.expects(:list).with(@project, options)
68
+ @collector.stub!(:options).and_return(options)
69
+ Punch.should.receive(:list).with(@project, options)
68
70
  @collector.get_time_data(@project)
69
71
  end
70
72
 
71
73
  it 'should condense the time data' do
72
- @collector.expects(:condense_time_data).with(@time_data)
74
+ @collector.should.receive(:condense_time_data).with(@time_data)
73
75
  @collector.get_time_data(@project)
74
76
  end
75
77
 
76
78
  it 'should return the condensed data' do
77
- condensed = stub('condensed time data')
78
- @collector.stubs(:condense_time_data).returns(condensed)
79
+ condensed = mock('condensed time data')
80
+ @collector.stub!(:condense_time_data).and_return(condensed)
79
81
  @collector.get_time_data(@project).should == condensed
80
82
  end
81
83
  end
82
84
 
83
85
  it 'should condense time data' do
84
- @collector.should respond_to(:condense_time_data)
86
+ @collector.should.respond_to(:condense_time_data)
85
87
  end
86
88
 
87
89
  describe 'condensing time data' do
88
- before :each do
89
- @time_data = stub('time data')
90
- @collector.stubs(:times_to_dates)
91
- @collector.stubs(:group_date_data)
90
+ before do
91
+ @time_data = mock('time data')
92
+ @collector.stub!(:times_to_dates)
93
+ @collector.stub!(:group_date_data)
92
94
  end
93
95
 
94
96
  it 'should accept time data' do
95
- lambda { @collector.condense_time_data(@time_data) }.should_not raise_error(ArgumentError)
97
+ lambda { @collector.condense_time_data(@time_data) }.should.not.raise(ArgumentError)
96
98
  end
97
99
 
98
100
  it 'should require time data' do
99
- lambda { @collector.condense_time_data }.should raise_error(ArgumentError)
101
+ lambda { @collector.condense_time_data }.should.raise(ArgumentError)
100
102
  end
101
103
 
102
104
  it 'should convert times to dates and hour differences' do
103
- @collector.expects(:times_to_dates).with(@time_data)
105
+ @collector.should.receive(:times_to_dates).with(@time_data)
104
106
  @collector.condense_time_data(@time_data)
105
107
  end
106
108
 
107
109
  it 'should group date and hour differences' do
108
- date_hour_data = stub('date/hour data')
109
- @collector.stubs(:times_to_dates).returns(date_hour_data)
110
- @collector.expects(:group_date_data).with(date_hour_data)
110
+ date_hour_data = mock('date/hour data')
111
+ @collector.stub!(:times_to_dates).and_return(date_hour_data)
112
+ @collector.should.receive(:group_date_data).with(date_hour_data)
111
113
  @collector.condense_time_data(@time_data)
112
114
  end
113
115
 
114
116
  it 'should return the grouped date/hour data' do
115
- grouped_dates = stub('grouped date/hour data')
116
- @collector.stubs(:group_date_data).returns(grouped_dates)
117
+ grouped_dates = mock('grouped date/hour data')
118
+ @collector.stub!(:group_date_data).and_return(grouped_dates)
117
119
  @collector.condense_time_data(@time_data).should == grouped_dates
118
120
  end
119
121
  end
120
122
 
121
123
  it 'should convert times to dates and hour differences' do
122
- @collector.should respond_to(:times_to_dates)
124
+ @collector.should.respond_to(:times_to_dates)
123
125
  end
124
126
 
125
127
  describe 'converting times to dates and hour differences' do
126
- before :each do
128
+ before do
127
129
  @time_data = []
128
130
  end
129
131
 
130
132
  it 'should accept time data' do
131
- lambda { @collector.times_to_dates(@time_data) }.should_not raise_error(ArgumentError)
133
+ lambda { @collector.times_to_dates(@time_data) }.should.not.raise(ArgumentError)
132
134
  end
133
135
 
134
136
  it 'should require time data' do
135
- lambda { @collector.times_to_dates }.should raise_error(ArgumentError)
137
+ lambda { @collector.times_to_dates }.should.raise(ArgumentError)
136
138
  end
137
139
 
138
140
  it 'should return an array' do
139
- @collector.times_to_dates(@time_data).should be_kind_of(Array)
141
+ @collector.times_to_dates(@time_data).should.be.kind_of(Array)
140
142
  end
141
143
 
142
144
  it 'should replace the in/out time data with a single date' do
@@ -144,9 +146,9 @@ describe Freshtrack::TimeCollector::OneInchPunch do
144
146
  result = @collector.times_to_dates(@time_data)
145
147
  result = result.first
146
148
 
147
- result.should have_key('date')
148
- result.should_not have_key('in')
149
- result.should_not have_key('out')
149
+ result.should.has_key('date')
150
+ result.should.not.has_key('in')
151
+ result.should.not.has_key('out')
150
152
  end
151
153
 
152
154
  it 'should make the date appopriate to the time' do
@@ -167,7 +169,7 @@ describe Freshtrack::TimeCollector::OneInchPunch do
167
169
  @time_data.push({ 'in' => Time.local(2008, 1, 25, 6, 25, 0), 'out' => Time.local(2008, 1, 25, 7, 25, 0) })
168
170
  result = @collector.times_to_dates(@time_data)
169
171
  result = result.first
170
- result.should have_key('hours')
172
+ result.should.has_key('hours')
171
173
  end
172
174
 
173
175
  it 'should make the hour data appropriate to the in/out difference' do
@@ -179,24 +181,24 @@ describe Freshtrack::TimeCollector::OneInchPunch do
179
181
  end
180
182
 
181
183
  it 'should group date data' do
182
- @collector.should respond_to(:group_date_data)
184
+ @collector.should.respond_to(:group_date_data)
183
185
  end
184
186
 
185
187
  describe 'grouping date data' do
186
- before :each do
188
+ before do
187
189
  @date_data = []
188
190
  end
189
191
 
190
192
  it 'should accept date data' do
191
- lambda { @collector.group_date_data(@date_data) }.should_not raise_error(ArgumentError)
193
+ lambda { @collector.group_date_data(@date_data) }.should.not.raise(ArgumentError)
192
194
  end
193
195
 
194
196
  it 'should require date data' do
195
- lambda { @collector.group_date_data }.should raise_error(ArgumentError)
197
+ lambda { @collector.group_date_data }.should.raise(ArgumentError)
196
198
  end
197
199
 
198
200
  it 'should return an array' do
199
- @collector.group_date_data(@date_data).should be_kind_of(Array)
201
+ @collector.group_date_data(@date_data).should.be.kind_of(Array)
200
202
  end
201
203
 
202
204
  it 'should group the data by date' do
@@ -223,10 +225,10 @@ describe Freshtrack::TimeCollector::OneInchPunch do
223
225
  @date_data.push({ 'date' => today + 1, 'hours' => 2, 'log' => [] })
224
226
  result = @collector.group_date_data(@date_data)
225
227
 
226
- result[0]['date'].should == today
228
+ result[0]['date'].should == today
227
229
  result[0]['hours'].should == 4
228
230
 
229
- result[1]['date'].should == today + 1
231
+ result[1]['date'].should == today + 1
230
232
  result[1]['hours'].should == 2
231
233
  end
232
234
 
@@ -235,7 +237,7 @@ describe Freshtrack::TimeCollector::OneInchPunch do
235
237
  @date_data.push({ 'date' => today, 'hours' => 1.666666666, 'log' => [] })
236
238
  result = @collector.group_date_data(@date_data)
237
239
 
238
- result[0]['date'].should == today
240
+ result[0]['date'].should == today
239
241
  result[0]['hours'].should == 1.67
240
242
  end
241
243
 
@@ -246,13 +248,13 @@ describe Freshtrack::TimeCollector::OneInchPunch do
246
248
  @date_data.push({ 'date' => today + 1, 'hours' => 0, 'log' => ['punch in 3', 'punch out 3'] })
247
249
  result = @collector.group_date_data(@date_data)
248
250
 
249
- result[0]['date'].should == today
251
+ result[0]['date'].should == today
250
252
  result[0]['notes'].should == "punch in 1\npunch out 1\n--------------------\npunch in 2\npunch out 2"
251
- result[0].should_not have_key('log')
253
+ result[0].should.not.has_key('log')
252
254
 
253
- result[1]['date'].should == today + 1
255
+ result[1]['date'].should == today + 1
254
256
  result[1]['notes'].should == "punch in 3\npunch out 3"
255
- result[1].should_not have_key('log')
257
+ result[1].should.not.has_key('log')
256
258
  end
257
259
  end
258
260
  end
@@ -2,17 +2,17 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
2
2
  require 'freshtrack/time_collectors/punch'
3
3
 
4
4
  describe Freshtrack::TimeCollector::Punch do
5
- before :each do
5
+ before do
6
6
  @collector = Freshtrack::TimeCollector::Punch.new
7
7
  end
8
8
 
9
9
  describe 'when initialized' do
10
10
  it 'should accept options' do
11
- lambda { Freshtrack::TimeCollector::Punch.new(:before => Time.now) }.should_not raise_error(ArgumentError)
11
+ lambda { Freshtrack::TimeCollector::Punch.new(:before => Time.now) }.should.not.raise(ArgumentError)
12
12
  end
13
13
 
14
14
  it 'should not require options' do
15
- lambda { Freshtrack::TimeCollector::Punch.new }.should_not raise_error(ArgumentError)
15
+ lambda { Freshtrack::TimeCollector::Punch.new }.should.not.raise(ArgumentError)
16
16
  end
17
17
 
18
18
  it 'should provide access to the given options' do
@@ -26,33 +26,37 @@ describe Freshtrack::TimeCollector::Punch do
26
26
  end
27
27
 
28
28
  it 'should get time data' do
29
- @collector.should respond_to(:get_time_data)
29
+ @collector.should.respond_to(:get_time_data)
30
30
  end
31
31
 
32
32
  describe 'getting time data' do
33
- before :each do
33
+ before do
34
34
  @project = 'myproj'
35
- @time_data = stub('time data')
36
- IO.stubs(:read).returns(@time_data)
37
- @collector.stubs(:convert_time_data)
38
- @collector.stubs(:condense_time_data)
35
+ @time_data = mock('time data')
36
+ IO.stub!(:read).and_return(@time_data)
37
+ @collector.stub!(:convert_time_data)
38
+ @collector.stub!(:condense_time_data)
39
39
  end
40
40
 
41
41
  it 'should accept a project' do
42
- lambda { @collector.get_time_data(@project) }.should_not raise_error(ArgumentError)
42
+ lambda { @collector.get_time_data(@project) }.should.not.raise(ArgumentError)
43
43
  end
44
44
 
45
45
  it 'should require a project' do
46
- lambda { @collector.get_time_data }.should raise_error(ArgumentError)
46
+ lambda { @collector.get_time_data }.should.raise(ArgumentError)
47
47
  end
48
48
 
49
49
  it 'should get the time data (from punch)' do
50
- IO.expects(:read).with(regexp_matches(/^\| punch list\b/))
50
+ IO.should.receive(:read) do |arg|
51
+ arg.should.match(/^\| punch list\b/)
52
+ end
51
53
  @collector.get_time_data(@project)
52
54
  end
53
55
 
54
56
  it 'should pass the supplied project when getting the time data' do
55
- IO.expects(:read).with(regexp_matches(/\b#{@project}\b/))
57
+ IO.should.receive(:read) do |arg|
58
+ arg.should.match(/\b#{@project}\b/)
59
+ end
56
60
  @collector.get_time_data(@project)
57
61
  end
58
62
 
@@ -60,123 +64,127 @@ describe Freshtrack::TimeCollector::Punch do
60
64
  time = Time.local(2007, 3, 4, 13, 47, 56)
61
65
  options = { :after => time }
62
66
  option_str = '--after 2007-03-04T13:47:56-0500'
63
- @collector.stubs(:options).returns(options)
64
- IO.expects(:read).with(regexp_matches(/\b#{@project} #{option_str}\b/))
67
+ @collector.stub!(:options).and_return(options)
68
+ IO.should.receive(:read) do |arg|
69
+ arg.should.match(/\b#{@project} #{option_str}\b/)
70
+ end
65
71
  @collector.get_time_data(@project)
66
72
  end
67
73
 
68
74
  it 'should default option string to empty string' do
69
- IO.expects(:read).with(regexp_matches(/\b#{@project} $/))
75
+ IO.should.receive(:read) do |arg|
76
+ arg.should.match(/\b#{@project} $/)
77
+ end
70
78
  @collector.get_time_data(@project)
71
79
  end
72
80
 
73
81
  it 'should convert the time data' do
74
- @collector.expects(:convert_time_data).with(@time_data)
82
+ @collector.should.receive(:convert_time_data).with(@time_data)
75
83
  @collector.get_time_data(@project)
76
84
  end
77
85
 
78
86
  it 'should condense the converted time data' do
79
- converted_time_data = stub('converted time data')
80
- @collector.stubs(:convert_time_data).returns(converted_time_data)
81
- @collector.expects(:condense_time_data).with(converted_time_data)
87
+ converted_time_data = mock('converted time data')
88
+ @collector.stub!(:convert_time_data).and_return(converted_time_data)
89
+ @collector.should.receive(:condense_time_data).with(converted_time_data)
82
90
  @collector.get_time_data(@project)
83
91
  end
84
92
 
85
93
  it 'should return the condensed data' do
86
- condensed = stub('condensed time data')
87
- @collector.stubs(:condense_time_data).returns(condensed)
94
+ condensed = mock('condensed time data')
95
+ @collector.stub!(:condense_time_data).and_return(condensed)
88
96
  @collector.get_time_data(@project).should == condensed
89
97
  end
90
98
  end
91
99
 
92
100
  it 'should convert time data' do
93
- @collector.should respond_to(:convert_time_data)
101
+ @collector.should.respond_to(:convert_time_data)
94
102
  end
95
103
 
96
104
  describe 'converting time data' do
97
- before :each do
98
- @time_data = stub('time data')
99
- YAML.stubs(:load)
100
- @collector.stubs(:condense_time_data)
105
+ before do
106
+ @time_data = mock('time data')
107
+ YAML.stub!(:load)
108
+ @collector.stub!(:condense_time_data)
101
109
  end
102
110
 
103
111
  it 'should accept time data' do
104
- lambda { @collector.convert_time_data(@time_data) }.should_not raise_error(ArgumentError)
112
+ lambda { @collector.convert_time_data(@time_data) }.should.not.raise(ArgumentError)
105
113
  end
106
114
 
107
115
  it 'should require time data' do
108
- lambda { @collector.convert_time_data }.should raise_error(ArgumentError)
116
+ lambda { @collector.convert_time_data }.should.raise(ArgumentError)
109
117
  end
110
118
 
111
119
  it 'should convert the time data from YAML' do
112
- YAML.expects(:load).with(@time_data)
120
+ YAML.should.receive(:load).with(@time_data)
113
121
  @collector.convert_time_data(@time_data)
114
122
  end
115
123
 
116
124
  it 'should return the converted time data' do
117
- converted = stub('converted time data')
118
- YAML.stubs(:load).returns(converted)
125
+ converted = mock('converted time data')
126
+ YAML.stub!(:load).and_return(converted)
119
127
  @collector.convert_time_data(@time_data).should == converted
120
128
  end
121
129
  end
122
130
 
123
131
  it 'should condense time data' do
124
- @collector.should respond_to(:condense_time_data)
132
+ @collector.should.respond_to(:condense_time_data)
125
133
  end
126
134
 
127
135
  describe 'condensing time data' do
128
- before :each do
129
- @time_data = stub('time data')
130
- @collector.stubs(:times_to_dates)
131
- @collector.stubs(:group_date_data)
136
+ before do
137
+ @time_data = mock('time data')
138
+ @collector.stub!(:times_to_dates)
139
+ @collector.stub!(:group_date_data)
132
140
  end
133
141
 
134
142
  it 'should accept time data' do
135
- lambda { @collector.condense_time_data(@time_data) }.should_not raise_error(ArgumentError)
143
+ lambda { @collector.condense_time_data(@time_data) }.should.not.raise(ArgumentError)
136
144
  end
137
145
 
138
146
  it 'should require time data' do
139
- lambda { @collector.condense_time_data }.should raise_error(ArgumentError)
147
+ lambda { @collector.condense_time_data }.should.raise(ArgumentError)
140
148
  end
141
149
 
142
150
  it 'should convert times to dates and hour differences' do
143
- @collector.expects(:times_to_dates).with(@time_data)
151
+ @collector.should.receive(:times_to_dates).with(@time_data)
144
152
  @collector.condense_time_data(@time_data)
145
153
  end
146
154
 
147
155
  it 'should group date and hour differences' do
148
- date_hour_data = stub('date/hour data')
149
- @collector.stubs(:times_to_dates).returns(date_hour_data)
150
- @collector.expects(:group_date_data).with(date_hour_data)
156
+ date_hour_data = mock('date/hour data')
157
+ @collector.stub!(:times_to_dates).and_return(date_hour_data)
158
+ @collector.should.receive(:group_date_data).with(date_hour_data)
151
159
  @collector.condense_time_data(@time_data)
152
160
  end
153
161
 
154
162
  it 'should return the grouped date/hour data' do
155
- grouped_dates = stub('grouped date/hour data')
156
- @collector.stubs(:group_date_data).returns(grouped_dates)
163
+ grouped_dates = mock('grouped date/hour data')
164
+ @collector.stub!(:group_date_data).and_return(grouped_dates)
157
165
  @collector.condense_time_data(@time_data).should == grouped_dates
158
166
  end
159
167
  end
160
168
 
161
169
  it 'should convert times to dates and hour differences' do
162
- @collector.should respond_to(:times_to_dates)
170
+ @collector.should.respond_to(:times_to_dates)
163
171
  end
164
172
 
165
173
  describe 'converting times to dates and hour differences' do
166
- before :each do
174
+ before do
167
175
  @time_data = []
168
176
  end
169
177
 
170
178
  it 'should accept time data' do
171
- lambda { @collector.times_to_dates(@time_data) }.should_not raise_error(ArgumentError)
179
+ lambda { @collector.times_to_dates(@time_data) }.should.not.raise(ArgumentError)
172
180
  end
173
181
 
174
182
  it 'should require time data' do
175
- lambda { @collector.times_to_dates }.should raise_error(ArgumentError)
183
+ lambda { @collector.times_to_dates }.should.raise(ArgumentError)
176
184
  end
177
185
 
178
186
  it 'should return an array' do
179
- @collector.times_to_dates(@time_data).should be_kind_of(Array)
187
+ @collector.times_to_dates(@time_data).should.be.kind_of(Array)
180
188
  end
181
189
 
182
190
  it 'should replace the in/out time data with a single date' do
@@ -184,9 +192,9 @@ describe Freshtrack::TimeCollector::Punch do
184
192
  result = @collector.times_to_dates(@time_data)
185
193
  result = result.first
186
194
 
187
- result.should have_key('date')
188
- result.should_not have_key('in')
189
- result.should_not have_key('out')
195
+ result.should.has_key('date')
196
+ result.should.not.has_key('in')
197
+ result.should.not.has_key('out')
190
198
  end
191
199
 
192
200
  it 'should make the date appopriate to the time' do
@@ -207,7 +215,7 @@ describe Freshtrack::TimeCollector::Punch do
207
215
  @time_data.push({ 'in' => Time.local(2008, 1, 25, 6, 25, 0), 'out' => Time.local(2008, 1, 25, 7, 25, 0) })
208
216
  result = @collector.times_to_dates(@time_data)
209
217
  result = result.first
210
- result.should have_key('hours')
218
+ result.should.has_key('hours')
211
219
  end
212
220
 
213
221
  it 'should make the hour data appropriate to the in/out difference' do
@@ -219,24 +227,24 @@ describe Freshtrack::TimeCollector::Punch do
219
227
  end
220
228
 
221
229
  it 'should group date data' do
222
- @collector.should respond_to(:group_date_data)
230
+ @collector.should.respond_to(:group_date_data)
223
231
  end
224
232
 
225
233
  describe 'grouping date data' do
226
- before :each do
234
+ before do
227
235
  @date_data = []
228
236
  end
229
237
 
230
238
  it 'should accept date data' do
231
- lambda { @collector.group_date_data(@date_data) }.should_not raise_error(ArgumentError)
239
+ lambda { @collector.group_date_data(@date_data) }.should.not.raise(ArgumentError)
232
240
  end
233
241
 
234
242
  it 'should require date data' do
235
- lambda { @collector.group_date_data }.should raise_error(ArgumentError)
243
+ lambda { @collector.group_date_data }.should.raise(ArgumentError)
236
244
  end
237
245
 
238
246
  it 'should return an array' do
239
- @collector.group_date_data(@date_data).should be_kind_of(Array)
247
+ @collector.group_date_data(@date_data).should.be.kind_of(Array)
240
248
  end
241
249
 
242
250
  it 'should group the data by date' do
@@ -263,10 +271,10 @@ describe Freshtrack::TimeCollector::Punch do
263
271
  @date_data.push({ 'date' => today + 1, 'hours' => 2, 'log' => [] })
264
272
  result = @collector.group_date_data(@date_data)
265
273
 
266
- result[0]['date'].should == today
274
+ result[0]['date'].should == today
267
275
  result[0]['hours'].should == 4
268
276
 
269
- result[1]['date'].should == today + 1
277
+ result[1]['date'].should == today + 1
270
278
  result[1]['hours'].should == 2
271
279
  end
272
280
 
@@ -275,7 +283,7 @@ describe Freshtrack::TimeCollector::Punch do
275
283
  @date_data.push({ 'date' => today, 'hours' => 1.666666666, 'log' => [] })
276
284
  result = @collector.group_date_data(@date_data)
277
285
 
278
- result[0]['date'].should == today
286
+ result[0]['date'].should == today
279
287
  result[0]['hours'].should == 1.67
280
288
  end
281
289
 
@@ -286,13 +294,13 @@ describe Freshtrack::TimeCollector::Punch do
286
294
  @date_data.push({ 'date' => today + 1, 'hours' => 0, 'log' => ['punch in 3', 'punch out 3'] })
287
295
  result = @collector.group_date_data(@date_data)
288
296
 
289
- result[0]['date'].should == today
297
+ result[0]['date'].should == today
290
298
  result[0]['notes'].should == "punch in 1\npunch out 1\n--------------------\npunch in 2\npunch out 2"
291
- result[0].should_not have_key('log')
299
+ result[0].should.not.has_key('log')
292
300
 
293
- result[1]['date'].should == today + 1
301
+ result[1]['date'].should == today + 1
294
302
  result[1]['notes'].should == "punch in 3\npunch out 3"
295
- result[1].should_not have_key('log')
303
+ result[1].should.not.has_key('log')
296
304
  end
297
305
  end
298
306
  end