remove trailing white-spaces from functional search controller test.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5803 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
dfa509b69e
commit
5e1576b8b4
|
@ -9,14 +9,14 @@ class SearchControllerTest < ActionController::TestCase
|
||||||
:issues, :trackers, :issue_statuses,
|
:issues, :trackers, :issue_statuses,
|
||||||
:custom_fields, :custom_values,
|
:custom_fields, :custom_values,
|
||||||
:repositories, :changesets
|
:repositories, :changesets
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@controller = SearchController.new
|
@controller = SearchController.new
|
||||||
@request = ActionController::TestRequest.new
|
@request = ActionController::TestRequest.new
|
||||||
@response = ActionController::TestResponse.new
|
@response = ActionController::TestResponse.new
|
||||||
User.current = nil
|
User.current = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_search_for_projects
|
def test_search_for_projects
|
||||||
get :index
|
get :index
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
@ -27,35 +27,35 @@ class SearchControllerTest < ActionController::TestCase
|
||||||
assert_template 'index'
|
assert_template 'index'
|
||||||
assert assigns(:results).include?(Project.find(1))
|
assert assigns(:results).include?(Project.find(1))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_search_all_projects
|
def test_search_all_projects
|
||||||
get :index, :q => 'recipe subproject commit', :submit => 'Search'
|
get :index, :q => 'recipe subproject commit', :submit => 'Search'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'index'
|
assert_template 'index'
|
||||||
|
|
||||||
assert assigns(:results).include?(Issue.find(2))
|
assert assigns(:results).include?(Issue.find(2))
|
||||||
assert assigns(:results).include?(Issue.find(5))
|
assert assigns(:results).include?(Issue.find(5))
|
||||||
assert assigns(:results).include?(Changeset.find(101))
|
assert assigns(:results).include?(Changeset.find(101))
|
||||||
assert_tag :dt, :attributes => { :class => /issue/ },
|
assert_tag :dt, :attributes => { :class => /issue/ },
|
||||||
:child => { :tag => 'a', :content => /Add ingredients categories/ },
|
:child => { :tag => 'a', :content => /Add ingredients categories/ },
|
||||||
:sibling => { :tag => 'dd', :content => /should be classified by categories/ }
|
:sibling => { :tag => 'dd', :content => /should be classified by categories/ }
|
||||||
|
|
||||||
assert assigns(:results_by_type).is_a?(Hash)
|
assert assigns(:results_by_type).is_a?(Hash)
|
||||||
assert_equal 5, assigns(:results_by_type)['changesets']
|
assert_equal 5, assigns(:results_by_type)['changesets']
|
||||||
assert_tag :a, :content => 'Changesets (5)'
|
assert_tag :a, :content => 'Changesets (5)'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_search_issues
|
def test_search_issues
|
||||||
get :index, :q => 'issue', :issues => 1
|
get :index, :q => 'issue', :issues => 1
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'index'
|
assert_template 'index'
|
||||||
|
|
||||||
assert assigns(:results).include?(Issue.find(8))
|
assert assigns(:results).include?(Issue.find(8))
|
||||||
assert assigns(:results).include?(Issue.find(5))
|
assert assigns(:results).include?(Issue.find(5))
|
||||||
assert_tag :dt, :attributes => { :class => /issue closed/ },
|
assert_tag :dt, :attributes => { :class => /issue closed/ },
|
||||||
:child => { :tag => 'a', :content => /Closed/ }
|
:child => { :tag => 'a', :content => /Closed/ }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_search_project_and_subprojects
|
def test_search_project_and_subprojects
|
||||||
get :index, :id => 1, :q => 'recipe subproject', :scope => 'subprojects', :submit => 'Search'
|
get :index, :id => 1, :q => 'recipe subproject', :scope => 'subprojects', :submit => 'Search'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
@ -66,17 +66,17 @@ class SearchControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
def test_search_without_searchable_custom_fields
|
def test_search_without_searchable_custom_fields
|
||||||
CustomField.update_all "searchable = #{ActiveRecord::Base.connection.quoted_false}"
|
CustomField.update_all "searchable = #{ActiveRecord::Base.connection.quoted_false}"
|
||||||
|
|
||||||
get :index, :id => 1
|
get :index, :id => 1
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'index'
|
assert_template 'index'
|
||||||
assert_not_nil assigns(:project)
|
assert_not_nil assigns(:project)
|
||||||
|
|
||||||
get :index, :id => 1, :q => "can"
|
get :index, :id => 1, :q => "can"
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'index'
|
assert_template 'index'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_search_with_searchable_custom_fields
|
def test_search_with_searchable_custom_fields
|
||||||
get :index, :id => 1, :q => "stringforcustomfield"
|
get :index, :id => 1, :q => "stringforcustomfield"
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
@ -85,7 +85,7 @@ class SearchControllerTest < ActionController::TestCase
|
||||||
assert_equal 1, results.size
|
assert_equal 1, results.size
|
||||||
assert results.include?(Issue.find(7))
|
assert results.include?(Issue.find(7))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_search_all_words
|
def test_search_all_words
|
||||||
# 'all words' is on by default
|
# 'all words' is on by default
|
||||||
get :index, :id => 1, :q => 'recipe updating saving'
|
get :index, :id => 1, :q => 'recipe updating saving'
|
||||||
|
@ -94,7 +94,7 @@ class SearchControllerTest < ActionController::TestCase
|
||||||
assert_equal 1, results.size
|
assert_equal 1, results.size
|
||||||
assert results.include?(Issue.find(3))
|
assert results.include?(Issue.find(3))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_search_one_of_the_words
|
def test_search_one_of_the_words
|
||||||
get :index, :id => 1, :q => 'recipe updating saving', :submit => 'Search'
|
get :index, :id => 1, :q => 'recipe updating saving', :submit => 'Search'
|
||||||
results = assigns(:results)
|
results = assigns(:results)
|
||||||
|
@ -116,7 +116,7 @@ class SearchControllerTest < ActionController::TestCase
|
||||||
assert_not_nil results
|
assert_not_nil results
|
||||||
assert_equal 2, results.size
|
assert_equal 2, results.size
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_search_with_invalid_project_id
|
def test_search_with_invalid_project_id
|
||||||
get :index, :id => 195, :q => 'recipe'
|
get :index, :id => 195, :q => 'recipe'
|
||||||
assert_response 404
|
assert_response 404
|
||||||
|
@ -127,7 +127,7 @@ class SearchControllerTest < ActionController::TestCase
|
||||||
# issue of a public project
|
# issue of a public project
|
||||||
get :index, :q => "3"
|
get :index, :q => "3"
|
||||||
assert_redirected_to '/issues/3'
|
assert_redirected_to '/issues/3'
|
||||||
|
|
||||||
# issue of a private project
|
# issue of a private project
|
||||||
get :index, :q => "4"
|
get :index, :q => "4"
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
@ -139,7 +139,7 @@ class SearchControllerTest < ActionController::TestCase
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'index'
|
assert_template 'index'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_tokens_with_quotes
|
def test_tokens_with_quotes
|
||||||
get :index, :id => 1, :q => '"good bye" hello "bye bye"'
|
get :index, :id => 1, :q => '"good bye" hello "bye bye"'
|
||||||
assert_equal ["good bye", "hello", "bye bye"], assigns(:tokens)
|
assert_equal ["good bye", "hello", "bye bye"], assigns(:tokens)
|
||||||
|
|
Loading…
Reference in New Issue