From aad0b11f9bd297096c65781f1b50f55fc090ec8e Mon Sep 17 00:00:00 2001 From: Marius BALTEANU Date: Sun, 3 May 2020 16:16:38 +0300 Subject: [PATCH 2/2] Fix failing test --- .../files/import_subtasks_with_relations.csv | 2 +- test/unit/issue_import_test.rb | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/test/fixtures/files/import_subtasks_with_relations.csv b/test/fixtures/files/import_subtasks_with_relations.csv index 2f194cdbd..af7605b34 100644 --- a/test/fixtures/files/import_subtasks_with_relations.csv +++ b/test/fixtures/files/import_subtasks_with_relations.csv @@ -2,4 +2,4 @@ row;tracker;subject;start;due;parent;follows 1;bug;2nd Child;2020-01-12;2020-01-20;3;2 1d 2;bug;1st Child;2020-01-01;2020-01-10;3; 3;bug;Parent;2020-01-01;2020-01-31;; -1;bug;3rd Child;2020-01-22;2020-01-31;3;1 1d +4;bug;3rd Child;2020-01-22;2020-01-31;3;1 1d diff --git a/test/unit/issue_import_test.rb b/test/unit/issue_import_test.rb index 78a62c050..bd66a3dc1 100644 --- a/test/unit/issue_import_test.rb +++ b/test/unit/issue_import_test.rb @@ -208,12 +208,10 @@ class IssueImportTest < ActiveSupport::TestCase assert one.relations_to.any? { |r| r.issue_from == one_one && r.delay == 2 } assert one.relations_to.any? { |r| r.issue_from == one_two && r.delay == 1 } - assert_equal 1, one_one.relations_from.count assert one_one.relations_from.all? { |r| r.relation_type == 'precedes' } assert one_one.relations_from.any? { |r| r.issue_to == one && r.delay == 2 } - assert_equal 1, one_two.relations_to.count assert one_two.relations_to.all? { |r| r.relation_type == 'precedes' } assert one_two.relations_to.any? { |r| r.issue_from == one_two_one && r.delay == -1 } @@ -222,7 +220,6 @@ class IssueImportTest < ActiveSupport::TestCase assert one_two.relations_from.all? { |r| r.relation_type == 'precedes' } assert one_two.relations_from.any? { |r| r.issue_to == one && r.delay == 1 } - assert_equal 1, one_two_one.relations_from.count assert one_two_one.relations_from.all? { |r| r.relation_type == 'precedes' } assert one_two_one.relations_from.any? { |r| r.issue_to == one_two && r.delay == -1 } @@ -262,19 +259,18 @@ class IssueImportTest < ActiveSupport::TestCase :relation_type => 'precedes', :delay => 1).present? - # Checking dates, because they might act weird, when relations are added - assert_equal Date.new(2020, 1, 1), parent.start_date - assert_equal Date.new(2020, 1, 31), parent.due_date + assert_equal Date.new(2020, 1, 1), parent.start_date + assert_equal Date.new(2020, 2, 3), parent.due_date - assert_equal Date.new(2020, 1, 1), first.start_date + assert_equal Date.new(2020, 1, 1), first.start_date assert_equal Date.new(2020, 1, 10), first.due_date - assert_equal Date.new(2020, 1, 12), second.start_date - assert_equal Date.new(2020, 1, 20), second.due_date + assert_equal Date.new(2020, 1, 14), second.start_date + assert_equal Date.new(2020, 1, 21), second.due_date - assert_equal Date.new(2020, 1, 22), third.start_date - assert_equal Date.new(2020, 1, 31), third.due_date + assert_equal Date.new(2020, 1, 23), third.start_date + assert_equal Date.new(2020, 2, 3), third.due_date end def test_assignee_should_be_set -- 2.22.0