data.each { |row|
match = 1
criteria.each { |k, v|
- match = 0 unless (row[k].to_s == v.to_s) || (k == 'closed' && row[k] == (v == 0 ? "f" : "t"))
+ match = 0 unless (row[k].to_s == v.to_s) || (k == 'closed' && (v == 0 ? ['f', false] : ['t', true]).include?(row[k]))
} unless criteria.nil?
a = a + row["total"].to_i if match == 1
} unless data.nil?
end
end
+ def test_get_issue_report_details_by_tracker_should_show_issue_count
+ Issue.delete_all
+ Issue.generate!(:tracker_id => 1)
+ Issue.generate!(:tracker_id => 1)
+ Issue.generate!(:tracker_id => 1, :status_id => 5)
+ Issue.generate!(:tracker_id => 2)
+
+ get :issue_report_details, :id => 1, :detail => 'tracker'
+ assert_select 'table.list tbody :nth-child(1)' do
+ assert_select 'td', :text => 'Bug'
+ assert_select ':nth-child(2)', :text => '2' # status:1
+ assert_select ':nth-child(3)', :text => '-' # status:2
+ assert_select ':nth-child(8)', :text => '2' # open
+ assert_select ':nth-child(9)', :text => '1' # closed
+ assert_select ':nth-child(10)', :text => '3' # total
+ end
+ end
+
def test_get_issue_report_details_by_priority
get :issue_report_details, :id => 1, :detail => 'priority'
assert_equal IssuePriority.all.reverse, assigns(:rows)