Project

General

Profile

Defect #5329 » functional_test_for_problem.patch

Holger Just, 2010-04-15 19:56

View differences:

functional/timelog_controller_test.rb (working copy)
201 201
    assert_response :success
202 202
    assert_template 'report'
203 203
    assert_not_nil assigns(:total_hours)
204
    assert_equal "162.90", "%.2f" % assigns(:total_hours)
204
    assert_equal "165.90", "%.2f" % assigns(:total_hours)
205 205
  end
206 206

  
207 207
  def test_report_all_time_by_day
......
209 209
    assert_response :success
210 210
    assert_template 'report'
211 211
    assert_not_nil assigns(:total_hours)
212
    assert_equal "162.90", "%.2f" % assigns(:total_hours)
212
    assert_equal "165.90", "%.2f" % assigns(:total_hours)
213 213
    assert_tag :tag => 'th', :content => '2007-03-12'
214 214
  end
215 215
  
......
221 221
    assert_equal "8.65", "%.2f" % assigns(:total_hours)
222 222
  end
223 223
  
224
  def test_report_one_criteria_year_spanning_week
225
    get :report, :project_id => 1, :columns => 'week', :from => "2009-12-01", :to => "2010-01-31", :criterias => ['project']
226
    assert_response :success
227
    assert_template 'report'
228
    assert_not_nil assigns(:total_hours)
229
    assert_equal "3.00", "%.2f" % assigns(:total_hours)
230
    
231
    assert_not_nil assigns(:hours)
232
    assert_equal 1, assigns(:hours).count
233
    
234
    week = assigns(:hours)[0]
235
    assert_equal "2009-53", week["week"]
236
    assert_equal "3.00", "%.2f" % week["hours"]
237
  end
238
  
239
  
224 240
  def test_report_two_criterias
225 241
    get :report, :project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criterias => ["member", "activity"]
226 242
    assert_response :success
......
252 268
    assert_not_nil assigns(:total_hours)
253 269
    assert_not_nil assigns(:criterias)
254 270
    assert_equal 3, assigns(:criterias).size
255
    assert_equal "162.90", "%.2f" % assigns(:total_hours)
271
    assert_equal "165.90", "%.2f" % assigns(:total_hours)
256 272
    # Custom field column
257 273
    assert_tag :tag => 'th', :content => 'Database'
258 274
    # Custom field row
......
299 315
    assert_response :success
300 316
    assert_template 'details'
301 317
    assert_not_nil assigns(:total_hours)
302
    assert_equal "162.90", "%.2f" % assigns(:total_hours)
318
    assert_equal "165.90", "%.2f" % assigns(:total_hours)
303 319
  end
304 320
  
305 321
  def test_project_details_routing
......
314 330
    assert_response :success
315 331
    assert_template 'details'
316 332
    assert_not_nil assigns(:entries)
317
    assert_equal 4, assigns(:entries).size
333
    assert_equal 6, assigns(:entries).size
318 334
    # project and subproject
319 335
    assert_equal [1, 3], assigns(:entries).collect(&:project_id).uniq.sort
320 336
    assert_not_nil assigns(:total_hours)
321
    assert_equal "162.90", "%.2f" % assigns(:total_hours)
337
    assert_equal "165.90", "%.2f" % assigns(:total_hours)
322 338
    # display all time by default
323 339
    assert_equal '2007-03-11'.to_date, assigns(:from)
324
    assert_equal '2007-04-22'.to_date, assigns(:to)
340
    assert_equal '2010-01-01'.to_date, assigns(:to)
325 341
  end
326 342
  
327 343
  def test_details_at_project_level_with_date_range
......
381 397
    assert_equal 154.25, assigns(:total_hours)
382 398
    # display all time by default
383 399
    assert_equal '2007-03-11'.to_date, assigns(:from)
384
    assert_equal '2007-04-22'.to_date, assigns(:to)
400
    assert_equal '2010-01-01'.to_date, assigns(:to)
385 401
  end
386 402
  
387 403
  def test_details_formatted_routing
fixtures/time_entries.yml (working copy)
55 55
  hours: 7.65
56 56
  user_id: 1
57 57
  tyear: 2007
58
time_entries_005: 
59
  created_on: 2010-04-22 12:20:48 +02:00
60
  tweek: 53
61
  tmonth: 12
62
  project_id: 1
63
  comments: "old year, old week"
64
  updated_on: 2010-04-22 12:20:48 +02:00
65
  activity_id: 10
66
  spent_on: 2009-12-31
67
  issue_id: 2
68
  id: 5
69
  hours: 1
70
  user_id: 1
71
  tyear: 2009
72
time_entries_006: 
73
  created_on: 2010-04-22 12:20:48 +02:00
74
  tweek: 53
75
  tmonth: 1
76
  project_id: 1
77
  comments: "new year, old week"
78
  updated_on: 2007-04-22 12:20:48 +02:00
79
  activity_id: 10
80
  spent_on: 2010-01-01
81
  issue_id: 2
82
  id: 6
83
  hours: 2
84
  user_id: 1
85
  tyear: 2010
(1-1/4)