@@ -2,7 +2,7 require File.expand_path('../../test_helper', __FILE__) | |||
|
2 | 2 | |
|
3 | 3 | class ProjectEnumerationsControllerTest < ActionController::TestCase |
|
4 | 4 | fixtures :all |
|
5 | ||
|
5 | ||
|
6 | 6 | def setup |
|
7 | 7 | @request.session[:user_id] = nil |
|
8 | 8 | Setting.default_language = 'en' |
@@ -76,7 +76,7 class ProjectEnumerationsControllerTest < ActionController::TestCase | |||
|
76 | 76 | }) |
|
77 | 77 | assert project_activity_two.save |
|
78 | 78 | |
|
79 | ||
|
79 | ||
|
80 | 80 | put :update, :project_id => 1, :enumerations => { |
|
81 | 81 | project_activity.id => {"custom_field_values"=>{"7" => "1"}, "active"=>"0"}, # De-activate |
|
82 | 82 | project_activity_two.id => {"custom_field_values"=>{"7" => "1"}, "active"=>"0"} # De-activate |
@@ -102,7 +102,7 class ProjectEnumerationsControllerTest < ActionController::TestCase | |||
|
102 | 102 | |
|
103 | 103 | def test_update_when_creating_new_activities_will_convert_existing_data |
|
104 | 104 | assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(9, 1).size |
|
105 | ||
|
105 | ||
|
106 | 106 | @request.session[:user_id] = 2 # manager |
|
107 | 107 | put :update, :project_id => 1, :enumerations => { |
|
108 | 108 | "9"=> {"parent_id"=>"9", "custom_field_values"=>{"7" => "1"}, "active"=>"0"} # Design, De-activate |
@@ -126,7 +126,7 class ProjectEnumerationsControllerTest < ActionController::TestCase | |||
|
126 | 126 | |
|
127 | 127 | assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(9, 1).size |
|
128 | 128 | assert_equal 1, TimeEntry.find_all_by_activity_id_and_project_id(10, 1).size |
|
129 | ||
|
129 | ||
|
130 | 130 | @request.session[:user_id] = 2 # manager |
|
131 | 131 | put :update, :project_id => 1, :enumerations => { |
|
132 | 132 | "9"=> {"parent_id"=>"9", "custom_field_values"=>{"7" => "1"}, "active"=>"0"}, # Design |
@@ -164,7 +164,7 class ProjectEnumerationsControllerTest < ActionController::TestCase | |||
|
164 | 164 | assert_nil TimeEntryActivity.find_by_id(project_activity.id) |
|
165 | 165 | assert_nil TimeEntryActivity.find_by_id(project_activity_two.id) |
|
166 | 166 | end |
|
167 | ||
|
167 | ||
|
168 | 168 | def test_destroy_should_reassign_time_entries_back_to_the_system_activity |
|
169 | 169 | @request.session[:user_id] = 2 # manager |
|
170 | 170 | project_activity = TimeEntryActivity.new({ |
@@ -176,7 +176,7 class ProjectEnumerationsControllerTest < ActionController::TestCase | |||
|
176 | 176 | assert project_activity.save |
|
177 | 177 | assert TimeEntry.update_all("activity_id = '#{project_activity.id}'", ["project_id = ? AND activity_id = ?", 1, 9]) |
|
178 | 178 | assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(project_activity.id, 1).size |
|
179 | ||
|
179 | ||
|
180 | 180 | delete :destroy, :project_id => 1 |
|
181 | 181 | assert_response :redirect |
|
182 | 182 | assert_redirected_to '/projects/ecookbook/settings/activities' |
General Comments 0
You need to be logged in to leave comments.
Login now