プロジェクト

全般

プロフィール

Vote #79566

完了

Wrong use of refute_includes in tests

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

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

0%

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

説明

The "@refute_includes@ assertion":https://www.rubydoc.info/gems/minitest/5.11.3/Minitest/Assertions#refute_includes-instance_method expects the @collection@ first and the @object@ to test for after. The test in source:/trunk/test/functional/queries_controller_test.rb@17558#L627 uses the @object@ then @collection@ form though.

It seems most of Redmine tests use source:/trunk/test/test_helper.rb@17558#L205 @assert_not_include@ which expects the @object@ then @collection@ form. The following patch corrects this problem:


--- a/test/functional/queries_controller_test.rb
+++ b/test/functional/queries_controller_test.rb
@@ -645,7 +645,7 @@ class QueriesControllerTest < Redmine::ControllerTest
     # response includes systemwide visible version
     assert_include ["OnlineStore - Systemwide visible version", "7", "open"], json
     # response doesn't include non visible version
-    refute_includes ["Private child of eCookbook - Private Version of public subproject", "6", "open"], json
+    assert_not_include ["Private child of eCookbook - Private Version of public subproject", "6", "open"], json
   end
 
   def test_subproject_filter_time_entries_with_project_id_should_return_filter_values

journals

That makes sense to me.

<pre><code class="ruby">
refute_includes json, ["Private child of eCookbook - Private Version of public subproject", "6", "open"]
</code></pre>
Although the test works with the above code, refute_includes is only used in redmine at three places.
assert_not_include is more familiar.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Committed. Thanks.
--------------------------------------------------------------------------------

Admin Redmine さんが3年以上前に更新

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

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

いいね!0
いいね!0