summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-12-19 13:32:21 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-12-19 13:32:21 +0000
commit9d120c872c1b5849d987e3950f2cf914e1e34fe2 (patch)
tree1e7f18d27c5fd988b027a51de6fff78d061b551e /test
parent008ad85d10c299f4bcca25a20753740836325786 (diff)
downloadredmine-9d120c872c1b5849d987e3950f2cf914e1e34fe2.tar.gz
redmine-9d120c872c1b5849d987e3950f2cf914e1e34fe2.zip
Fixes block reordering on my page (#2971).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3194 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/user_preferences.yml19
-rw-r--r--test/functional/my_controller_test.rb26
2 files changed, 38 insertions, 7 deletions
diff --git a/test/fixtures/user_preferences.yml b/test/fixtures/user_preferences.yml
index b9ba37765..01e008dc7 100644
--- a/test/fixtures/user_preferences.yml
+++ b/test/fixtures/user_preferences.yml
@@ -4,11 +4,10 @@ user_preferences_001:
---
:my_page_layout:
left:
- - latest_news
+ - latestnews
- documents
right:
- - issues_assigned_to_me
- - issues_reported_by_me
+ - issuesassignedtome
top:
- calendar
@@ -16,9 +15,17 @@ user_preferences_001:
user_id: 1
hide_mail: true
user_preferences_002:
- others: |+
- --- {}
-
+ others: |
+ ---
+ :my_page_layout:
+ left:
+ - latestnews
+ - documents
+ right:
+ - issuesassignedtome
+ top:
+ - calendar
+
id: 2
user_id: 3
hide_mail: false \ No newline at end of file
diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb
index 8862466e7..ef12d7864 100644
--- a/test/functional/my_controller_test.rb
+++ b/test/functional/my_controller_test.rb
@@ -22,7 +22,7 @@ require 'my_controller'
class MyController; def rescue_action(e) raise e end; end
class MyControllerTest < ActionController::TestCase
- fixtures :users, :issues, :issue_statuses, :trackers, :enumerations, :custom_fields
+ fixtures :users, :user_preferences, :roles, :projects, :issues, :issue_statuses, :trackers, :enumerations, :custom_fields
def setup
@controller = MyController.new
@@ -105,4 +105,28 @@ class MyControllerTest < ActionController::TestCase
assert_redirected_to 'my/account'
assert User.try_to_login('jsmith', 'hello')
end
+
+ def test_page_layout
+ get :page_layout
+ assert_response :success
+ assert_template 'page_layout'
+ end
+
+ def test_add_block
+ xhr :post, :add_block, :block => 'issuesreportedbyme'
+ assert_response :success
+ assert User.find(2).pref[:my_page_layout]['top'].include?('issuesreportedbyme')
+ end
+
+ def test_remove_block
+ xhr :post, :remove_block, :block => 'issuesassignedtome'
+ assert_response :success
+ assert !User.find(2).pref[:my_page_layout].values.flatten.include?('issuesassignedtome')
+ end
+
+ def test_order_blocks
+ xhr :post, :order_blocks, :group => 'left', 'list-left' => ['documents', 'calendar', 'latestnews']
+ assert_response :success
+ assert_equal ['documents', 'calendar', 'latestnews'], User.find(2).pref[:my_page_layout]['left']
+ end
end