プロジェクト

全般

プロフィール

Vote #79787

完了

IssuesControllerTest#test_index_sort_by_total_estimated_hours tests practically nothing

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Code cleanup/refactoring_30
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
30
version_id:
127
issue_org_id:
30474
author_id:
332
assigned_to_id:
332
comments:
3
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

IssuesControllerTest#test_index_sort_by_total_estimated_hours tries to test if the issues list is sorted by estimated hours, but it actually does not test anything.

In test/fixtures/issues.yml, all objects don't have estimate_hours value. As a result, the content of the array @hours@ is always [nil, nil, nil, nil. nil]. Since all values in the array are the same, you cannot check whether the sorting works well or not.


  def test_index_sort_by_total_estimated_hours
    get :index, :params => {
        :sort => 'total_estimated_hours:desc'
      }
    assert_response :success
    hours = issues_in_list.map(&:total_estimated_hours)
    assert_equal hours.sort.reverse, hours
  end

journals

Here is a patch to fix this. After applying this patch, the value of @hours@ array is @[200.0, 2.0, 1.0, 0.5]@ and the test can properly check the order of issues.
--------------------------------------------------------------------------------
Setting the target version to 4.1.0.
--------------------------------------------------------------------------------
Committed.
--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリCode cleanup/refactoring_30 にセット
  • 対象バージョン4.1.0_127 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0