Defect #5329 » functional_test_for_problem.patch
| functional/timelog_controller_test.rb (working copy) | ||
|---|---|---|
|
assert_response :success
|
||
|
assert_template 'report'
|
||
|
assert_not_nil assigns(:total_hours)
|
||
|
assert_equal "162.90", "%.2f" % assigns(:total_hours)
|
||
|
assert_equal "165.90", "%.2f" % assigns(:total_hours)
|
||
|
end
|
||
|
def test_report_all_time_by_day
|
||
| ... | ... | |
|
assert_response :success
|
||
|
assert_template 'report'
|
||
|
assert_not_nil assigns(:total_hours)
|
||
|
assert_equal "162.90", "%.2f" % assigns(:total_hours)
|
||
|
assert_equal "165.90", "%.2f" % assigns(:total_hours)
|
||
|
assert_tag :tag => 'th', :content => '2007-03-12'
|
||
|
end
|
||
|
|
||
| ... | ... | |
|
assert_equal "8.65", "%.2f" % assigns(:total_hours)
|
||
|
end
|
||
|
|
||
|
def test_report_one_criteria_year_spanning_week
|
||
|
get :report, :project_id => 1, :columns => 'week', :from => "2009-12-01", :to => "2010-01-31", :criterias => ['project']
|
||
|
assert_response :success
|
||
|
assert_template 'report'
|
||
|
assert_not_nil assigns(:total_hours)
|
||
|
assert_equal "3.00", "%.2f" % assigns(:total_hours)
|
||
|
|
||
|
assert_not_nil assigns(:hours)
|
||
|
assert_equal 1, assigns(:hours).count
|
||
|
|
||
|
week = assigns(:hours)[0]
|
||
|
assert_equal "2009-53", week["week"]
|
||
|
assert_equal "3.00", "%.2f" % week["hours"]
|
||
|
end
|
||
|
|
||
|
|
||
|
def test_report_two_criterias
|
||
|
get :report, :project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criterias => ["member", "activity"]
|
||
|
assert_response :success
|
||
| ... | ... | |
|
assert_not_nil assigns(:total_hours)
|
||
|
assert_not_nil assigns(:criterias)
|
||
|
assert_equal 3, assigns(:criterias).size
|
||
|
assert_equal "162.90", "%.2f" % assigns(:total_hours)
|
||
|
assert_equal "165.90", "%.2f" % assigns(:total_hours)
|
||
|
# Custom field column
|
||
|
assert_tag :tag => 'th', :content => 'Database'
|
||
|
# Custom field row
|
||
| ... | ... | |
|
assert_response :success
|
||
|
assert_template 'details'
|
||
|
assert_not_nil assigns(:total_hours)
|
||
|
assert_equal "162.90", "%.2f" % assigns(:total_hours)
|
||
|
assert_equal "165.90", "%.2f" % assigns(:total_hours)
|
||
|
end
|
||
|
|
||
|
def test_project_details_routing
|
||
| ... | ... | |
|
assert_response :success
|
||
|
assert_template 'details'
|
||
|
assert_not_nil assigns(:entries)
|
||
|
assert_equal 4, assigns(:entries).size
|
||
|
assert_equal 6, assigns(:entries).size
|
||
|
# project and subproject
|
||
|
assert_equal [1, 3], assigns(:entries).collect(&:project_id).uniq.sort
|
||
|
assert_not_nil assigns(:total_hours)
|
||
|
assert_equal "162.90", "%.2f" % assigns(:total_hours)
|
||
|
assert_equal "165.90", "%.2f" % assigns(:total_hours)
|
||
|
# display all time by default
|
||
|
assert_equal '2007-03-11'.to_date, assigns(:from)
|
||
|
assert_equal '2007-04-22'.to_date, assigns(:to)
|
||
|
assert_equal '2010-01-01'.to_date, assigns(:to)
|
||
|
end
|
||
|
|
||
|
def test_details_at_project_level_with_date_range
|
||
| ... | ... | |
|
assert_equal 154.25, assigns(:total_hours)
|
||
|
# display all time by default
|
||
|
assert_equal '2007-03-11'.to_date, assigns(:from)
|
||
|
assert_equal '2007-04-22'.to_date, assigns(:to)
|
||
|
assert_equal '2010-01-01'.to_date, assigns(:to)
|
||
|
end
|
||
|
|
||
|
def test_details_formatted_routing
|
||
| fixtures/time_entries.yml (working copy) | ||
|---|---|---|
|
hours: 7.65
|
||
|
user_id: 1
|
||
|
tyear: 2007
|
||
|
time_entries_005:
|
||
|
created_on: 2010-04-22 12:20:48 +02:00
|
||
|
tweek: 53
|
||
|
tmonth: 12
|
||
|
project_id: 1
|
||
|
comments: "old year, old week"
|
||
|
updated_on: 2010-04-22 12:20:48 +02:00
|
||
|
activity_id: 10
|
||
|
spent_on: 2009-12-31
|
||
|
issue_id: 2
|
||
|
id: 5
|
||
|
hours: 1
|
||
|
user_id: 1
|
||
|
tyear: 2009
|
||
|
time_entries_006:
|
||
|
created_on: 2010-04-22 12:20:48 +02:00
|
||
|
tweek: 53
|
||
|
tmonth: 1
|
||
|
project_id: 1
|
||
|
comments: "new year, old week"
|
||
|
updated_on: 2007-04-22 12:20:48 +02:00
|
||
|
activity_id: 10
|
||
|
spent_on: 2010-01-01
|
||
|
issue_id: 2
|
||
|
id: 6
|
||
|
hours: 2
|
||
|
user_id: 1
|
||
|
tyear: 2010
|
||