diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-12-03 16:15:16 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-12-03 16:15:16 +0000 |
commit | 9284a32c9ac7b932feb72cf0d2d5fb1626ec7862 (patch) | |
tree | fff2301ee930a2324256ec1d3558b00a3c0ecf15 /test/unit/project_test.rb | |
parent | f6c633212a4ee6a1d598b4c4c5c0027cfeb9d010 (diff) | |
download | redmine-9284a32c9ac7b932feb72cf0d2d5fb1626ec7862.tar.gz redmine-9284a32c9ac7b932feb72cf0d2d5fb1626ec7862.zip |
Moves project attributes default assignments from ProjectsController#new to the model (#6064).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4460 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/project_test.rb')
-rw-r--r-- | test/unit/project_test.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb index d57813ae4..c77d7e61d 100644 --- a/test/unit/project_test.rb +++ b/test/unit/project_test.rb @@ -60,6 +60,35 @@ class ProjectTest < ActiveSupport::TestCase assert_equal "eCookbook", @ecookbook.name end + def test_default_attributes + with_settings :default_projects_public => '1' do + assert_equal true, Project.new.is_public + assert_equal false, Project.new(:is_public => false).is_public + end + + with_settings :default_projects_public => '0' do + assert_equal false, Project.new.is_public + assert_equal true, Project.new(:is_public => true).is_public + end + + with_settings :sequential_project_identifiers => '1' do + assert !Project.new.identifier.blank? + assert Project.new(:identifier => '').identifier.blank? + end + + with_settings :sequential_project_identifiers => '0' do + assert Project.new.identifier.blank? + assert !Project.new(:identifier => 'test').blank? + end + + with_settings :default_projects_modules => ['issue_tracking', 'repository'] do + assert_equal ['issue_tracking', 'repository'], Project.new.enabled_module_names + end + + assert_equal Tracker.all, Project.new.trackers + assert_equal Tracker.find(1, 3), Project.new(:tracker_ids => [1, 3]).trackers + end + def test_update assert_equal "eCookbook", @ecookbook.name @ecookbook.name = "eCook" |