@@ -11,7 +11,7 class TimeEntryReportsControllerTest < ActionController::TestCase | |||||
11 | assert_tag :form, |
|
11 | assert_tag :form, | |
12 | :attributes => {:action => "/projects/ecookbook/time_entries/report", :id => 'query_form'} |
|
12 | :attributes => {:action => "/projects/ecookbook/time_entries/report", :id => 'query_form'} | |
13 | end |
|
13 | end | |
14 |
|
14 | |||
15 | def test_report_all_projects |
|
15 | def test_report_all_projects | |
16 | get :report |
|
16 | get :report | |
17 | assert_response :success |
|
17 | assert_response :success | |
@@ -19,7 +19,7 class TimeEntryReportsControllerTest < ActionController::TestCase | |||||
19 | assert_tag :form, |
|
19 | assert_tag :form, | |
20 | :attributes => {:action => "/time_entries/report", :id => 'query_form'} |
|
20 | :attributes => {:action => "/time_entries/report", :id => 'query_form'} | |
21 | end |
|
21 | end | |
22 |
|
22 | |||
23 | def test_report_all_projects_denied |
|
23 | def test_report_all_projects_denied | |
24 | r = Role.anonymous |
|
24 | r = Role.anonymous | |
25 | r.permissions.delete(:view_time_entries) |
|
25 | r.permissions.delete(:view_time_entries) | |
@@ -28,7 +28,7 class TimeEntryReportsControllerTest < ActionController::TestCase | |||||
28 | get :report |
|
28 | get :report | |
29 | assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Ftime_entries%2Freport' |
|
29 | assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Ftime_entries%2Freport' | |
30 | end |
|
30 | end | |
31 |
|
31 | |||
32 | def test_report_all_projects_one_criteria |
|
32 | def test_report_all_projects_one_criteria | |
33 | get :report, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criterias => ['project'] |
|
33 | get :report, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criterias => ['project'] | |
34 | assert_response :success |
|
34 | assert_response :success | |
@@ -53,7 +53,7 class TimeEntryReportsControllerTest < ActionController::TestCase | |||||
53 | assert_equal "162.90", "%.2f" % assigns(:total_hours) |
|
53 | assert_equal "162.90", "%.2f" % assigns(:total_hours) | |
54 | assert_tag :tag => 'th', :content => '2007-03-12' |
|
54 | assert_tag :tag => 'th', :content => '2007-03-12' | |
55 | end |
|
55 | end | |
56 |
|
56 | |||
57 | def test_report_one_criteria |
|
57 | def test_report_one_criteria | |
58 | get :report, :project_id => 1, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criterias => ['project'] |
|
58 | get :report, :project_id => 1, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criterias => ['project'] | |
59 | assert_response :success |
|
59 | assert_response :success | |
@@ -61,7 +61,7 class TimeEntryReportsControllerTest < ActionController::TestCase | |||||
61 | assert_not_nil assigns(:total_hours) |
|
61 | assert_not_nil assigns(:total_hours) | |
62 | assert_equal "8.65", "%.2f" % assigns(:total_hours) |
|
62 | assert_equal "8.65", "%.2f" % assigns(:total_hours) | |
63 | end |
|
63 | end | |
64 |
|
64 | |||
65 | def test_report_two_criterias |
|
65 | def test_report_two_criterias | |
66 | get :report, :project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criterias => ["member", "activity"] |
|
66 | get :report, :project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criterias => ["member", "activity"] | |
67 | assert_response :success |
|
67 | assert_response :success | |
@@ -69,7 +69,7 class TimeEntryReportsControllerTest < ActionController::TestCase | |||||
69 | assert_not_nil assigns(:total_hours) |
|
69 | assert_not_nil assigns(:total_hours) | |
70 | assert_equal "162.90", "%.2f" % assigns(:total_hours) |
|
70 | assert_equal "162.90", "%.2f" % assigns(:total_hours) | |
71 | end |
|
71 | end | |
72 |
|
72 | |||
73 | def test_report_one_day |
|
73 | def test_report_one_day | |
74 | get :report, :project_id => 1, :columns => 'day', :from => "2007-03-23", :to => "2007-03-23", :criterias => ["member", "activity"] |
|
74 | get :report, :project_id => 1, :columns => 'day', :from => "2007-03-23", :to => "2007-03-23", :criterias => ["member", "activity"] | |
75 | assert_response :success |
|
75 | assert_response :success | |
@@ -77,7 +77,7 class TimeEntryReportsControllerTest < ActionController::TestCase | |||||
77 | assert_not_nil assigns(:total_hours) |
|
77 | assert_not_nil assigns(:total_hours) | |
78 | assert_equal "4.25", "%.2f" % assigns(:total_hours) |
|
78 | assert_equal "4.25", "%.2f" % assigns(:total_hours) | |
79 | end |
|
79 | end | |
80 |
|
80 | |||
81 | def test_report_at_issue_level |
|
81 | def test_report_at_issue_level | |
82 | get :report, :project_id => 1, :issue_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criterias => ["member", "activity"] |
|
82 | get :report, :project_id => 1, :issue_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criterias => ["member", "activity"] | |
83 | assert_response :success |
|
83 | assert_response :success | |
@@ -87,7 +87,7 class TimeEntryReportsControllerTest < ActionController::TestCase | |||||
87 | assert_tag :form, |
|
87 | assert_tag :form, | |
88 | :attributes => {:action => "/projects/ecookbook/issues/1/time_entries/report", :id => 'query_form'} |
|
88 | :attributes => {:action => "/projects/ecookbook/issues/1/time_entries/report", :id => 'query_form'} | |
89 | end |
|
89 | end | |
90 |
|
90 | |||
91 | def test_report_custom_field_criteria |
|
91 | def test_report_custom_field_criteria | |
92 | get :report, :project_id => 1, :criterias => ['project', 'cf_1', 'cf_7'] |
|
92 | get :report, :project_id => 1, :criterias => ['project', 'cf_1', 'cf_7'] | |
93 | assert_response :success |
|
93 | assert_response :success | |
@@ -106,7 +106,7 class TimeEntryReportsControllerTest < ActionController::TestCase | |||||
106 | # Second custom field column |
|
106 | # Second custom field column | |
107 | assert_tag :tag => 'th', :content => 'Billable' |
|
107 | assert_tag :tag => 'th', :content => 'Billable' | |
108 | end |
|
108 | end | |
109 |
|
109 | |||
110 | def test_report_one_criteria_no_result |
|
110 | def test_report_one_criteria_no_result | |
111 | get :report, :project_id => 1, :columns => 'week', :from => "1998-04-01", :to => "1998-04-30", :criterias => ['project'] |
|
111 | get :report, :project_id => 1, :columns => 'week', :from => "1998-04-01", :to => "1998-04-30", :criterias => ['project'] | |
112 | assert_response :success |
|
112 | assert_response :success | |
@@ -114,7 +114,7 class TimeEntryReportsControllerTest < ActionController::TestCase | |||||
114 | assert_not_nil assigns(:total_hours) |
|
114 | assert_not_nil assigns(:total_hours) | |
115 | assert_equal "0.00", "%.2f" % assigns(:total_hours) |
|
115 | assert_equal "0.00", "%.2f" % assigns(:total_hours) | |
116 | end |
|
116 | end | |
117 |
|
117 | |||
118 | def test_report_all_projects_csv_export |
|
118 | def test_report_all_projects_csv_export | |
119 | get :report, :columns => 'month', :from => "2007-01-01", :to => "2007-06-30", :criterias => ["project", "member", "activity"], :format => "csv" |
|
119 | get :report, :columns => 'month', :from => "2007-01-01", :to => "2007-06-30", :criterias => ["project", "member", "activity"], :format => "csv" | |
120 | assert_response :success |
|
120 | assert_response :success | |
@@ -125,7 +125,7 class TimeEntryReportsControllerTest < ActionController::TestCase | |||||
125 | # Total row |
|
125 | # Total row | |
126 | assert_equal 'Total,"","","","",154.25,8.65,"","",162.90', lines.last |
|
126 | assert_equal 'Total,"","","","",154.25,8.65,"","",162.90', lines.last | |
127 | end |
|
127 | end | |
128 |
|
128 | |||
129 | def test_report_csv_export |
|
129 | def test_report_csv_export | |
130 | get :report, :project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-06-30", :criterias => ["project", "member", "activity"], :format => "csv" |
|
130 | get :report, :project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-06-30", :criterias => ["project", "member", "activity"], :format => "csv" | |
131 | assert_response :success |
|
131 | assert_response :success | |
@@ -136,5 +136,5 class TimeEntryReportsControllerTest < ActionController::TestCase | |||||
136 | # Total row |
|
136 | # Total row | |
137 | assert_equal 'Total,"","","","",154.25,8.65,"","",162.90', lines.last |
|
137 | assert_equal 'Total,"","","","",154.25,8.65,"","",162.90', lines.last | |
138 | end |
|
138 | end | |
139 |
|
139 | |||
140 | end |
|
140 | end |
General Comments 0
You need to be logged in to leave comments.
Login now