Mercurial > hg > soundsoftware-site
comparison test/unit/time_entry_activity_test.rb @ 1298:4f746d8966dd redmine_2.3_integration
Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:28:30 +0100 |
parents | 622f24f53b42 |
children | e248c7af89ec |
comparison
equal
deleted
inserted
replaced
1297:0a574315af3e | 1298:4f746d8966dd |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2012 Jean-Philippe Lang | 2 # Copyright (C) 2006-2013 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. |
82 e.custom_field_values = {field.id => "0"} | 82 e.custom_field_values = {field.id => "0"} |
83 assert e.save | 83 assert e.save |
84 e.reload | 84 e.reload |
85 assert_equal "0", e.custom_value_for(field).value | 85 assert_equal "0", e.custom_value_for(field).value |
86 end | 86 end |
87 | |
88 def test_system_activity_with_child_in_use_should_be_in_use | |
89 project = Project.generate! | |
90 system_activity = TimeEntryActivity.create!(:name => 'Activity') | |
91 project_activity = TimeEntryActivity.create!(:name => 'Activity', :project => project, :parent_id => system_activity.id) | |
92 | |
93 TimeEntry.generate!(:project => project, :activity => project_activity) | |
94 | |
95 assert project_activity.in_use? | |
96 assert system_activity.in_use? | |
97 end | |
98 | |
99 def test_destroying_a_system_activity_should_reassign_children_activities | |
100 project = Project.generate! | |
101 system_activity = TimeEntryActivity.create!(:name => 'Activity') | |
102 project_activity = TimeEntryActivity.create!(:name => 'Activity', :project => project, :parent_id => system_activity.id) | |
103 | |
104 entries = [ | |
105 TimeEntry.generate!(:project => project, :activity => system_activity), | |
106 TimeEntry.generate!(:project => project, :activity => project_activity) | |
107 ] | |
108 | |
109 assert_difference 'TimeEntryActivity.count', -2 do | |
110 assert_nothing_raised do | |
111 assert system_activity.destroy(TimeEntryActivity.find_by_name('Development')) | |
112 end | |
113 end | |
114 assert entries.all? {|entry| entry.reload.activity.name == 'Development'} | |
115 end | |
87 end | 116 end |
88 |