summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-03-11 19:33:38 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-03-11 19:33:38 +0000
commit624723d0cef9bd8a9528745f4b75ee22f6b1ad2e (patch)
treed622adeab661c9e833c260b5f5bdef076b14c034 /test
parent64fb0a561aebbc7583695deba29697f84c620dfb (diff)
downloadredmine-624723d0cef9bd8a9528745f4b75ee22f6b1ad2e.tar.gz
redmine-624723d0cef9bd8a9528745f4b75ee22f6b1ad2e.zip
Activity enhancements:
* overall activity view and feed added, link is available on the project list (#423, #494) * switch added on the project activity view to include subprojects (closes #530) git-svn-id: http://redmine.rubyforge.org/svn/trunk@1227 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/issues.yml18
-rw-r--r--test/fixtures/messages.yml4
-rw-r--r--test/functional/projects_controller_test.rb58
-rw-r--r--test/unit/project_test.rb9
4 files changed, 73 insertions, 16 deletions
diff --git a/test/fixtures/issues.yml b/test/fixtures/issues.yml
index b3c662039..4f42d93c4 100644
--- a/test/fixtures/issues.yml
+++ b/test/fixtures/issues.yml
@@ -44,9 +44,9 @@ issues_003:
start_date: <%= 1.day.from_now.to_date.to_s(:db) %>
due_date: <%= 40.day.ago.to_date.to_s(:db) %>
issues_004:
- created_on: 2006-07-19 21:07:27 +02:00
+ created_on: <%= 5.days.ago.to_date.to_s(:db) %>
project_id: 2
- updated_on: 2006-07-19 21:07:27 +02:00
+ updated_on: <%= 2.days.ago.to_date.to_s(:db) %>
priority_id: 4
subject: Issue on project 2
id: 4
@@ -57,4 +57,18 @@ issues_004:
assigned_to_id:
author_id: 2
status_id: 1
+issues_005:
+ created_on: <%= 5.days.ago.to_date.to_s(:db) %>
+ project_id: 3
+ updated_on: <%= 2.days.ago.to_date.to_s(:db) %>
+ priority_id: 4
+ subject: Subproject issue
+ id: 5
+ fixed_version_id:
+ category_id:
+ description: This is an issue on a cookbook subproject
+ tracker_id: 1
+ assigned_to_id:
+ author_id: 2
+ status_id: 1
diff --git a/test/fixtures/messages.yml b/test/fixtures/messages.yml
index 5bb2438dd..f82f376c1 100644
--- a/test/fixtures/messages.yml
+++ b/test/fixtures/messages.yml
@@ -45,8 +45,8 @@ messages_004:
parent_id:
board_id: 1
messages_005:
- created_on: 2007-09-12 17:18:00 +02:00
- updated_on: 2007-09-12 17:18:00 +02:00
+ created_on: <%= 3.days.ago.to_date.to_s(:db) %>
+ updated_on: <%= 3.days.ago.to_date.to_s(:db) %>
subject: 'RE: post 2'
id: 5
replies_count: 0
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb
index f610469df..75b4673a1 100644
--- a/test/functional/projects_controller_test.rb
+++ b/test/functional/projects_controller_test.rb
@@ -22,7 +22,8 @@ require 'projects_controller'
class ProjectsController; def rescue_action(e) raise e end; end
class ProjectsControllerTest < Test::Unit::TestCase
- fixtures :projects, :versions, :users, :roles, :members, :issues, :journals, :journal_details, :trackers, :projects_trackers, :issue_statuses, :enabled_modules, :enumerations
+ fixtures :projects, :versions, :users, :roles, :members, :issues, :journals, :journal_details,
+ :trackers, :projects_trackers, :issue_statuses, :enabled_modules, :enumerations, :boards, :messages
def setup
@controller = ProjectsController.new
@@ -129,11 +130,15 @@ class ProjectsControllerTest < Test::Unit::TestCase
assert assigns(:versions).include?(Version.find(1))
end
- def test_activity
- get :activity, :id => 1
+ def test_project_activity
+ get :activity, :id => 1, :with_subprojects => 0
assert_response :success
assert_template 'activity'
assert_not_nil assigns(:events_by_day)
+ assert_not_nil assigns(:events)
+
+ # subproject issue not included by default
+ assert !assigns(:events).include?(Issue.find(5))
assert_tag :tag => "h3",
:content => /#{2.days.ago.to_date.day}/,
@@ -163,6 +168,53 @@ class ProjectsControllerTest < Test::Unit::TestCase
}
end
+ def test_activity_with_subprojects
+ get :activity, :id => 1, :with_subprojects => 1
+ assert_response :success
+ assert_template 'activity'
+ assert_not_nil assigns(:events)
+
+ assert assigns(:events).include?(Issue.find(1))
+ assert !assigns(:events).include?(Issue.find(4))
+ # subproject issue
+ assert assigns(:events).include?(Issue.find(5))
+ end
+
+ def test_global_activity_anonymous
+ get :activity
+ assert_response :success
+ assert_template 'activity'
+ assert_not_nil assigns(:events)
+
+ assert assigns(:events).include?(Issue.find(1))
+ # Issue of a private project
+ assert !assigns(:events).include?(Issue.find(4))
+ end
+
+ def test_global_activity_logged_user
+ @request.session[:user_id] = 2 # manager
+ get :activity
+ assert_response :success
+ assert_template 'activity'
+ assert_not_nil assigns(:events)
+
+ assert assigns(:events).include?(Issue.find(1))
+ # Issue of a private project the user belongs to
+ assert assigns(:events).include?(Issue.find(4))
+ end
+
+
+ def test_global_activity_with_all_types
+ get :activity, :show_issues => 1, :show_news => 1, :show_files => 1, :show_documents => 1, :show_changesets => 1, :show_wiki_pages => 1, :show_messages => 1
+ assert_response :success
+ assert_template 'activity'
+ assert_not_nil assigns(:events)
+
+ assert assigns(:events).include?(Issue.find(1))
+ assert !assigns(:events).include?(Issue.find(4))
+ assert assigns(:events).include?(Message.find(5))
+ end
+
def test_calendar
get :calendar, :id => 1
assert_response :success
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb
index b05b7b09f..f7da6ecb5 100644
--- a/test/unit/project_test.rb
+++ b/test/unit/project_test.rb
@@ -126,13 +126,4 @@ class ProjectTest < Test::Unit::TestCase
assert_equal [1, 2, 3], parent.rolled_up_trackers.collect(&:id)
assert_equal [2, 3], child.rolled_up_trackers.collect(&:id)
end
-
- def test_issues_status_changes
- journals = @ecookbook.issues_status_changes 3.days.ago.to_date, Date.today
- assert_equal 1, journals.size
- assert_kind_of Journal, journals.first
-
- journals = @ecookbook.issues_status_changes 30.days.ago.to_date, 10.days.ago.to_date
- assert_equal 0, journals.size
- end
end