summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/project_enumerations_controller_test.rb2
-rw-r--r--test/functional/timelog_controller_test.rb2
-rw-r--r--test/unit/time_entry_activity_test.rb10
-rw-r--r--test/unit/time_entry_query_test.rb2
4 files changed, 8 insertions, 8 deletions
diff --git a/test/functional/project_enumerations_controller_test.rb b/test/functional/project_enumerations_controller_test.rb
index b52fec613..943c086f7 100644
--- a/test/functional/project_enumerations_controller_test.rb
+++ b/test/functional/project_enumerations_controller_test.rb
@@ -153,7 +153,7 @@ class ProjectEnumerationsControllerTest < ActionController::TestCase
# second one is a dupicate
parent = TimeEntryActivity.find(9)
TimeEntryActivity.create!({:name => parent.name, :project_id => 1,
- :position => parent.position, :active => true})
+ :position => parent.position, :active => true, :parent_id => 9})
TimeEntry.create!({:project_id => 1, :hours => 1.0, :user => User.find(1),
:issue_id => 3, :activity_id => 10, :spent_on => '2009-01-01'})
assert_equal 3, TimeEntry.where(:activity_id => 9, :project_id => 1).count
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index 1d4097ce2..68fde87f0 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/test/functional/timelog_controller_test.rb
@@ -113,7 +113,7 @@ class TimelogControllerTest < ActionController::TestCase
def test_get_edit_with_an_existing_time_entry_with_inactive_activity
te = TimeEntry.find(1)
te.activity = TimeEntryActivity.find_by_name("Inactive Activity")
- te.save!
+ te.save!(:validate => false)
@request.session[:user_id] = 1
get :edit, :project_id => 1, :id => 1
diff --git a/test/unit/time_entry_activity_test.rb b/test/unit/time_entry_activity_test.rb
index ab3a03530..8c6fef7aa 100644
--- a/test/unit/time_entry_activity_test.rb
+++ b/test/unit/time_entry_activity_test.rb
@@ -105,13 +105,13 @@ class TimeEntryActivityTest < ActiveSupport::TestCase
def test_destroying_a_system_activity_should_reassign_children_activities
project = Project.generate!
+ entries = []
+
system_activity = TimeEntryActivity.create!(:name => 'Activity')
+ entries << TimeEntry.generate!(:project => project, :activity => system_activity)
+
project_activity = TimeEntryActivity.create!(:name => 'Activity', :project => project, :parent_id => system_activity.id)
-
- entries = [
- TimeEntry.generate!(:project => project, :activity => system_activity),
- TimeEntry.generate!(:project => project, :activity => project_activity)
- ]
+ entries << TimeEntry.generate!(:project => project.reload, :activity => project_activity)
assert_difference 'TimeEntryActivity.count', -2 do
assert_nothing_raised do
diff --git a/test/unit/time_entry_query_test.rb b/test/unit/time_entry_query_test.rb
index 3c4e3cdba..64b64107a 100644
--- a/test/unit/time_entry_query_test.rb
+++ b/test/unit/time_entry_query_test.rb
@@ -30,9 +30,9 @@ class TimeEntryQueryTest < ActiveSupport::TestCase
def test_activity_filter_should_consider_system_and_project_activities
TimeEntry.delete_all
system = TimeEntryActivity.create!(:name => 'Foo')
+ TimeEntry.generate!(:activity => system, :hours => 1.0)
override = TimeEntryActivity.create!(:name => 'Foo', :parent_id => system.id, :project_id => 1)
other = TimeEntryActivity.create!(:name => 'Bar')
- TimeEntry.generate!(:activity => system, :hours => 1.0)
TimeEntry.generate!(:activity => override, :hours => 2.0)
TimeEntry.generate!(:activity => other, :hours => 4.0)