summaryrefslogtreecommitdiffstats
path: root/test/functional/admin_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-01-05 11:33:49 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-01-05 11:33:49 +0000
commitc9fd7513edd0f594227fc681dcd654e41bd118e6 (patch)
tree90f582a920c1bc017d2342b53f23ea91230bd586 /test/functional/admin_controller_test.rb
parent8d9b04865bac785d12b0aac43fe0c62488c39fec (diff)
downloadredmine-c9fd7513edd0f594227fc681dcd654e41bd118e6.tar.gz
redmine-c9fd7513edd0f594227fc681dcd654e41bd118e6.zip
Default configuration data can now be loaded from the administration screen.
A message is automatically displayed on this screen if roles, trackers,... have not been configured yet. The rake task is still available and the data loading code is wrapped in a transaction. git-svn-id: http://redmine.rubyforge.org/svn/trunk@1040 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/admin_controller_test.rb')
-rw-r--r--test/functional/admin_controller_test.rb28
1 files changed, 27 insertions, 1 deletions
diff --git a/test/functional/admin_controller_test.rb b/test/functional/admin_controller_test.rb
index d49fe2dda..742c1f6bb 100644
--- a/test/functional/admin_controller_test.rb
+++ b/test/functional/admin_controller_test.rb
@@ -22,7 +22,7 @@ require 'admin_controller'
class AdminController; def rescue_action(e) raise e end; end
class AdminControllerTest < Test::Unit::TestCase
- fixtures :projects, :users
+ fixtures :projects, :users, :roles
def setup
@controller = AdminController.new
@@ -32,6 +32,25 @@ class AdminControllerTest < Test::Unit::TestCase
@request.session[:user_id] = 1 # admin
end
+ def test_index
+ get :index
+ assert_no_tag :tag => 'div',
+ :attributes => { :class => /nodata/ }
+ end
+
+ def test_index_with_no_configuration_data
+ delete_configuration_data
+ get :index
+ assert_tag :tag => 'div',
+ :attributes => { :class => /nodata/ }
+ end
+
+ def test_load_default_configuration_data
+ delete_configuration_data
+ post :default_configuration, :lang => 'fr'
+ assert IssueStatus.find_by_name('Nouveau')
+ end
+
def test_get_mail_options
get :mail_options
assert_response :success
@@ -58,4 +77,11 @@ class AdminControllerTest < Test::Unit::TestCase
assert_response :success
assert_template 'info'
end
+
+ def delete_configuration_data
+ Role.delete_all('builtin = 0')
+ Tracker.delete_all
+ IssueStatus.delete_all
+ Enumeration.delete_all
+ end
end