Project

General

Profile

Patch #27772 » restrict_issue_statuses_in_the_issues_detailed_reports.diff

Marius BĂLTEANU, 2017-12-10 14:10

View differences:

app/controllers/reports_controller.rb
84 84
  private
85 85

  
86 86
  def find_issue_statuses
87
    @statuses = IssueStatus.sorted.to_a
87
    @statuses = @project.rolled_up_statuses.sorted.to_a
88 88
  end
89 89
end
test/functional/reports_controller_test.rb
44 44
    end
45 45
  end
46 46

  
47
  def test_get_issue_report_details_by_tracker_should_show_only_statuses_used_by_the_project
48
    WorkflowTransition.delete_all
49
    WorkflowTransition.create(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 5)
50
    WorkflowTransition.create(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 4)
51
    WorkflowTransition.create(:role_id => 1, :tracker_id => 1, :old_status_id => 2, :new_status_id => 5)
52
    WorkflowTransition.create(:role_id => 1, :tracker_id => 2, :old_status_id => 1, :new_status_id => 6)
53

  
54
    get :issue_report_details, :params => {
55
      :id => 1,
56
      :detail => 'tracker'
57
    }
58

  
59
    assert_response :success
60
    assert_select 'table.list tbody :nth-child(1)' do
61
      assert_select 'td', :text => 'Bug'
62
      assert_select ':nth-child(2)', :text => '3' # status:1
63
      assert_select ':nth-child(3)', :text => '-' # status:2
64
      assert_select ':nth-child(4)', :text => '-' # status:4
65
      assert_select ':nth-child(5)', :text => '3' # status:5
66
      assert_select ':nth-child(6)', :text => '-' # status:6
67
      assert_select ':nth-child(7)', :text => '3' # open
68
      assert_select ':nth-child(8)', :text => '3' # closed
69
      assert_select ':nth-child(9)', :text => '6' # total
70
    end
71
  end
72

  
47 73
  def test_get_issue_report_details_by_tracker_should_show_issue_count
48 74
    Issue.delete_all
49 75
    Issue.generate!(:tracker_id => 1)
(2-2/2)