summaryrefslogtreecommitdiffstats
path: root/test/functional/my_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-03-15 17:59:31 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-03-15 17:59:31 +0000
commitf828a985ae49d2de6aa6aef1705778cfd3d7b433 (patch)
tree67ee73440d289c543591d1aad672d18c2a70b872 /test/functional/my_controller_test.rb
parentd21627b70f5431de33a8c532b7b73799c5ae1700 (diff)
downloadredmine-f828a985ae49d2de6aa6aef1705778cfd3d7b433.tar.gz
redmine-f828a985ae49d2de6aa6aef1705778cfd3d7b433.zip
Let user display a custom query on "My page" (#1565).
git-svn-id: http://svn.redmine.org/redmine/trunk@16406 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/my_controller_test.rb')
-rw-r--r--test/functional/my_controller_test.rb54
1 files changed, 53 insertions, 1 deletions
diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb
index f6c9d5ab2..f6771a1f5 100644
--- a/test/functional/my_controller_test.rb
+++ b/test/functional/my_controller_test.rb
@@ -19,7 +19,7 @@ require File.expand_path('../../test_helper', __FILE__)
class MyControllerTest < Redmine::ControllerTest
fixtures :users, :email_addresses, :user_preferences, :roles, :projects, :members, :member_roles,
- :issues, :issue_statuses, :trackers, :enumerations, :custom_fields, :auth_sources
+ :issues, :issue_statuses, :trackers, :enumerations, :custom_fields, :auth_sources, :queries
def setup
@request.session[:user_id] = 2
@@ -91,6 +91,58 @@ class MyControllerTest < Redmine::ControllerTest
assert_select 'table.issues.sort-by-due-date'
end
end
+
+ def test_page_with_issuequery_block_and_no_settings
+ user = User.find(2)
+ user.pref.my_page_layout = {'top' => ['issuequery']}
+ user.pref.save!
+
+ get :page
+ assert_response :success
+
+ assert_select '#block-issuequery' do
+ assert_select 'h3', :text => 'Issues'
+ assert_select 'select[name=?]', 'settings[issuequery][query_id]' do
+ assert_select 'option[value="5"]', :text => 'Open issues by priority and tracker'
+ end
+ end
+ end
+
+ def test_page_with_issuequery_block_and_selected_query
+ user = User.find(2)
+ query = IssueQuery.create!(:name => 'All issues', :user => user, :column_names => [:tracker, :subject, :status, :assigned_to])
+ user.pref.my_page_layout = {'top' => ['issuequery']}
+ user.pref.my_page_settings = {'issuequery' => {:query_id => query.id}}
+ user.pref.save!
+
+ get :page
+ assert_response :success
+
+ assert_select '#block-issuequery' do
+ # assert number of columns (columns from query + id column + checkbox column)
+ assert_select 'table.issues th', 6
+ # assert results limit
+ assert_select 'table.issues tr.issue', 10
+ assert_select 'table.issues td.assigned_to'
+ end
+ end
+
+ def test_page_with_issuequery_block_and_selected_query_and_custom_columns
+ user = User.find(2)
+ query = IssueQuery.create!(:name => 'All issues', :user => user, :column_names => [:tracker, :subject, :status, :assigned_to])
+ user.pref.my_page_layout = {'top' => ['issuequery']}
+ user.pref.my_page_settings = {'issuequery' => {:query_id => query.id, :columns => [:subject, :due_date]}}
+ user.pref.save!
+
+ get :page
+ assert_response :success
+
+ assert_select '#block-issuequery' do
+ # assert number of columns (columns from query + id column + checkbox column)
+ assert_select 'table.issues th', 4
+ assert_select 'table.issues th', :text => 'Due date'
+ end
+ end
def test_page_with_all_blocks
blocks = Redmine::MyPage.blocks.keys