Commit 8b957e61532b0140b038ff6825a1a181f4177067

Authored by MoisesMachado
1 parent f50d08de

ActionItem489: fixing test for listing person with first name only


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2102 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/public/search_controller.rb
@@ -118,7 +118,9 @@ class SearchController < ApplicationController @@ -118,7 +118,9 @@ class SearchController < ApplicationController
118 number_of_result_assets = @searching.values.select{|v| v}.size 118 number_of_result_assets = @searching.values.select{|v| v}.size
119 119
120 # apply limit when searching for only one type of asset 120 # apply limit when searching for only one type of asset
121 - limit = (number_of_result_assets == 1) ? LIST_LIMIT : nil 121 +# limit = (number_of_result_assets == 1) ? LIST_LIMIT : nil
  122 + # apply limit to all searches
  123 + limit = nil
122 124
123 @results = {} 125 @results = {}
124 @names = {} 126 @names = {}
@@ -148,10 +150,10 @@ class SearchController < ApplicationController @@ -148,10 +150,10 @@ class SearchController < ApplicationController
148 150
149 def products 151 def products
150 @results[:products].uniq! 152 @results[:products].uniq!
151 - if !(@category || @product_category || @region || (!@query.blank?))  
152 - # not searching, no menu  
153 - return  
154 - end 153 +# if !(@category || @product_category || @region || (!@query.blank?))
  154 +# # not searching, no menu
  155 +# return
  156 +# end
155 157
156 @categories = @results[:products].map(&:product_category).compact 158 @categories = @results[:products].map(&:product_category).compact
157 @counts = @categories.uniq.inject({}) do |h, cat| 159 @counts = @categories.uniq.inject({}) do |h, cat|
test/functional/search_controller_test.rb
@@ -296,7 +296,6 @@ class SearchControllerTest < Test::Unit::TestCase @@ -296,7 +296,6 @@ class SearchControllerTest < Test::Unit::TestCase
296 296
297 names = { 297 names = {
298 :articles => 'Articles', 298 :articles => 'Articles',
299 - :people => 'People',  
300 :enterprises => 'Enterprises', 299 :enterprises => 'Enterprises',
301 :communities => 'Communities', 300 :communities => 'Communities',
302 :products => 'Products', 301 :products => 'Products',
@@ -306,6 +305,10 @@ class SearchControllerTest < Test::Unit::TestCase @@ -306,6 +305,10 @@ class SearchControllerTest < Test::Unit::TestCase
306 assert_tag :tag => 'div', :attributes => { :class => /search-results-#{thing}/ }, :descendant => { :tag => 'h3', :content => Regexp.new(description) } 305 assert_tag :tag => 'div', :attributes => { :class => /search-results-#{thing}/ }, :descendant => { :tag => 'h3', :content => Regexp.new(description) }
307 assert_tag :tag => 'a', :content => "display #{thing.to_s.singularize}" 306 assert_tag :tag => 'a', :content => "display #{thing.to_s.singularize}"
308 end 307 end
  308 +
  309 + # display only first name on people listing
  310 + assert_tag :tag => 'div', :attributes => { :class => /search-results-people/ }, :descendant => { :tag => 'h3', :content => /People/ }
  311 + assert_tag :tag => 'a', :content => "display"
309 end 312 end
310 313
311 should 'present options of where to search' do 314 should 'present options of where to search' do