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