summaryrefslogtreecommitdiffstats
path: root/test/helpers/search_helper_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/helpers/search_helper_test.rb')
-rw-r--r--test/helpers/search_helper_test.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/helpers/search_helper_test.rb b/test/helpers/search_helper_test.rb
index 33fe56a7b..12b8fa82f 100644
--- a/test/helpers/search_helper_test.rb
+++ b/test/helpers/search_helper_test.rb
@@ -54,4 +54,36 @@ class SearchHelperTest < Redmine::HelperTest
r
)
end
+
+ def test_issues_filter_path
+ # rubocop:disable Layout/LineLength
+ assert_equal(
+ '/issues?f[]=status_id&f[]=any_searchable&f[]=project_id&op[any_searchable]=*~&op[project_id]==&op[status_id]=*&set_filter=1&sort=updated_on:desc&v[any_searchable][]=recipe&v[project_id][]=mine',
+ Addressable::URI.unencode(issues_filter_path('recipe', projects_scope: 'my_projects'))
+ )
+ assert_equal(
+ '/issues?f[]=status_id&f[]=any_searchable&f[]=project_id&op[any_searchable]=*~&op[project_id]==&op[status_id]=*&set_filter=1&sort=updated_on:desc&v[any_searchable][]=recipe&v[project_id][]=bookmarks',
+ Addressable::URI.unencode(issues_filter_path('recipe', projects_scope: 'bookmarks'))
+ )
+ assert_equal(
+ '/issues?f[]=status_id&f[]=any_searchable&op[any_searchable]=*~&op[status_id]=*&set_filter=1&sort=updated_on:desc&v[any_searchable][]=recipe',
+ Addressable::URI.unencode(issues_filter_path('recipe', projects_scope: 'all'))
+ )
+ # f[]=subject
+ assert_equal(
+ '/issues?f[]=status_id&f[]=subject&op[status_id]=*&op[subject]=*~&set_filter=1&sort=updated_on:desc&v[subject][]=recipe',
+ Addressable::URI.unencode(issues_filter_path('recipe', projects_scope: 'all', titles_only: '1'))
+ )
+ # op[subject]=~ (contains)
+ assert_equal(
+ '/issues?f[]=status_id&f[]=subject&op[status_id]=*&op[subject]=~&set_filter=1&sort=updated_on:desc&v[subject][]=recipe',
+ Addressable::URI.unencode(issues_filter_path('recipe', projects_scope: 'all', titles_only: '1', all_words: ''))
+ )
+ # op[status_id]=o (open)
+ assert_equal(
+ '/issues?f[]=status_id&f[]=subject&op[status_id]=o&op[subject]=*~&set_filter=1&sort=updated_on:desc&v[subject][]=recipe',
+ Addressable::URI.unencode(issues_filter_path('recipe', projects_scope: 'all', titles_only: '1', open_issues: '1'))
+ )
+ # rubocop:enable Layout/LineLength
+ end
end