summaryrefslogtreecommitdiffstats
path: root/test/functional/my_controller_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2018-10-29 06:14:56 +0000
committerGo MAEDA <maeda@farend.jp>2018-10-29 06:14:56 +0000
commitbae9ffd327d98a2129510a898780d38ddba67b99 (patch)
treea797c2962722b1d08955ab3a8c8314b485dd35ee /test/functional/my_controller_test.rb
parentd3ffa9252ca3461929e8974ef15f2dbde6803431 (diff)
downloadredmine-bae9ffd327d98a2129510a898780d38ddba67b99.tar.gz
redmine-bae9ffd327d98a2129510a898780d38ddba67b99.zip
Filter out issues from closed projects in the following widgets (#29449):
* Issues assigned to me * Reported issues * Watched issues Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@17611 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/my_controller_test.rb')
-rw-r--r--test/functional/my_controller_test.rb88
1 files changed, 88 insertions, 0 deletions
diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb
index e9123ff68..d8db74ff6 100644
--- a/test/functional/my_controller_test.rb
+++ b/test/functional/my_controller_test.rb
@@ -227,6 +227,94 @@ class MyControllerTest < Redmine::ControllerTest
assert_select 'div.mypage-box', blocks.size
end
+ def test_page_with_assigned_issues_block_should_not_show_issues_from_closed_projects
+ preferences = User.find(2).pref
+ preferences.my_page_layout = {'top' => ['issuesassignedtome']}
+ preferences.my_page_settings = {'issuesassignedtome' => {}}
+ preferences.save!
+
+ issue = Issue.find(1)
+ issue.assigned_to = User.find(2)
+ issue.save!
+
+ project = Project.find(2)
+ project.close
+ project.save
+
+ get :page
+
+ assert_response :success
+ assert_select '#block-issuesassignedtome table.issues tbody' do
+ report_url = css_select('h3 a').map {|e| e.attr('href')}.first
+ assert_match 'f%5B%5D=project.status', report_url
+ assert_match 'v%5Bproject.status%5D%5B%5D=1', report_url
+
+ assert_select 'tr', 1
+ assert_select 'tr[id=?]', 'issue-1', 1, :title => 'Cannot print recipes'
+ assert_select 'tr[id=?]', 'issue-4', 0
+ end
+ end
+
+ def test_page_with_reported_issues_block_should_not_show_issues_from_closed_projects
+ preferences = User.find(2).pref
+ preferences.my_page_layout = {'top' => ['issuesreportedbyme']}
+ preferences.my_page_settings = {'issuesreportedbyme' => {}}
+ preferences.save!
+
+ issue = Issue.find(1)
+ issue.assigned_to = User.find(2)
+ issue.save!
+
+ project = Project.find(2)
+ project.close
+ project.save
+
+ get :page
+
+ assert_response :success
+ assert_select '#block-issuesreportedbyme' do
+ report_url = css_select('h3 a').map {|e| e.attr('href')}.first
+ assert_match 'f%5B%5D=project.status', report_url
+ assert_match 'v%5Bproject.status%5D%5B%5D=1', report_url
+
+ assert_select 'table.issues tbody tr', 10
+ assert_select 'table.issues tbody tr[id=?]', 'issue-1', 1, :title => 'Cannot print recipes'
+ assert_select 'table.issues tbody tr[id=?]', 'issue-4', 0
+ end
+ end
+
+ def test_page_with_watched_issues_block_should_not_show_issues_from_closed_projects
+ preferences = User.find(2).pref
+ preferences.my_page_layout = {'top' => ['issueswatched']}
+ preferences.my_page_settings = {'issueswatched' => {}}
+ preferences.save!
+
+ issue = Issue.find(1)
+ issue.watcher_user_ids = ['1', '2']
+ issue.save!
+
+ issue2 = Issue.find(4)
+ issue2.watcher_user_ids = ['2']
+ issue2.save!
+
+ project = Project.find(2)
+ project.close
+ project.save
+
+ get :page
+
+ assert_response :success
+ assert_select '#block-issueswatched table.issues tbody' do
+ report_url = css_select('h3 a').map {|e| e.attr('href')}.first
+ assert_match 'f%5B%5D=project.status', report_url
+ assert_match 'v%5Bproject.status%5D%5B%5D=1', report_url
+
+ assert_select 'tr', 1
+ assert_select 'tr[id=?]', 'issue-1', 1, :title => 'Cannot print recipes'
+ assert_select 'tr[id=?]', 'issue-4', 0
+ end
+ end
+
def test_my_account_should_show_editable_custom_fields
get :account
assert_response :success