From 8141110eb2698df14694e009e8312eb9df0ce738 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 17 May 2009 12:59:14 +0000 Subject: [PATCH] Ability to allow non-admin users to create projects (#1007). This can be enabled in permissions settings. A non-admin user who creates a project is automatically added as a project member (the first role is given, TODO: make this given role configurable). Projects can be added from the public projects list. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2750 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/application.rb | 9 +++- app/controllers/projects_controller.rb | 12 +++-- app/models/user.rb | 3 ++ app/views/projects/index.rhtml | 2 +- config/locales/bg.yml | 1 + config/locales/bs.yml | 1 + config/locales/ca.yml | 1 + config/locales/cs.yml | 1 + config/locales/da.yml | 1 + config/locales/de.yml | 1 + config/locales/en.yml | 1 + config/locales/es.yml | 1 + config/locales/fi.yml | 1 + config/locales/fr.yml | 1 + config/locales/gl.yml | 1 + config/locales/he.yml | 1 + config/locales/hu.yml | 1 + config/locales/it.yml | 1 + config/locales/ja.yml | 1 + config/locales/ko.yml | 1 + config/locales/lt.yml | 1 + config/locales/nl.yml | 1 + config/locales/no.yml | 1 + config/locales/pl.yml | 1 + config/locales/pt-BR.yml | 1 + config/locales/pt.yml | 1 + config/locales/ro.yml | 1 + config/locales/ru.yml | 1 + config/locales/sk.yml | 1 + config/locales/sl.yml | 1 + config/locales/sr.yml | 1 + config/locales/sv.yml | 1 + config/locales/th.yml | 1 + config/locales/tr.yml | 1 + config/locales/uk.yml | 1 + config/locales/vi.yml | 1 + config/locales/zh-TW.yml | 1 + config/locales/zh.yml | 1 + lib/redmine.rb | 1 + test/fixtures/roles.yml | 1 + test/functional/projects_controller_test.rb | 50 +++++++++++++++++++++ test/integration/admin_test.rb | 24 ---------- 42 files changed, 106 insertions(+), 30 deletions(-) diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 9123cfc0..fcf83c92 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -114,10 +114,15 @@ class ApplicationController < ActionController::Base end # Authorize the user for the requested action - def authorize(ctrl = params[:controller], action = params[:action]) - allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project) + def authorize(ctrl = params[:controller], action = params[:action], global = false) + allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project, :global => global) allowed ? true : deny_access end + + # Authorize the user for the requested action outside a project + def authorize_global(ctrl = params[:controller], action = params[:action], global = true) + authorize(ctrl, action, global) + end # make sure that the user is a member of the project (or admin) if project is private # used as a before_filter for actions that do not require any particular permission on the project diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 0dcc874c..5f508cb5 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -26,7 +26,8 @@ class ProjectsController < ApplicationController before_filter :find_project, :except => [ :index, :list, :add, :copy, :activity ] before_filter :find_optional_project, :only => :activity before_filter :authorize, :except => [ :index, :list, :add, :copy, :archive, :unarchive, :destroy, :activity ] - before_filter :require_admin, :only => [ :add, :copy, :archive, :unarchive, :destroy ] + before_filter :authorize_global, :only => :add + before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ] accept_key_auth :activity after_filter :only => [:add, :edit, :archive, :unarchive, :destroy] do |controller| @@ -75,9 +76,14 @@ class ProjectsController < ApplicationController @project.enabled_module_names = params[:enabled_modules] if @project.save @project.set_parent!(params[:project]['parent_id']) if User.current.admin? && params[:project].has_key?('parent_id') + # Add current user as a project member if he is not admin + unless User.current.admin? + m = Member.new(:user => User.current, :roles => Role.builtin(false).find(:all, :order => 'position', :limit => 1)) + @project.members << m + end flash[:notice] = l(:notice_successful_create) - redirect_to :controller => 'admin', :action => 'projects' - end + redirect_to :controller => 'projects', :action => 'settings', :id => @project + end end end diff --git a/app/models/user.rb b/app/models/user.rb index 7bcf999f..0caaf34f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -277,6 +277,9 @@ class User < ActiveRecord::Base roles.detect {|role| (project.is_public? || role.member?) && role.allowed_to?(action)} elsif options[:global] + # Admin users are always authorized + return true if admin? + # authorize if user has at least one role that has this permission roles = memberships.collect {|m| m.roles}.flatten.uniq roles.detect {|r| r.allowed_to?(action)} || (self.logged? ? Role.non_member.allowed_to?(action) : Role.anonymous.allowed_to?(action)) diff --git a/app/views/projects/index.rhtml b/app/views/projects/index.rhtml index 047d11ff..3b243579 100644 --- a/app/views/projects/index.rhtml +++ b/app/views/projects/index.rhtml @@ -1,5 +1,5 @@
- <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'add'}, :class => 'icon icon-add') + ' |' if User.current.admin? %> + <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'add'}, :class => 'icon icon-add') + ' |' if User.current.allowed_to?(:add_project, nil, :global => true) %> <%= link_to l(:label_issue_view_all), { :controller => 'issues' } %> | <%= link_to l(:label_overall_activity), { :controller => 'projects', :action => 'activity' }%>
diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 36923c83..4a18f493 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -796,3 +796,4 @@ bg: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/bs.yml b/config/locales/bs.yml index 59b25214..841a5675 100644 --- a/config/locales/bs.yml +++ b/config/locales/bs.yml @@ -829,3 +829,4 @@ bs: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 20113f97..a209a1e5 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -799,3 +799,4 @@ ca: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/cs.yml b/config/locales/cs.yml index a8040ca1..cae51f95 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -802,3 +802,4 @@ cs: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/da.yml b/config/locales/da.yml index 6ce2fecb..f388fc8c 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -829,3 +829,4 @@ da: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/de.yml b/config/locales/de.yml index 26855bfd..a6f56a2a 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -828,3 +828,4 @@ de: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/en.yml b/config/locales/en.yml index 3cfcbc66..9cfc0b1d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -292,6 +292,7 @@ en: setting_openid: Allow OpenID login and registration setting_password_min_length: Minimum password length + permission_add_project: Create project permission_edit_project: Edit project permission_select_project_modules: Select project modules permission_manage_members: Manage members diff --git a/config/locales/es.yml b/config/locales/es.yml index ff61e7d9..8cc72b34 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -849,3 +849,4 @@ es: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/fi.yml b/config/locales/fi.yml index a1cf5cbe..1f2f86c8 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -839,3 +839,4 @@ fi: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/fr.yml b/config/locales/fr.yml index bbe18dca..ce9c2f77 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -324,6 +324,7 @@ fr: setting_openid: "Autoriser l'authentification et l'enregistrement OpenID" setting_password_min_length: Longueur minimum des mots de passe + permission_add_project: Créer un projet permission_edit_project: Modifier le projet permission_select_project_modules: Choisir les modules permission_manage_members: Gérer les members diff --git a/config/locales/gl.yml b/config/locales/gl.yml index 167310e4..0f619adb 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -828,3 +828,4 @@ gl: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/he.yml b/config/locales/he.yml index a720e4c2..d3b9bf0e 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -811,3 +811,4 @@ he: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 2e0b8043..7b00becd 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -834,3 +834,4 @@ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/it.yml b/config/locales/it.yml index 935c3814..721d72c4 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -814,3 +814,4 @@ it: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/ja.yml b/config/locales/ja.yml index a9024f2e..b00e9f2f 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -827,3 +827,4 @@ ja: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 221c524b..b8cffa40 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -858,3 +858,4 @@ ko: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/lt.yml b/config/locales/lt.yml index 7ba666e1..3b2776d1 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -839,3 +839,4 @@ lt: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 00229a81..071c1306 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -784,3 +784,4 @@ nl: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/no.yml b/config/locales/no.yml index ed9309eb..a481d491 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -801,3 +801,4 @@ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 1a20ffa4..d252ec0a 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -832,3 +832,4 @@ pl: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 6592f6ce..7f4343a2 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -834,3 +834,4 @@ pt-BR: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/pt.yml b/config/locales/pt.yml index ffc2795d..ea40131c 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -820,3 +820,4 @@ pt: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/ro.yml b/config/locales/ro.yml index 7e5f098f..7d61ffb1 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -799,3 +799,4 @@ ro: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 8b0605bb..f2274db9 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -926,3 +926,4 @@ ru: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/sk.yml b/config/locales/sk.yml index dd23496b..8c73612e 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -800,3 +800,4 @@ sk: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/sl.yml b/config/locales/sl.yml index f3f4d2fa..676f744f 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -798,3 +798,4 @@ sl: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/sr.yml b/config/locales/sr.yml index ed56fda9..8c6a753a 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -822,3 +822,4 @@ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 3a7add90..47e33f35 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -856,3 +856,4 @@ sv: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/th.yml b/config/locales/th.yml index a2468270..2f5bc740 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -799,3 +799,4 @@ th: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/tr.yml b/config/locales/tr.yml index c167d921..4ab55429 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -835,3 +835,4 @@ tr: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 719b2c3f..5a7da7e7 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -798,3 +798,4 @@ uk: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/vi.yml b/config/locales/vi.yml index b981752c..d6885501 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -868,3 +868,4 @@ vi: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 1c84c993..a9cfc4af 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -906,3 +906,4 @@ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 3145d303..cce3115c 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -831,3 +831,4 @@ zh: mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}. label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + permission_add_project: Create project diff --git a/lib/redmine.rb b/lib/redmine.rb index 5ac32b2f..6188e7e5 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -20,6 +20,7 @@ REDMINE_SUPPORTED_SCM = %w( Subversion Darcs Mercurial Cvs Bazaar Git Filesystem Redmine::AccessControl.map do |map| map.permission :view_project, {:projects => [:show, :activity]}, :public => true map.permission :search_project, {:search => :index}, :public => true + map.permission :add_project, {:projects => :add}, :require => :loggedin map.permission :edit_project, {:projects => [:settings, :edit]}, :require => :member map.permission :select_project_modules, {:projects => :modules}, :require => :member map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member_login]}, :require => :member diff --git a/test/fixtures/roles.yml b/test/fixtures/roles.yml index d8ae2c81..0bd07844 100644 --- a/test/fixtures/roles.yml +++ b/test/fixtures/roles.yml @@ -5,6 +5,7 @@ roles_001: builtin: 0 permissions: | --- + - :add_project - :edit_project - :manage_members - :manage_versions diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 2fba106e..0560a54b 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -89,6 +89,56 @@ class ProjectsControllerTest < Test::Unit::TestCase ) end + def test_get_add + @request.session[:user_id] = 1 + get :add + assert_response :success + assert_template 'add' + end + + def test_get_add_by_non_admin + @request.session[:user_id] = 2 + get :add + assert_response :success + assert_template 'add' + end + + def test_post_add + @request.session[:user_id] = 1 + post :add, :project => { :name => "blog", + :description => "weblog", + :identifier => "blog", + :is_public => 1, + :custom_field_values => { '3' => 'Beta' } + } + assert_redirected_to '/projects/blog/settings' + + project = Project.find_by_name('blog') + assert_kind_of Project, project + assert_equal 'weblog', project.description + assert_equal true, project.is_public? + end + + def test_post_add_by_non_admin + @request.session[:user_id] = 2 + post :add, :project => { :name => "blog", + :description => "weblog", + :identifier => "blog", + :is_public => 1, + :custom_field_values => { '3' => 'Beta' } + } + assert_redirected_to '/projects/blog/settings' + + project = Project.find_by_name('blog') + assert_kind_of Project, project + assert_equal 'weblog', project.description + assert_equal true, project.is_public? + + # User should be added as a project member + assert User.find(2).member_of?(project) + assert_equal 1, project.members.size + end + def test_show_routing assert_routing( {:method => :get, :path => '/projects/test'}, diff --git a/test/integration/admin_test.rb b/test/integration/admin_test.rb index 6c1db750..dd14e666 100644 --- a/test/integration/admin_test.rb +++ b/test/integration/admin_test.rb @@ -39,28 +39,4 @@ class AdminTest < ActionController::IntegrationTest locked_user = User.try_to_login("psmith", "psmith09") assert_equal nil, locked_user end - - def test_add_project - log_user("admin", "admin") - get "projects/new" - assert_response :success - assert_template "projects/add" - post "projects", :project => { :name => "blog", - :description => "weblog", - :identifier => "blog", - :is_public => 1, - :custom_field_values => { '3' => 'Beta' } - } - assert_redirected_to "admin/projects" - assert_equal 'Successful creation.', flash[:notice] - - project = Project.find_by_name("blog") - assert_kind_of Project, project - assert_equal "weblog", project.description - assert_equal true, project.is_public? - - get "admin/projects" - assert_response :success - assert_template "admin/projects" - end end