Mercurial > hg > soundsoftware-site
comparison test/unit/time_entry_test.rb @ 22:40f7cfd4df19
* Update to SVN trunk rev 4173
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Fri, 24 Sep 2010 14:06:04 +0100 |
parents | 513646585e45 |
children | af80e5618e9b |
comparison
equal
deleted
inserted
replaced
14:1d32c0a0efbf | 22:40f7cfd4df19 |
---|---|
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 | |
52 context "#earilest_date_for_project" do | |
53 setup do | |
54 User.current = nil | |
55 @public_project = Project.generate!(:is_public => true) | |
56 @issue = Issue.generate_for_project!(@public_project) | |
57 TimeEntry.generate!(:spent_on => '2010-01-01', | |
58 :issue => @issue, | |
59 :project => @public_project) | |
60 end | |
61 | |
62 context "without a project" do | |
63 should "return the lowest spent_on value that is visible to the current user" do | |
64 assert_equal "2007-03-12", TimeEntry.earilest_date_for_project.to_s | |
65 end | |
66 end | |
67 | |
68 context "with a project" do | |
69 should "return the lowest spent_on value that is visible to the current user for that project and it's subprojects only" do | |
70 assert_equal "2010-01-01", TimeEntry.earilest_date_for_project(@public_project).to_s | |
71 end | |
72 end | |
73 | |
74 end | |
75 | |
76 context "#latest_date_for_project" do | |
77 setup do | |
78 User.current = nil | |
79 @public_project = Project.generate!(:is_public => true) | |
80 @issue = Issue.generate_for_project!(@public_project) | |
81 TimeEntry.generate!(:spent_on => '2010-01-01', | |
82 :issue => @issue, | |
83 :project => @public_project) | |
84 end | |
85 | |
86 context "without a project" do | |
87 should "return the highest spent_on value that is visible to the current user" do | |
88 assert_equal "2010-01-01", TimeEntry.latest_date_for_project.to_s | |
89 end | |
90 end | |
91 | |
92 context "with a project" do | |
93 should "return the highest spent_on value that is visible to the current user for that project and it's subprojects only" do | |
94 project = Project.find(1) | |
95 assert_equal "2007-04-22", TimeEntry.latest_date_for_project(project).to_s | |
96 end | |
97 end | |
98 end | |
51 end | 99 end |