summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/member_roles.yml23
-rw-r--r--test/fixtures/members.yml5
-rw-r--r--test/functional/attachments_controller_test.rb2
-rw-r--r--test/functional/boards_controller_test.rb2
-rw-r--r--test/functional/documents_controller_test.rb2
-rw-r--r--test/functional/issue_categories_controller_test.rb2
-rw-r--r--test/functional/issue_relations_controller_test.rb1
-rw-r--r--test/functional/issues_controller_test.rb1
-rw-r--r--test/functional/journals_controller_test.rb2
-rw-r--r--test/functional/mail_handler_controller_test.rb2
-rw-r--r--test/functional/members_controller_test.rb10
-rw-r--r--test/functional/messages_controller_test.rb2
-rw-r--r--test/functional/news_controller_test.rb2
-rw-r--r--test/functional/projects_controller_test.rb2
-rw-r--r--test/functional/queries_controller_test.rb2
-rw-r--r--test/functional/repositories_bazaar_controller_test.rb2
-rw-r--r--test/functional/repositories_controller_test.rb2
-rw-r--r--test/functional/repositories_darcs_controller_test.rb2
-rw-r--r--test/functional/repositories_git_controller_test.rb2
-rw-r--r--test/functional/repositories_mercurial_controller_test.rb2
-rw-r--r--test/functional/repositories_subversion_controller_test.rb2
-rw-r--r--test/functional/roles_controller_test.rb22
-rw-r--r--test/functional/search_controller_test.rb2
-rw-r--r--test/functional/timelog_controller_test.rb2
-rw-r--r--test/functional/users_controller_test.rb6
-rw-r--r--test/functional/versions_controller_test.rb2
-rw-r--r--test/functional/watchers_controller_test.rb2
-rw-r--r--test/functional/wiki_controller_test.rb2
-rw-r--r--test/functional/wikis_controller_test.rb2
-rw-r--r--test/unit/activity_test.rb2
-rw-r--r--test/unit/changeset_test.rb2
-rw-r--r--test/unit/issue_test.rb6
-rw-r--r--test/unit/mail_handler_test.rb1
-rw-r--r--test/unit/mailer_test.rb2
-rw-r--r--test/unit/member_test.rb38
-rw-r--r--test/unit/message_test.rb6
-rw-r--r--test/unit/news_test.rb2
-rw-r--r--test/unit/project_test.rb4
-rw-r--r--test/unit/query_test.rb2
-rw-r--r--test/unit/search_test.rb3
-rw-r--r--test/unit/user_test.rb12
41 files changed, 119 insertions, 73 deletions
diff --git a/test/fixtures/member_roles.yml b/test/fixtures/member_roles.yml
new file mode 100644
index 000000000..6c91f15a4
--- /dev/null
+++ b/test/fixtures/member_roles.yml
@@ -0,0 +1,23 @@
+---
+member_roles_001:
+ id: 1
+ role_id: 1
+ member_id: 1
+member_roles_002:
+ id: 2
+ role_id: 2
+ member_id: 2
+member_roles_003:
+ id: 3
+ role_id: 2
+ member_id: 3
+member_roles_004:
+ id: 4
+ role_id: 2
+ member_id: 4
+member_roles_005:
+ id: 5
+ role_id: 1
+ member_id: 5
+
+ \ No newline at end of file
diff --git a/test/fixtures/members.yml b/test/fixtures/members.yml
index 4156bb867..b1b19c3f5 100644
--- a/test/fixtures/members.yml
+++ b/test/fixtures/members.yml
@@ -2,21 +2,18 @@
members_001:
created_on: 2006-07-19 19:35:33 +02:00
project_id: 1
- role_id: 1
id: 1
user_id: 2
mail_notification: true
members_002:
created_on: 2006-07-19 19:35:36 +02:00
project_id: 1
- role_id: 2
id: 2
user_id: 3
mail_notification: true
members_003:
created_on: 2006-07-19 19:35:36 +02:00
project_id: 2
- role_id: 2
id: 3
user_id: 2
mail_notification: true
@@ -24,7 +21,6 @@ members_004:
id: 4
created_on: 2006-07-19 19:35:36 +02:00
project_id: 1
- role_id: 2
# Locked user
user_id: 5
mail_notification: true
@@ -32,7 +28,6 @@ members_005:
id: 5
created_on: 2006-07-19 19:35:33 +02:00
project_id: 5
- role_id: 1
user_id: 2
mail_notification: true
\ No newline at end of file
diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb
index a49caa876..3a4b89785 100644
--- a/test/functional/attachments_controller_test.rb
+++ b/test/functional/attachments_controller_test.rb
@@ -23,7 +23,7 @@ class AttachmentsController; def rescue_action(e) raise e end; end
class AttachmentsControllerTest < Test::Unit::TestCase
- fixtures :users, :projects, :roles, :members, :enabled_modules, :issues, :trackers, :attachments,
+ fixtures :users, :projects, :roles, :members, :member_roles, :enabled_modules, :issues, :trackers, :attachments,
:versions, :wiki_pages, :wikis, :documents
def setup
diff --git a/test/functional/boards_controller_test.rb b/test/functional/boards_controller_test.rb
index 01db0f94b..eb9a50ea5 100644
--- a/test/functional/boards_controller_test.rb
+++ b/test/functional/boards_controller_test.rb
@@ -22,7 +22,7 @@ require 'boards_controller'
class BoardsController; def rescue_action(e) raise e end; end
class BoardsControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :members, :roles, :boards, :messages, :enabled_modules
+ fixtures :projects, :users, :members, :member_roles, :roles, :boards, :messages, :enabled_modules
def setup
@controller = BoardsController.new
diff --git a/test/functional/documents_controller_test.rb b/test/functional/documents_controller_test.rb
index b5788c776..c0fe0957e 100644
--- a/test/functional/documents_controller_test.rb
+++ b/test/functional/documents_controller_test.rb
@@ -22,7 +22,7 @@ require 'documents_controller'
class DocumentsController; def rescue_action(e) raise e end; end
class DocumentsControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :roles, :members, :enabled_modules, :documents, :enumerations
+ fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :documents, :enumerations
def setup
@controller = DocumentsController.new
diff --git a/test/functional/issue_categories_controller_test.rb b/test/functional/issue_categories_controller_test.rb
index 5bd826370..ffb87339d 100644
--- a/test/functional/issue_categories_controller_test.rb
+++ b/test/functional/issue_categories_controller_test.rb
@@ -22,7 +22,7 @@ require 'issue_categories_controller'
class IssueCategoriesController; def rescue_action(e) raise e end; end
class IssueCategoriesControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :members, :roles, :enabled_modules, :issue_categories
+ fixtures :projects, :users, :members, :member_roles, :roles, :enabled_modules, :issue_categories
def setup
@controller = IssueCategoriesController.new
diff --git a/test/functional/issue_relations_controller_test.rb b/test/functional/issue_relations_controller_test.rb
index dc64a004e..a23f64a96 100644
--- a/test/functional/issue_relations_controller_test.rb
+++ b/test/functional/issue_relations_controller_test.rb
@@ -10,6 +10,7 @@ class IssueRelationsControllerTest < Test::Unit::TestCase
:users,
:roles,
:members,
+ :member_roles,
:issues,
:issue_statuses,
:enabled_modules,
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index dfea32899..2bb95f8bf 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -26,6 +26,7 @@ class IssuesControllerTest < Test::Unit::TestCase
:users,
:roles,
:members,
+ :member_roles,
:issues,
:issue_statuses,
:versions,
diff --git a/test/functional/journals_controller_test.rb b/test/functional/journals_controller_test.rb
index 327c7e79a..ae112ab6f 100644
--- a/test/functional/journals_controller_test.rb
+++ b/test/functional/journals_controller_test.rb
@@ -22,7 +22,7 @@ require 'journals_controller'
class JournalsController; def rescue_action(e) raise e end; end
class JournalsControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :members, :roles, :issues, :journals, :journal_details, :enabled_modules
+ fixtures :projects, :users, :members, :member_roles, :roles, :issues, :journals, :journal_details, :enabled_modules
def setup
@controller = JournalsController.new
diff --git a/test/functional/mail_handler_controller_test.rb b/test/functional/mail_handler_controller_test.rb
index 6c5af23f0..e99f99a2c 100644
--- a/test/functional/mail_handler_controller_test.rb
+++ b/test/functional/mail_handler_controller_test.rb
@@ -22,7 +22,7 @@ require 'mail_handler_controller'
class MailHandlerController; def rescue_action(e) raise e end; end
class MailHandlerControllerTest < Test::Unit::TestCase
- fixtures :users, :projects, :enabled_modules, :roles, :members, :issues, :issue_statuses, :trackers, :enumerations
+ fixtures :users, :projects, :enabled_modules, :roles, :members, :member_roles, :issues, :issue_statuses, :trackers, :enumerations
FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures/mail_handler'
diff --git a/test/functional/members_controller_test.rb b/test/functional/members_controller_test.rb
index efd28a414..2680c3934 100644
--- a/test/functional/members_controller_test.rb
+++ b/test/functional/members_controller_test.rb
@@ -23,7 +23,7 @@ class MembersController; def rescue_action(e) raise e end; end
class MembersControllerTest < Test::Unit::TestCase
- fixtures :projects, :members, :roles, :users
+ fixtures :projects, :members, :member_roles, :roles, :users
def setup
@controller = MembersController.new
@@ -42,7 +42,7 @@ class MembersControllerTest < Test::Unit::TestCase
def test_create
assert_difference 'Member.count' do
- post :new, :id => 1, :member => {:role_id => 1, :user_id => 7}
+ post :new, :id => 1, :member => {:role_ids => [1], :user_id => 7}
end
assert_redirected_to '/projects/ecookbook/settings/members'
assert User.find(7).member_of?(Project.find(1))
@@ -50,7 +50,7 @@ class MembersControllerTest < Test::Unit::TestCase
def test_create_by_user_login
assert_difference 'Member.count' do
- post :new, :id => 1, :member => {:role_id => 1, :user_login => 'someone'}
+ post :new, :id => 1, :member => {:role_ids => [1], :user_login => 'someone'}
end
assert_redirected_to '/projects/ecookbook/settings/members'
assert User.find(7).member_of?(Project.find(1))
@@ -58,7 +58,7 @@ class MembersControllerTest < Test::Unit::TestCase
def test_create_multiple
assert_difference 'Member.count', 3 do
- post :new, :id => 1, :member => {:role_id => 1, :user_ids => [7, 8, 9]}
+ post :new, :id => 1, :member => {:role_ids => [1], :user_ids => [7, 8, 9]}
end
assert_redirected_to '/projects/ecookbook/settings/members'
assert User.find(7).member_of?(Project.find(1))
@@ -66,7 +66,7 @@ class MembersControllerTest < Test::Unit::TestCase
def test_edit
assert_no_difference 'Member.count' do
- post :edit, :id => 2, :member => {:role_id => 1, :user_id => 3}
+ post :edit, :id => 2, :member => {:role_ids => [1], :user_id => 3}
end
assert_redirected_to '/projects/ecookbook/settings/members'
end
diff --git a/test/functional/messages_controller_test.rb b/test/functional/messages_controller_test.rb
index 94062b402..70061aca3 100644
--- a/test/functional/messages_controller_test.rb
+++ b/test/functional/messages_controller_test.rb
@@ -22,7 +22,7 @@ require 'messages_controller'
class MessagesController; def rescue_action(e) raise e end; end
class MessagesControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :members, :roles, :boards, :messages, :enabled_modules
+ fixtures :projects, :users, :members, :member_roles, :roles, :boards, :messages, :enabled_modules
def setup
@controller = MessagesController.new
diff --git a/test/functional/news_controller_test.rb b/test/functional/news_controller_test.rb
index 22ad2d241..a31362444 100644
--- a/test/functional/news_controller_test.rb
+++ b/test/functional/news_controller_test.rb
@@ -22,7 +22,7 @@ require 'news_controller'
class NewsController; def rescue_action(e) raise e end; end
class NewsControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :roles, :members, :enabled_modules, :news, :comments
+ fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :news, :comments
def setup
@controller = NewsController.new
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb
index 4393ac075..2fba106e3 100644
--- a/test/functional/projects_controller_test.rb
+++ b/test/functional/projects_controller_test.rb
@@ -22,7 +22,7 @@ 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,
+ fixtures :projects, :versions, :users, :roles, :members, :member_roles, :issues, :journals, :journal_details,
:trackers, :projects_trackers, :issue_statuses, :enabled_modules, :enumerations, :boards, :messages,
:attachments
diff --git a/test/functional/queries_controller_test.rb b/test/functional/queries_controller_test.rb
index 1951aff8f..8edde44aa 100644
--- a/test/functional/queries_controller_test.rb
+++ b/test/functional/queries_controller_test.rb
@@ -22,7 +22,7 @@ require 'queries_controller'
class QueriesController; def rescue_action(e) raise e end; end
class QueriesControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :members, :roles, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :custom_fields, :custom_values, :queries
+ fixtures :projects, :users, :members, :member_roles, :roles, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :custom_fields, :custom_values, :queries
def setup
@controller = QueriesController.new
diff --git a/test/functional/repositories_bazaar_controller_test.rb b/test/functional/repositories_bazaar_controller_test.rb
index acb6c1d21..b1787a538 100644
--- a/test/functional/repositories_bazaar_controller_test.rb
+++ b/test/functional/repositories_bazaar_controller_test.rb
@@ -22,7 +22,7 @@ require 'repositories_controller'
class RepositoriesController; def rescue_action(e) raise e end; end
class RepositoriesBazaarControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :roles, :members, :repositories, :enabled_modules
+ fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules
# No '..' in the repository path
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/bazaar_repository'
diff --git a/test/functional/repositories_controller_test.rb b/test/functional/repositories_controller_test.rb
index ceb7341b0..d51a42976 100644
--- a/test/functional/repositories_controller_test.rb
+++ b/test/functional/repositories_controller_test.rb
@@ -22,7 +22,7 @@ require 'repositories_controller'
class RepositoriesController; def rescue_action(e) raise e end; end
class RepositoriesControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :roles, :members, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
+ fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
def setup
@controller = RepositoriesController.new
diff --git a/test/functional/repositories_darcs_controller_test.rb b/test/functional/repositories_darcs_controller_test.rb
index 43c715924..8f1c7df98 100644
--- a/test/functional/repositories_darcs_controller_test.rb
+++ b/test/functional/repositories_darcs_controller_test.rb
@@ -22,7 +22,7 @@ require 'repositories_controller'
class RepositoriesController; def rescue_action(e) raise e end; end
class RepositoriesDarcsControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :roles, :members, :repositories, :enabled_modules
+ fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules
# No '..' in the repository path
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/darcs_repository'
diff --git a/test/functional/repositories_git_controller_test.rb b/test/functional/repositories_git_controller_test.rb
index 201a50677..7f63ea3a9 100644
--- a/test/functional/repositories_git_controller_test.rb
+++ b/test/functional/repositories_git_controller_test.rb
@@ -22,7 +22,7 @@ require 'repositories_controller'
class RepositoriesController; def rescue_action(e) raise e end; end
class RepositoriesGitControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :roles, :members, :repositories, :enabled_modules
+ fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules
# No '..' in the repository path
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/git_repository'
diff --git a/test/functional/repositories_mercurial_controller_test.rb b/test/functional/repositories_mercurial_controller_test.rb
index cb870aa32..53cbedd00 100644
--- a/test/functional/repositories_mercurial_controller_test.rb
+++ b/test/functional/repositories_mercurial_controller_test.rb
@@ -22,7 +22,7 @@ require 'repositories_controller'
class RepositoriesController; def rescue_action(e) raise e end; end
class RepositoriesMercurialControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :roles, :members, :repositories, :enabled_modules
+ fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules
# No '..' in the repository path
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/mercurial_repository'
diff --git a/test/functional/repositories_subversion_controller_test.rb b/test/functional/repositories_subversion_controller_test.rb
index aef8c2ef2..e31094e7b 100644
--- a/test/functional/repositories_subversion_controller_test.rb
+++ b/test/functional/repositories_subversion_controller_test.rb
@@ -22,7 +22,7 @@ require 'repositories_controller'
class RepositoriesController; def rescue_action(e) raise e end; end
class RepositoriesSubversionControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :roles, :members, :enabled_modules,
+ fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules,
:repositories, :issues, :issue_statuses, :changesets, :changes,
:issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
diff --git a/test/functional/roles_controller_test.rb b/test/functional/roles_controller_test.rb
index 5c47be180..61e9bd6df 100644
--- a/test/functional/roles_controller_test.rb
+++ b/test/functional/roles_controller_test.rb
@@ -22,7 +22,7 @@ require 'roles_controller'
class RolesController; def rescue_action(e) raise e end; end
class RolesControllerTest < Test::Unit::TestCase
- fixtures :roles, :users, :members, :workflows
+ fixtures :roles, :users, :members, :member_roles, :workflows
def setup
@controller = RolesController.new
@@ -65,7 +65,7 @@ class RolesControllerTest < Test::Unit::TestCase
:permissions => ['add_issues', 'edit_issues', 'log_time', ''],
:assignable => '0'}
- assert_redirected_to 'roles/list'
+ assert_redirected_to 'roles'
role = Role.find_by_name('RoleWithoutWorkflowCopy')
assert_not_nil role
assert_equal [:add_issues, :edit_issues, :log_time], role.permissions
@@ -78,7 +78,7 @@ class RolesControllerTest < Test::Unit::TestCase
:assignable => '0'},
:copy_workflow_from => '1'
- assert_redirected_to 'roles/list'
+ assert_redirected_to 'roles'
role = Role.find_by_name('RoleWithWorkflowCopy')
assert_not_nil role
assert_equal Role.find(1).workflows.size, role.workflows.size
@@ -97,7 +97,7 @@ class RolesControllerTest < Test::Unit::TestCase
:permissions => ['edit_project', ''],
:assignable => '0'}
- assert_redirected_to 'roles/list'
+ assert_redirected_to 'roles'
role = Role.find(1)
assert_equal [:edit_project], role.permissions
end
@@ -107,7 +107,7 @@ class RolesControllerTest < Test::Unit::TestCase
assert r.save
post :destroy, :id => r
- assert_redirected_to 'roles/list'
+ assert_redirected_to 'roles'
assert_nil Role.find_by_id(r.id)
end
@@ -139,7 +139,7 @@ class RolesControllerTest < Test::Unit::TestCase
def test_post_report
post :report, :permissions => { '0' => '', '1' => ['edit_issues'], '3' => ['add_issues', 'delete_issues']}
- assert_redirected_to 'roles/list'
+ assert_redirected_to 'roles'
assert_equal [:edit_issues], Role.find(1).permissions
assert_equal [:add_issues, :delete_issues], Role.find(3).permissions
@@ -148,33 +148,33 @@ class RolesControllerTest < Test::Unit::TestCase
def test_clear_all_permissions
post :report, :permissions => { '0' => '' }
- assert_redirected_to 'roles/list'
+ assert_redirected_to 'roles'
assert Role.find(1).permissions.empty?
end
def test_move_highest
post :edit, :id => 3, :role => {:move_to => 'highest'}
- assert_redirected_to 'roles/list'
+ assert_redirected_to 'roles'
assert_equal 1, Role.find(3).position
end
def test_move_higher
position = Role.find(3).position
post :edit, :id => 3, :role => {:move_to => 'higher'}
- assert_redirected_to 'roles/list'
+ assert_redirected_to 'roles'
assert_equal position - 1, Role.find(3).position
end
def test_move_lower
position = Role.find(2).position
post :edit, :id => 2, :role => {:move_to => 'lower'}
- assert_redirected_to 'roles/list'
+ assert_redirected_to 'roles'
assert_equal position + 1, Role.find(2).position
end
def test_move_lowest
post :edit, :id => 2, :role => {:move_to => 'lowest'}
- assert_redirected_to 'roles/list'
+ assert_redirected_to 'roles'
assert_equal Role.count, Role.find(2).position
end
end
diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb
index ec81e417f..0f74c537e 100644
--- a/test/functional/search_controller_test.rb
+++ b/test/functional/search_controller_test.rb
@@ -5,7 +5,7 @@ require 'search_controller'
class SearchController; def rescue_action(e) raise e end; end
class SearchControllerTest < Test::Unit::TestCase
- fixtures :projects, :enabled_modules, :roles, :users,
+ fixtures :projects, :enabled_modules, :roles, :users, :members, :member_roles,
:issues, :trackers, :issue_statuses,
:custom_fields, :custom_values,
:repositories, :changesets
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index a69a70ec0..df80f5d5a 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/test/functional/timelog_controller_test.rb
@@ -22,7 +22,7 @@ require 'timelog_controller'
class TimelogController; def rescue_action(e) raise e end; end
class TimelogControllerTest < Test::Unit::TestCase
- fixtures :projects, :enabled_modules, :roles, :members, :issues, :time_entries, :users, :trackers, :enumerations, :issue_statuses, :custom_fields, :custom_values
+ fixtures :projects, :enabled_modules, :roles, :members, :member_roles, :issues, :time_entries, :users, :trackers, :enumerations, :issue_statuses, :custom_fields, :custom_values
def setup
@controller = TimelogController.new
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb
index d41f88214..e9aad1a98 100644
--- a/test/functional/users_controller_test.rb
+++ b/test/functional/users_controller_test.rb
@@ -24,7 +24,7 @@ class UsersController; def rescue_action(e) raise e end; end
class UsersControllerTest < Test::Unit::TestCase
include Redmine::I18n
- fixtures :users, :projects, :members
+ fixtures :users, :projects, :members, :member_roles, :roles
def setup
@controller = UsersController.new
@@ -123,9 +123,9 @@ class UsersControllerTest < Test::Unit::TestCase
def test_edit_membership
post :edit_membership, :id => 2, :membership_id => 1,
- :membership => { :role_id => 2}
+ :membership => { :role_ids => [2]}
assert_redirected_to :action => 'edit', :id => '2', :tab => 'memberships'
- assert_equal 2, Member.find(1).role_id
+ assert_equal [2], Member.find(1).role_ids
end
def test_edit_with_activation_should_send_a_notification
diff --git a/test/functional/versions_controller_test.rb b/test/functional/versions_controller_test.rb
index 2ddf3a9f1..3d212def3 100644
--- a/test/functional/versions_controller_test.rb
+++ b/test/functional/versions_controller_test.rb
@@ -22,7 +22,7 @@ require 'versions_controller'
class VersionsController; def rescue_action(e) raise e end; end
class VersionsControllerTest < Test::Unit::TestCase
- fixtures :projects, :versions, :issues, :users, :roles, :members, :enabled_modules
+ fixtures :projects, :versions, :issues, :users, :roles, :members, :member_roles, :enabled_modules
def setup
@controller = VersionsController.new
diff --git a/test/functional/watchers_controller_test.rb b/test/functional/watchers_controller_test.rb
index cd6539410..275599f9b 100644
--- a/test/functional/watchers_controller_test.rb
+++ b/test/functional/watchers_controller_test.rb
@@ -22,7 +22,7 @@ require 'watchers_controller'
class WatchersController; def rescue_action(e) raise e end; end
class WatchersControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :roles, :members, :enabled_modules,
+ fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules,
:issues, :trackers, :projects_trackers, :issue_statuses, :enumerations, :watchers
def setup
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb
index 22d816e59..9d104c527 100644
--- a/test/functional/wiki_controller_test.rb
+++ b/test/functional/wiki_controller_test.rb
@@ -22,7 +22,7 @@ require 'wiki_controller'
class WikiController; def rescue_action(e) raise e end; end
class WikiControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :roles, :members, :enabled_modules, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions, :attachments
+ fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions, :attachments
def setup
@controller = WikiController.new
diff --git a/test/functional/wikis_controller_test.rb b/test/functional/wikis_controller_test.rb
index c558db0cb..7a5634f1d 100644
--- a/test/functional/wikis_controller_test.rb
+++ b/test/functional/wikis_controller_test.rb
@@ -22,7 +22,7 @@ require 'wikis_controller'
class WikisController; def rescue_action(e) raise e end; end
class WikisControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :roles, :members, :enabled_modules, :wikis
+ fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :wikis
def setup
@controller = WikisController.new
diff --git a/test/unit/activity_test.rb b/test/unit/activity_test.rb
index d47694e48..0b1773dd2 100644
--- a/test/unit/activity_test.rb
+++ b/test/unit/activity_test.rb
@@ -18,7 +18,7 @@
require File.dirname(__FILE__) + '/../test_helper'
class ActivityTest < Test::Unit::TestCase
- fixtures :projects, :versions, :attachments, :users, :roles, :members, :issues, :journals, :journal_details,
+ fixtures :projects, :versions, :attachments, :users, :roles, :members, :member_roles, :issues, :journals, :journal_details,
:trackers, :projects_trackers, :issue_statuses, :enabled_modules, :enumerations, :boards, :messages
def setup
diff --git a/test/unit/changeset_test.rb b/test/unit/changeset_test.rb
index 6a0df2c5d..78e2339f9 100644
--- a/test/unit/changeset_test.rb
+++ b/test/unit/changeset_test.rb
@@ -18,7 +18,7 @@
require File.dirname(__FILE__) + '/../test_helper'
class ChangesetTest < Test::Unit::TestCase
- fixtures :projects, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :users, :members, :trackers
+ fixtures :projects, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :users, :members, :member_roles, :trackers
def setup
end
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index 5052f7a0c..d836f2bb5 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -18,7 +18,7 @@
require File.dirname(__FILE__) + '/../test_helper'
class IssueTest < Test::Unit::TestCase
- fixtures :projects, :users, :members,
+ fixtures :projects, :users, :members, :member_roles,
:trackers, :projects_trackers,
:issue_statuses, :issue_categories,
:enumerations,
@@ -242,6 +242,10 @@ class IssueTest < Test::Unit::TestCase
assert !Issue.new(:due_date => 1.day.ago.to_date, :status => IssueStatus.find(:first, :conditions => {:is_closed => true})).overdue?
end
+ def test_assignable_users
+ assert_kind_of User, Issue.find(1).assignable_users.first
+ end
+
def test_create_should_send_email_notification
ActionMailer::Base.deliveries.clear
issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, :status_id => 1, :priority => Enumeration.priorities.first, :subject => 'test_create', :estimated_hours => '1:30')
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb
index 704e12c7f..295b8ae68 100644
--- a/test/unit/mail_handler_test.rb
+++ b/test/unit/mail_handler_test.rb
@@ -22,6 +22,7 @@ class MailHandlerTest < Test::Unit::TestCase
:enabled_modules,
:roles,
:members,
+ :member_roles,
:issues,
:issue_statuses,
:workflows,
diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb
index d15af6e03..b1c39bb5e 100644
--- a/test/unit/mailer_test.rb
+++ b/test/unit/mailer_test.rb
@@ -19,7 +19,7 @@ require File.dirname(__FILE__) + '/../test_helper'
class MailerTest < Test::Unit::TestCase
include Redmine::I18n
- fixtures :projects, :issues, :users, :members, :documents, :attachments, :news, :tokens, :journals, :journal_details, :changesets, :trackers, :issue_statuses, :enumerations, :messages, :boards, :repositories
+ fixtures :projects, :issues, :users, :members, :member_roles, :documents, :attachments, :news, :tokens, :journals, :journal_details, :changesets, :trackers, :issue_statuses, :enumerations, :messages, :boards, :repositories
def test_generated_links_in_emails
ActionMailer::Base.deliveries.clear
diff --git a/test/unit/member_test.rb b/test/unit/member_test.rb
index 079782306..66f1283ca 100644
--- a/test/unit/member_test.rb
+++ b/test/unit/member_test.rb
@@ -18,34 +18,54 @@
require File.dirname(__FILE__) + '/../test_helper'
class MemberTest < Test::Unit::TestCase
- fixtures :users, :projects, :roles, :members
+ fixtures :users, :projects, :roles, :members, :member_roles
def setup
@jsmith = Member.find(1)
end
def test_create
- member = Member.new(:project_id => 1, :user_id => 4, :role_id => 1)
- assert member.save
+ member = Member.new(:project_id => 1, :user_id => 4, :role_ids => [1, 2])
+ assert member.save
+ member.reload
+
+ assert_equal 2, member.roles.size
+ assert_equal Role.find(1), member.roles.sort.first
end
def test_update
assert_equal "eCookbook", @jsmith.project.name
- assert_equal "Manager", @jsmith.role.name
+ assert_equal "Manager", @jsmith.roles.first.name
assert_equal "jsmith", @jsmith.user.login
- @jsmith.role = Role.find(2)
+ @jsmith.mail_notification = !@jsmith.mail_notification
assert @jsmith.save
end
+
+ def test_update_roles
+ assert_equal 1, @jsmith.roles.size
+ @jsmith.role_ids = [1, 2]
+ assert @jsmith.save
+ assert_equal 2, @jsmith.reload.roles.size
+ end
def test_validate
- member = Member.new(:project_id => 1, :user_id => 2, :role_id =>2)
- # same use can't have more than one role for a project
+ member = Member.new(:project_id => 1, :user_id => 2, :role_ids => [2])
+ # same use can't have more than one membership for a project
+ assert !member.save
+
+ member = Member.new(:project_id => 1, :user_id => 2, :role_ids => [])
+ # must have one role at least
assert !member.save
end
- def test_destroy
- @jsmith.destroy
+ def test_destroy
+ assert_difference 'Member.count', -1 do
+ assert_difference 'MemberRole.count', -1 do
+ @jsmith.destroy
+ end
+ end
+
assert_raise(ActiveRecord::RecordNotFound) { Member.find(@jsmith.id) }
end
end
diff --git a/test/unit/message_test.rb b/test/unit/message_test.rb
index bc9bd5fd3..d88e98bcf 100644
--- a/test/unit/message_test.rb
+++ b/test/unit/message_test.rb
@@ -18,7 +18,7 @@
require File.dirname(__FILE__) + '/../test_helper'
class MessageTest < Test::Unit::TestCase
- fixtures :projects, :roles, :members, :boards, :messages, :users, :watchers
+ fixtures :projects, :roles, :members, :member_roles, :boards, :messages, :users, :watchers
def setup
@board = Board.find(1)
@@ -116,7 +116,7 @@ class MessageTest < Test::Unit::TestCase
author = message.author
assert message.editable_by?(author)
- author.role_for_project(message.project).remove_permission!(:edit_own_messages)
+ author.roles_for_project(message.project).first.remove_permission!(:edit_own_messages)
assert !message.reload.editable_by?(author.reload)
end
@@ -125,7 +125,7 @@ class MessageTest < Test::Unit::TestCase
author = message.author
assert message.destroyable_by?(author)
- author.role_for_project(message.project).remove_permission!(:delete_own_messages)
+ author.roles_for_project(message.project).first.remove_permission!(:delete_own_messages)
assert !message.reload.destroyable_by?(author.reload)
end
end
diff --git a/test/unit/news_test.rb b/test/unit/news_test.rb
index 3a908dcc8..a4fc89e90 100644
--- a/test/unit/news_test.rb
+++ b/test/unit/news_test.rb
@@ -18,7 +18,7 @@
require File.dirname(__FILE__) + '/../test_helper'
class NewsTest < Test::Unit::TestCase
- fixtures :projects, :users, :roles, :members, :enabled_modules, :news
+ fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :news
def valid_news
{ :title => 'Test news', :description => 'Lorem ipsum etc', :author => User.find(:first) }
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb
index f9a17e2ec..4ecd9d4a8 100644
--- a/test/unit/project_test.rb
+++ b/test/unit/project_test.rb
@@ -20,8 +20,8 @@ require File.dirname(__FILE__) + '/../test_helper'
class ProjectTest < Test::Unit::TestCase
fixtures :projects, :enabled_modules,
:issues, :issue_statuses, :journals, :journal_details,
- :users, :members, :roles, :projects_trackers, :trackers, :boards,
- :queries
+ :users, :members, :member_roles, :roles, :projects_trackers, :trackers, :boards,
+ :queries
def setup
@ecookbook = Project.find(1)
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index 80112b779..e12bac8d7 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -18,7 +18,7 @@
require File.dirname(__FILE__) + '/../test_helper'
class QueryTest < Test::Unit::TestCase
- fixtures :projects, :enabled_modules, :users, :members, :roles, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :watchers, :custom_fields, :custom_values, :versions, :queries
+ fixtures :projects, :enabled_modules, :users, :members, :member_roles, :roles, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :watchers, :custom_fields, :custom_values, :versions, :queries
def test_custom_fields_for_all_projects_should_be_available_in_global_queries
query = Query.new(:project => nil, :name => '_')
diff --git a/test/unit/search_test.rb b/test/unit/search_test.rb
index 1b32df733..46d769451 100644
--- a/test/unit/search_test.rb
+++ b/test/unit/search_test.rb
@@ -19,7 +19,8 @@ require File.dirname(__FILE__) + '/../test_helper'
class SearchTest < Test::Unit::TestCase
fixtures :users,
- :members,
+ :members,
+ :member_roles,
:projects,
:roles,
:enabled_modules,
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb
index f6d270410..7080c0b5b 100644
--- a/test/unit/user_test.rb
+++ b/test/unit/user_test.rb
@@ -18,7 +18,7 @@
require File.dirname(__FILE__) + '/../test_helper'
class UserTest < Test::Unit::TestCase
- fixtures :users, :members, :projects
+ fixtures :users, :members, :projects, :roles, :member_roles
def setup
@admin = User.find(1)
@@ -130,14 +130,14 @@ class UserTest < Test::Unit::TestCase
assert_equal key, @jsmith.rss_key
end
- def test_role_for_project
+ def test_roles_for_project
# user with a role
- role = @jsmith.role_for_project(Project.find(1))
- assert_kind_of Role, role
- assert_equal "Manager", role.name
+ roles = @jsmith.roles_for_project(Project.find(1))
+ assert_kind_of Role, roles.first
+ assert_equal "Manager", roles.first.name
# user with no role
- assert !@dlopper.role_for_project(Project.find(2)).member?
+ assert_nil @dlopper.roles_for_project(Project.find(2)).detect {|role| role.member?}
end
def test_mail_notification_all