Defect #34185 » fixed-34185.patch
| app/controllers/reports_controller.rb | ||
|---|---|---|
|
before_action :find_project, :authorize, :find_issue_statuses
|
||
|
def issue_report
|
||
|
@trackers = @project.rolled_up_trackers(false).visible
|
||
|
with_subprojects = Setting.display_subprojects_issues?
|
||
|
@trackers = @project.rolled_up_trackers(with_subprojects).visible
|
||
|
@versions = @project.shared_versions.sorted
|
||
|
@priorities = IssuePriority.all.reverse
|
||
|
@categories = @project.issue_categories
|
||
|
@assignees = (Setting.issue_group_assignment? ? @project.principals : @project.users).sorted
|
||
|
@authors = @project.users.sorted
|
||
|
@subprojects = @project.descendants.visible
|
||
|
with_subprojects = Setting.display_subprojects_issues?
|
||
|
@issues_by_tracker = Issue.by_tracker(@project, with_subprojects)
|
||
|
@issues_by_version = Issue.by_version(@project, with_subprojects)
|
||
|
@issues_by_priority = Issue.by_priority(@project, with_subprojects)
|
||
| ... | ... | |
|
case params[:detail]
|
||
|
when "tracker"
|
||
|
@field = "tracker_id"
|
||
|
@rows = @project.rolled_up_trackers(false).visible
|
||
|
@rows = @project.rolled_up_trackers(with_subprojects).visible
|
||
|
@data = Issue.by_tracker(@project, with_subprojects)
|
||
|
@report_title = l(:field_tracker)
|
||
|
when "version"
|
||
| test/functional/reports_controller_test.rb | ||
|---|---|---|
|
end
|
||
|
def test_issue_report_with_subprojects_issues
|
||
|
Setting.stubs(:display_subprojects_issues?).returns(true)
|
||
|
get(
|
||
|
:issue_report,
|
||
|
:params => {
|
||
|
:id => 1
|
||
|
}
|
||
|
)
|
||
|
assert_response :success
|
||
|
# Count subprojects issues
|
||
|
assert_select 'table.list tbody :nth-child(1):first' do
|
||
|
assert_select 'td', :text => 'Bug'
|
||
|
assert_select ':nth-child(2)', :text => '5' # open
|
||
|
assert_select ':nth-child(3)', :text => '3' # closed
|
||
|
assert_select ':nth-child(4)', :text => '8' # total
|
||
|
project = Project.find(1)
|
||
|
tracker = project.trackers.find_by_name('Support request')
|
||
|
project.trackers.delete(tracker)
|
||
|
with_settings :display_subprojects_issues => '1' do
|
||
|
get(
|
||
|
:issue_report,
|
||
|
:params => {
|
||
|
:id => 1
|
||
|
}
|
||
|
)
|
||
|
assert_response :success
|
||
|
# Count subprojects issues
|
||
|
assert_select 'table.list tbody :nth-child(1):first' do
|
||
|
assert_select 'td', :text => 'Bug'
|
||
|
assert_select ':nth-child(2)', :text => '5' # open
|
||
|
assert_select ':nth-child(3)', :text => '3' # closed
|
||
|
assert_select ':nth-child(4)', :text => '8' # total
|
||
|
end
|
||
|
assert_select 'table.issue-report td.name', :text => 'Support request', :count => 1
|
||
|
end
|
||
|
end
|
||
|
def test_issue_report_without_subprojects_issues
|
||
|
Setting.stubs(:display_subprojects_issues?).returns(false)
|
||
|
get(
|
||
|
:issue_report,
|
||
|
:params => {
|
||
|
:id => 1
|
||
|
}
|
||
|
)
|
||
|
assert_response :success
|
||
|
# Do not count subprojects issues
|
||
|
assert_select 'table.list tbody :nth-child(1):first' do
|
||
|
assert_select 'td', :text => 'Bug'
|
||
|
assert_select ':nth-child(2)', :text => '3' # open
|
||
|
assert_select ':nth-child(3)', :text => '3' # closed
|
||
|
assert_select ':nth-child(4)', :text => '6' # total
|
||
|
project = Project.find(1)
|
||
|
tracker = project.trackers.find_by_name('Support request')
|
||
|
project.trackers.delete(tracker)
|
||
|
with_settings :display_subprojects_issues => '0' do
|
||
|
get(
|
||
|
:issue_report,
|
||
|
:params => {
|
||
|
:id => 1
|
||
|
}
|
||
|
)
|
||
|
assert_response :success
|
||
|
# Do not count subprojects issues
|
||
|
assert_select 'table.list tbody :nth-child(1):first' do
|
||
|
assert_select 'td', :text => 'Bug'
|
||
|
assert_select ':nth-child(2)', :text => '3' # open
|
||
|
assert_select ':nth-child(3)', :text => '3' # closed
|
||
|
assert_select ':nth-child(4)', :text => '6' # total
|
||
|
end
|
||
|
assert_select 'table.issue-report td.name', :text => 'Support request', :count => 0
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
end
|
||
|
def test_get_issue_report_details_by_tracker_with_subprojects_issues
|
||
|
Setting.stubs(:display_subprojects_issues?).returns(true)
|
||
|
get(
|
||
|
:issue_report_details,
|
||
|
:params => {
|
||
|
:id => 1,
|
||
|
:detail => 'tracker'
|
||
|
}
|
||
|
)
|
||
|
assert_response :success
|
||
|
# Count subprojects issues
|
||
|
assert_select 'table.list tbody :nth-child(1)' do
|
||
|
assert_select 'td', :text => 'Bug'
|
||
|
assert_select ':nth-child(2)', :text => '5' # status:1
|
||
|
assert_select ':nth-child(3)', :text => '-' # status:2
|
||
|
assert_select ':nth-child(4)', :text => '-' # status:3
|
||
|
assert_select ':nth-child(5)', :text => '-' # status:4
|
||
|
assert_select ':nth-child(6)', :text => '3' # status:5
|
||
|
assert_select ':nth-child(7)', :text => '-' # status:6
|
||
|
assert_select ':nth-child(8)', :text => '5' # open
|
||
|
assert_select ':nth-child(9)', :text => '3' # closed
|
||
|
assert_select ':nth-child(10)', :text => '8' # total
|
||
|
project = Project.find(1)
|
||
|
tracker = project.trackers.find_by_name('Support request')
|
||
|
project.trackers.delete(tracker)
|
||
|
with_settings :display_subprojects_issues => '1' do
|
||
|
get(
|
||
|
:issue_report_details,
|
||
|
:params => {
|
||
|
:id => 1,
|
||
|
:detail => 'tracker'
|
||
|
}
|
||
|
)
|
||
|
assert_response :success
|
||
|
# Count subprojects issues
|
||
|
assert_select 'table.list tbody :nth-child(1)' do
|
||
|
assert_select 'td', :text => 'Bug'
|
||
|
assert_select ':nth-child(2)', :text => '5' # status:1
|
||
|
assert_select ':nth-child(3)', :text => '-' # status:2
|
||
|
assert_select ':nth-child(4)', :text => '-' # status:3
|
||
|
assert_select ':nth-child(5)', :text => '-' # status:4
|
||
|
assert_select ':nth-child(6)', :text => '3' # status:5
|
||
|
assert_select ':nth-child(7)', :text => '-' # status:6
|
||
|
assert_select ':nth-child(8)', :text => '5' # open
|
||
|
assert_select ':nth-child(9)', :text => '3' # closed
|
||
|
assert_select ':nth-child(10)', :text => '8' # total
|
||
|
end
|
||
|
assert_select 'table.issue-report td.name', :text => 'Support request', :count => 1
|
||
|
end
|
||
|
end
|
||
|
def test_get_issue_report_details_by_tracker_without_subprojects_issues
|
||
|
Setting.stubs(:display_subprojects_issues?).returns(false)
|
||
|
get :issue_report_details, :params => {
|
||
|
:id => 1,
|
||
|
:detail => 'tracker'
|
||
|
}
|
||
|
project = Project.find(1)
|
||
|
tracker = project.trackers.find_by_name('Support request')
|
||
|
project.trackers.delete(tracker)
|
||
|
assert_response :success
|
||
|
# Do not count subprojects issues
|
||
|
assert_select 'table.list tbody :nth-child(1)' do
|
||
|
assert_select 'td', :text => 'Bug'
|
||
|
assert_select ':nth-child(2)', :text => '3' # status:1
|
||
|
assert_select ':nth-child(3)', :text => '-' # status:2
|
||
|
assert_select ':nth-child(4)', :text => '-' # status:3
|
||
|
assert_select ':nth-child(5)', :text => '-' # status:4
|
||
|
assert_select ':nth-child(6)', :text => '3' # status:5
|
||
|
assert_select ':nth-child(7)', :text => '-' # status:6
|
||
|
assert_select ':nth-child(8)', :text => '3' # open
|
||
|
assert_select ':nth-child(9)', :text => '3' # closed
|
||
|
assert_select ':nth-child(10)', :text => '6' # total
|
||
|
with_settings :display_subprojects_issues => '0' do
|
||
|
get :issue_report_details, :params => {
|
||
|
:id => 1,
|
||
|
:detail => 'tracker'
|
||
|
}
|
||
|
assert_response :success
|
||
|
# Do not count subprojects issues
|
||
|
assert_select 'table.list tbody :nth-child(1)' do
|
||
|
assert_select 'td', :text => 'Bug'
|
||
|
assert_select ':nth-child(2)', :text => '3' # status:1
|
||
|
assert_select ':nth-child(3)', :text => '-' # status:2
|
||
|
assert_select ':nth-child(4)', :text => '-' # status:3
|
||
|
assert_select ':nth-child(5)', :text => '-' # status:4
|
||
|
assert_select ':nth-child(6)', :text => '3' # status:5
|
||
|
assert_select ':nth-child(7)', :text => '-' # status:6
|
||
|
assert_select ':nth-child(8)', :text => '3' # open
|
||
|
assert_select ':nth-child(9)', :text => '3' # closed
|
||
|
assert_select ':nth-child(10)', :text => '6' # total
|
||
|
end
|
||
|
assert_select 'table.issue-report td.name', :text => 'Support request', :count => 0
|
||
|
end
|
||
|
end
|
||