##// END OF EJS Templates
remove trailing white-spaces from test/unit/time_entry_test.rb....
Toshi MARUYAMA -
r6632:cf733e7db7b6
parent child
Show More
@@ -1,16 +1,16
1 # redMine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2008 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
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.
@@ -38,47 +38,47 class TimeEntryTest < ActiveSupport::TestCase
38 "3 hours" => 3.0,
38 "3 hours" => 3.0,
39 "12min" => 0.2,
39 "12min" => 0.2,
40 }
40 }
41
41
42 assertions.each do |k, v|
42 assertions.each do |k, v|
43 t = TimeEntry.new(:hours => k)
43 t = TimeEntry.new(:hours => k)
44 assert_equal v, t.hours, "Converting #{k} failed:"
44 assert_equal v, t.hours, "Converting #{k} failed:"
45 end
45 end
46 end
46 end
47
47
48 def test_hours_should_default_to_nil
48 def test_hours_should_default_to_nil
49 assert_nil TimeEntry.new.hours
49 assert_nil TimeEntry.new.hours
50 end
50 end
51
51
52 def test_spent_on_with_blank
52 def test_spent_on_with_blank
53 c = TimeEntry.new
53 c = TimeEntry.new
54 c.spent_on = ''
54 c.spent_on = ''
55 assert_nil c.spent_on
55 assert_nil c.spent_on
56 end
56 end
57
57
58 def test_spent_on_with_nil
58 def test_spent_on_with_nil
59 c = TimeEntry.new
59 c = TimeEntry.new
60 c.spent_on = nil
60 c.spent_on = nil
61 assert_nil c.spent_on
61 assert_nil c.spent_on
62 end
62 end
63
63
64 def test_spent_on_with_string
64 def test_spent_on_with_string
65 c = TimeEntry.new
65 c = TimeEntry.new
66 c.spent_on = "2011-01-14"
66 c.spent_on = "2011-01-14"
67 assert_equal Date.parse("2011-01-14"), c.spent_on
67 assert_equal Date.parse("2011-01-14"), c.spent_on
68 end
68 end
69
69
70 def test_spent_on_with_invalid_string
70 def test_spent_on_with_invalid_string
71 c = TimeEntry.new
71 c = TimeEntry.new
72 c.spent_on = "foo"
72 c.spent_on = "foo"
73 assert_nil c.spent_on
73 assert_nil c.spent_on
74 end
74 end
75
75
76 def test_spent_on_with_date
76 def test_spent_on_with_date
77 c = TimeEntry.new
77 c = TimeEntry.new
78 c.spent_on = Date.today
78 c.spent_on = Date.today
79 assert_equal Date.today, c.spent_on
79 assert_equal Date.today, c.spent_on
80 end
80 end
81
81
82 def test_spent_on_with_time
82 def test_spent_on_with_time
83 c = TimeEntry.new
83 c = TimeEntry.new
84 c.spent_on = Time.now
84 c.spent_on = Time.now
@@ -94,7 +94,7 class TimeEntryTest < ActiveSupport::TestCase
94 :issue => @issue,
94 :issue => @issue,
95 :project => @public_project)
95 :project => @public_project)
96 end
96 end
97
97
98 context "without a project" do
98 context "without a project" do
99 should "return the lowest spent_on value that is visible to the current user" do
99 should "return the lowest spent_on value that is visible to the current user" do
100 assert_equal "2007-03-12", TimeEntry.earilest_date_for_project.to_s
100 assert_equal "2007-03-12", TimeEntry.earilest_date_for_project.to_s
@@ -106,7 +106,7 class TimeEntryTest < ActiveSupport::TestCase
106 assert_equal "2010-01-01", TimeEntry.earilest_date_for_project(@public_project).to_s
106 assert_equal "2010-01-01", TimeEntry.earilest_date_for_project(@public_project).to_s
107 end
107 end
108 end
108 end
109
109
110 end
110 end
111
111
112 context "#latest_date_for_project" do
112 context "#latest_date_for_project" do
@@ -131,5 +131,5 class TimeEntryTest < ActiveSupport::TestCase
131 assert_equal "2007-04-22", TimeEntry.latest_date_for_project(project).to_s
131 assert_equal "2007-04-22", TimeEntry.latest_date_for_project(project).to_s
132 end
132 end
133 end
133 end
134 end
134 end
135 end
135 end
General Comments 0
You need to be logged in to leave comments. Login now