@@ -24,7 +24,7 module ReportsHelper | |||||
24 | data.each { |row| |
|
24 | data.each { |row| | |
25 | match = 1 |
|
25 | match = 1 | |
26 | criteria.each { |k, v| |
|
26 | criteria.each { |k, v| | |
27 |
match = 0 unless (row[k].to_s == v.to_s) || (k == 'closed' && |
|
27 | match = 0 unless (row[k].to_s == v.to_s) || (k == 'closed' && (v == 0 ? ['f', false] : ['t', true]).include?(row[k])) | |
28 | } unless criteria.nil? |
|
28 | } unless criteria.nil? | |
29 | a = a + row["total"].to_i if match == 1 |
|
29 | a = a + row["total"].to_i if match == 1 | |
30 | } unless data.nil? |
|
30 | } unless data.nil? |
@@ -54,6 +54,24 class ReportsControllerTest < ActionController::TestCase | |||||
54 | end |
|
54 | end | |
55 | end |
|
55 | end | |
56 |
|
56 | |||
|
57 | def test_get_issue_report_details_by_tracker_should_show_issue_count | |||
|
58 | Issue.delete_all | |||
|
59 | Issue.generate!(:tracker_id => 1) | |||
|
60 | Issue.generate!(:tracker_id => 1) | |||
|
61 | Issue.generate!(:tracker_id => 1, :status_id => 5) | |||
|
62 | Issue.generate!(:tracker_id => 2) | |||
|
63 | ||||
|
64 | get :issue_report_details, :id => 1, :detail => 'tracker' | |||
|
65 | assert_select 'table.list tbody :nth-child(1)' do | |||
|
66 | assert_select 'td', :text => 'Bug' | |||
|
67 | assert_select ':nth-child(2)', :text => '2' # status:1 | |||
|
68 | assert_select ':nth-child(3)', :text => '-' # status:2 | |||
|
69 | assert_select ':nth-child(8)', :text => '2' # open | |||
|
70 | assert_select ':nth-child(9)', :text => '1' # closed | |||
|
71 | assert_select ':nth-child(10)', :text => '3' # total | |||
|
72 | end | |||
|
73 | end | |||
|
74 | ||||
57 | def test_get_issue_report_details_by_priority |
|
75 | def test_get_issue_report_details_by_priority | |
58 | get :issue_report_details, :id => 1, :detail => 'priority' |
|
76 | get :issue_report_details, :id => 1, :detail => 'priority' | |
59 | assert_equal IssuePriority.all.reverse, assigns(:rows) |
|
77 | assert_equal IssuePriority.all.reverse, assigns(:rows) |
General Comments 0
You need to be logged in to leave comments.
Login now