##// END OF EJS Templates
remove trailing white-spaces from test/unit/issue_relation_test.rb....
Toshi MARUYAMA -
r6628:09051680e4bd
parent child
Show More
@@ -5,12 +5,12
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -23,7 +23,7 class IssueRelationTest < ActiveSupport::TestCase
23 def test_create
23 def test_create
24 from = Issue.find(1)
24 from = Issue.find(1)
25 to = Issue.find(2)
25 to = Issue.find(2)
26
26
27 relation = IssueRelation.new :issue_from => from, :issue_to => to, :relation_type => IssueRelation::TYPE_PRECEDES
27 relation = IssueRelation.new :issue_from => from, :issue_to => to, :relation_type => IssueRelation::TYPE_PRECEDES
28 assert relation.save
28 assert relation.save
29 relation.reload
29 relation.reload
@@ -31,17 +31,17 class IssueRelationTest < ActiveSupport::TestCase
31 assert_equal from, relation.issue_from
31 assert_equal from, relation.issue_from
32 assert_equal to, relation.issue_to
32 assert_equal to, relation.issue_to
33 end
33 end
34
34
35 def test_create_minimum
35 def test_create_minimum
36 relation = IssueRelation.new :issue_from => Issue.find(1), :issue_to => Issue.find(2)
36 relation = IssueRelation.new :issue_from => Issue.find(1), :issue_to => Issue.find(2)
37 assert relation.save
37 assert relation.save
38 assert_equal IssueRelation::TYPE_RELATES, relation.relation_type
38 assert_equal IssueRelation::TYPE_RELATES, relation.relation_type
39 end
39 end
40
40
41 def test_follows_relation_should_be_reversed
41 def test_follows_relation_should_be_reversed
42 from = Issue.find(1)
42 from = Issue.find(1)
43 to = Issue.find(2)
43 to = Issue.find(2)
44
44
45 relation = IssueRelation.new :issue_from => from, :issue_to => to, :relation_type => IssueRelation::TYPE_FOLLOWS
45 relation = IssueRelation.new :issue_from => from, :issue_to => to, :relation_type => IssueRelation::TYPE_FOLLOWS
46 assert relation.save
46 assert relation.save
47 relation.reload
47 relation.reload
@@ -49,37 +49,37 class IssueRelationTest < ActiveSupport::TestCase
49 assert_equal to, relation.issue_from
49 assert_equal to, relation.issue_from
50 assert_equal from, relation.issue_to
50 assert_equal from, relation.issue_to
51 end
51 end
52
52
53 def test_follows_relation_should_not_be_reversed_if_validation_fails
53 def test_follows_relation_should_not_be_reversed_if_validation_fails
54 from = Issue.find(1)
54 from = Issue.find(1)
55 to = Issue.find(2)
55 to = Issue.find(2)
56
56
57 relation = IssueRelation.new :issue_from => from, :issue_to => to, :relation_type => IssueRelation::TYPE_FOLLOWS, :delay => 'xx'
57 relation = IssueRelation.new :issue_from => from, :issue_to => to, :relation_type => IssueRelation::TYPE_FOLLOWS, :delay => 'xx'
58 assert !relation.save
58 assert !relation.save
59 assert_equal IssueRelation::TYPE_FOLLOWS, relation.relation_type
59 assert_equal IssueRelation::TYPE_FOLLOWS, relation.relation_type
60 assert_equal from, relation.issue_from
60 assert_equal from, relation.issue_from
61 assert_equal to, relation.issue_to
61 assert_equal to, relation.issue_to
62 end
62 end
63
63
64 def test_relation_type_for
64 def test_relation_type_for
65 from = Issue.find(1)
65 from = Issue.find(1)
66 to = Issue.find(2)
66 to = Issue.find(2)
67
67
68 relation = IssueRelation.new :issue_from => from, :issue_to => to, :relation_type => IssueRelation::TYPE_PRECEDES
68 relation = IssueRelation.new :issue_from => from, :issue_to => to, :relation_type => IssueRelation::TYPE_PRECEDES
69 assert_equal IssueRelation::TYPE_PRECEDES, relation.relation_type_for(from)
69 assert_equal IssueRelation::TYPE_PRECEDES, relation.relation_type_for(from)
70 assert_equal IssueRelation::TYPE_FOLLOWS, relation.relation_type_for(to)
70 assert_equal IssueRelation::TYPE_FOLLOWS, relation.relation_type_for(to)
71 end
71 end
72
72
73 def test_set_issue_to_dates_without_issue_to
73 def test_set_issue_to_dates_without_issue_to
74 r = IssueRelation.new(:issue_from => Issue.new(:start_date => Date.today), :relation_type => IssueRelation::TYPE_PRECEDES, :delay => 1)
74 r = IssueRelation.new(:issue_from => Issue.new(:start_date => Date.today), :relation_type => IssueRelation::TYPE_PRECEDES, :delay => 1)
75 assert_nil r.set_issue_to_dates
75 assert_nil r.set_issue_to_dates
76 end
76 end
77
77
78 def test_set_issue_to_dates_without_issues
78 def test_set_issue_to_dates_without_issues
79 r = IssueRelation.new(:relation_type => IssueRelation::TYPE_PRECEDES, :delay => 1)
79 r = IssueRelation.new(:relation_type => IssueRelation::TYPE_PRECEDES, :delay => 1)
80 assert_nil r.set_issue_to_dates
80 assert_nil r.set_issue_to_dates
81 end
81 end
82
82
83 def test_validates_circular_dependency
83 def test_validates_circular_dependency
84 IssueRelation.delete_all
84 IssueRelation.delete_all
85 assert IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => Issue.find(2), :relation_type => IssueRelation::TYPE_PRECEDES)
85 assert IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => Issue.find(2), :relation_type => IssueRelation::TYPE_PRECEDES)
General Comments 0
You need to be logged in to leave comments. Login now