summaryrefslogtreecommitdiffstats
path: root/test/test_helper.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-07-18 21:26:30 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-07-18 21:26:30 +0000
commitec31b616982f137abdee8d0c6aa9dc4a6d103189 (patch)
treee4f5dc564be2b4ce5047a1f5acb2790fdc3b70ca /test/test_helper.rb
parent1db54e228d98d20536133bf52a8af0ce67616dc3 (diff)
downloadredmine-ec31b616982f137abdee8d0c6aa9dc4a6d103189.tar.gz
redmine-ec31b616982f137abdee8d0c6aa9dc4a6d103189.zip
Removes calls to #assert_template and #assigns in functional tests.
git-svn-id: http://svn.redmine.org/redmine/trunk@15695 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r--test/test_helper.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 2572495df..0be4d42ae 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -282,6 +282,29 @@ module Redmine
end
class ControllerTest < ActionController::TestCase
+ # Returns the issues that are displayed in the list in the same order
+ def issues_in_list
+ ids = css_select('tr.issue td.id').map(&:text).map(&:to_i)
+ Issue.where(:id => ids).sort_by {|issue| ids.index(issue.id)}
+ end
+
+ # Return the columns that are displayed in the list
+ def columns_in_issues_list
+ css_select('table.issues thead th:not(.checkbox)').map(&:text)
+ end
+
+ # Verifies that the query filters match the expected filters
+ def assert_query_filters(expected_filters)
+ response.body =~ /initFilters\(\);\s*((addFilter\(.+\);\s*)*)/
+ filter_init = $1.to_s
+
+ expected_filters.each do |field, operator, values|
+ s = "addFilter(#{field.to_json}, #{operator.to_json}, #{Array(values).to_json});"
+ assert_include s, filter_init
+ end
+ assert_equal expected_filters.size, filter_init.scan("addFilter").size, "filters counts don't match"
+ end
+
def process(method, path, parameters={}, session={}, flash={})
if parameters.key?(:params) || parameters.key?(:session)
raise ArgumentError if session.present?