Commit 12f620dbd4c7dabb595656a11098dd94dee6d91f
1 parent
951bdbf5
Exists in
master
and in
79 other branches
Fix search communities tests
Showing
2 changed files
with
6 additions
and
10 deletions
Show diff stats
lib/ext/search_controller.rb
... | ... | @@ -3,11 +3,10 @@ require_dependency 'search_controller' |
3 | 3 | class SearchController |
4 | 4 | |
5 | 5 | def communities |
6 | - @scope = visible_profiles(Community) | |
7 | - full_text_search | |
8 | - results = @searches[@asset][:results] | |
9 | - | |
10 | - results = results.each {|community| !community.institution?} | |
6 | + results = filter_communities_list do |community| | |
7 | + !community.institution? | |
8 | + end | |
9 | + results = results.paginate(:per_page => 24, :page => params[:page]) | |
11 | 10 | @searches[@asset] = {:results => results} |
12 | 11 | @search = results |
13 | 12 | end | ... | ... |
test/functional/search_controller_test.rb
... | ... | @@ -35,7 +35,7 @@ class SearchControllerTest < ActionController::TestCase |
35 | 35 | get :communities, :query => "New" |
36 | 36 | |
37 | 37 | assert_includes assigns(:searches)[:communities][:results], community |
38 | - assert_not_includes assigns(:searches)[:communities][:results], institution | |
38 | + assert_not_includes assigns(:searches)[:communities][:results], institution.community | |
39 | 39 | end |
40 | 40 | |
41 | 41 | should "institutions_search don't have community" do |
... | ... | @@ -51,10 +51,7 @@ class SearchControllerTest < ActionController::TestCase |
51 | 51 | |
52 | 52 | get :institutions, :query => "New" |
53 | 53 | |
54 | - assert_includes( | |
55 | - assigns(:searches)[:institutions][:results], | |
56 | - institution.community | |
57 | - ) | |
54 | + assert_includes assigns(:searches)[:institutions][:results], institution.community | |
58 | 55 | assert_not_includes assigns(:searches)[:institutions][:results], community |
59 | 56 | end |
60 | 57 | end | ... | ... |