Project

General

Profile

Actions

Defect #30474

closed

IssuesControllerTest#test_index_sort_by_total_estimated_hours tests practically nothing

Added by Go MAEDA almost 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Code cleanup/refactoring
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

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

Files

fix-30474.diff (1.33 KB) fix-30474.diff Go MAEDA, 2019-01-22 02:57
Actions

Also available in: Atom PDF