summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-03-30 17:16:25 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-03-30 17:16:25 +0000
commit8b39f62a4ce7852dc1fc5b65b307af643b9d0593 (patch)
tree000c56c11123ebcfd1ccd4a3f6a3d13887c023c0 /test
parentb12994e12ee3409d0a09558ba260a6bb2e5de13a (diff)
downloadredmine-8b39f62a4ce7852dc1fc5b65b307af643b9d0593.tar.gz
redmine-8b39f62a4ce7852dc1fc5b65b307af643b9d0593.zip
Modules selection lost on project form after validation failure (#8012).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5265 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/projects_controller_test.rb16
-rw-r--r--test/unit/project_test.rb8
2 files changed, 24 insertions, 0 deletions
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb
index fefb8d53b..74912a764 100644
--- a/test/functional/projects_controller_test.rb
+++ b/test/functional/projects_controller_test.rb
@@ -288,6 +288,22 @@ class ProjectsControllerTest < ActionController::TestCase
end
end
+ def test_create_should_preserve_modules_on_validation_failure
+ with_settings :default_projects_modules => ['issue_tracking', 'repository'] do
+ @request.session[:user_id] = 1
+ assert_no_difference 'Project.count' do
+ post :create, :project => {
+ :name => "blog",
+ :identifier => "",
+ :enabled_module_names => %w(issue_tracking news)
+ }
+ end
+ assert_response :success
+ project = assigns(:project)
+ assert_equal %w(issue_tracking news), project.enabled_module_names.sort
+ end
+ end
+
def test_create_should_not_accept_get
@request.session[:user_id] = 1
get :create
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb
index ba61db49c..d307500e3 100644
--- a/test/unit/project_test.rb
+++ b/test/unit/project_test.rb
@@ -588,6 +588,14 @@ class ProjectTest < ActiveSupport::TestCase
assert_nil Project.next_identifier
end
+ def test_enabled_module_names
+ with_settings :default_projects_modules => ['issue_tracking', 'repository'] do
+ project = Project.new
+
+ project.enabled_module_names = %w(issue_tracking news)
+ assert_equal %w(issue_tracking news), project.enabled_module_names.sort
+ end
+ end
def test_enabled_module_names_should_not_recreate_enabled_modules
project = Project.find(1)