##// END OF EJS Templates
Replace Date.today with User.current.today (#22320)....
Replace Date.today with User.current.today (#22320). Depending on the offset between a user's configured timezone and the server timezone, Date.today may be more or less often wrong from the user's perspective, leading to things like issues marked as overdue too early or too late, or yesterday / tomorrow being displayed / selected where 'today' is intended. A test case illustrating the problem with Issue#overdue? is included Patch by Jens Kraemer. git-svn-id: http://svn.redmine.org/redmine/trunk@15379 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r14856:cda9c63d9c21
r14997:ed50d42210ea
Show More
auto_completes_controller_test.rb
90 lines | 3.2 KiB | text/x-ruby | RubyLexer
/ test / functional / auto_completes_controller_test.rb
Jean-Philippe Lang
Functional tests cleanup....
r10709 # Redmine - project management software
Jean-Philippe Lang
Updates copyright for 2016....
r14856 # Copyright (C) 2006-2016 Jean-Philippe Lang
Jean-Philippe Lang
Functional tests cleanup....
r10709 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Jean-Baptiste Barth
Use absolute paths in test/**/* requires for Ruby 1.9.2 compatibility. #4050...
r4395 require File.expand_path('../../test_helper', __FILE__)
Eric Davis
Refactor: move IssuesController#auto_complete to a new controller. #4382...
r3831
class AutoCompletesControllerTest < ActionController::TestCase
Toshi MARUYAMA
Rails3: replace "all" fixtures at test/functional/auto_completes_controller_test.rb...
r7368 fixtures :projects, :issues, :issue_statuses,
:enumerations, :users, :issue_categories,
:trackers,
:projects_trackers,
:roles,
:member_roles,
:members,
:enabled_modules,
:journals, :journal_details
Eric Davis
Refactor: move IssuesController#auto_complete to a new controller. #4382...
r3831
def test_issues_should_not_be_case_sensitive
get :issues, :project_id => 'ecookbook', :q => 'ReCiPe'
assert_response :success
assert_not_nil assigns(:issues)
assert assigns(:issues).detect {|issue| issue.subject.match /recipe/}
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/auto_completes_controller_test.rb....
r6703
Jean-Philippe Lang
Code cleanup....
r9997 def test_issues_should_accept_term_param
get :issues, :project_id => 'ecookbook', :term => 'ReCiPe'
assert_response :success
assert_not_nil assigns(:issues)
assert assigns(:issues).detect {|issue| issue.subject.match /recipe/}
end
Eric Davis
Refactor: move IssuesController#auto_complete to a new controller. #4382...
r3831 def test_issues_should_return_issue_with_given_id
get :issues, :project_id => 'subproject1', :q => '13'
assert_response :success
assert_not_nil assigns(:issues)
assert assigns(:issues).include?(Issue.find(13))
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/auto_completes_controller_test.rb....
r6703
Jean-Philippe Lang
Makes autocomplete accept issue id with hash....
r11062 def test_issues_should_return_issue_with_given_id_preceded_with_hash
get :issues, :project_id => 'subproject1', :q => '#13'
assert_response :success
assert_not_nil assigns(:issues)
assert assigns(:issues).include?(Issue.find(13))
end
Jean-Philippe Lang
Code cleanup....
r9997 def test_auto_complete_with_scope_all_should_search_other_projects
Jean-Philippe Lang
Autocomplete issue relations on subject (#3170)....
r4388 get :issues, :project_id => 'ecookbook', :q => '13', :scope => 'all'
assert_response :success
assert_not_nil assigns(:issues)
assert assigns(:issues).include?(Issue.find(13))
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/auto_completes_controller_test.rb....
r6703
Jean-Philippe Lang
Adds autocomplete to issue field on time logging form....
r9999 def test_auto_complete_without_project_should_search_all_projects
get :issues, :q => '13'
assert_response :success
assert_not_nil assigns(:issues)
assert assigns(:issues).include?(Issue.find(13))
end
Jean-Philippe Lang
Code cleanup....
r9997 def test_auto_complete_without_scope_all_should_not_search_other_projects
get :issues, :project_id => 'ecookbook', :q => '13'
Jean-Philippe Lang
Autocomplete issue relations on subject (#3170)....
r4388 assert_response :success
Jean-Philippe Lang
Make sure there's no nil result in auto_complete....
r4389 assert_equal [], assigns(:issues)
Jean-Philippe Lang
Autocomplete issue relations on subject (#3170)....
r4388 end
Jean-Philippe Lang
Code cleanup....
r9997
def test_issues_should_return_json
get :issues, :project_id => 'subproject1', :q => '13'
assert_response :success
json = ActiveSupport::JSON.decode(response.body)
assert_kind_of Array, json
issue = json.first
assert_kind_of Hash, issue
assert_equal 13, issue['id']
assert_equal 13, issue['value']
assert_equal 'Bug #13: Subproject issue two', issue['label']
end
Eric Davis
Refactor: move IssuesController#auto_complete to a new controller. #4382...
r3831 end