diff --git a/app/controllers/public/search_controller.rb b/app/controllers/public/search_controller.rb index 6b54606..7b25a38 100644 --- a/app/controllers/public/search_controller.rb +++ b/app/controllers/public/search_controller.rb @@ -83,7 +83,8 @@ class SearchController < ApplicationController [ :recent_communities, _('Recently created communities'), @finder.recent('communities') ], [ :recent_articles, _('Recent articles'), @finder.recent('articles') ], [ :comments, _('Recent comments'), @finder.recent('comments') ], - [ :most_commented_articles, _('Most commented articles'), @finder.most_commented_articles ] + [ :most_commented_articles, _('Most commented articles'), @finder.most_commented_articles ], + [ :recent_enterptises, _('Recently created enterprises'), @finder.recent('enterprises') ] ].each do |key, name, list| @results[key] = list @names[key] = name diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index d168eeb..7dc9625 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -422,7 +422,7 @@ class SearchControllerTest < Test::Unit::TestCase assert_tag :tag => 'form' , :attributes => { :method => 'get' } end - def test_should_display_a_given_category + should 'display a given category' do get :category_index, :category_path => [ 'my-category' ] assert_equal @category, assigns(:category) end @@ -486,6 +486,17 @@ class SearchControllerTest < Test::Unit::TestCase assert_same recent_communities, assigns(:results)[:recent_communities] end + should 'list recently registered enterprises in the category' do + recent_enterptises = [] + finger = CategoryFinder.new(@category) + finger.expects(:recent).with(anything).at_least_once + finger.expects(:recent).with('enterprises').returns(recent_enterptises) + CategoryFinder.expects(:new).with(@category).returns(finger) + + get :category_index, :category_path => [ 'my-category' ] + assert_same recent_enterptises, assigns(:results)[:recent_enterptises] + end + should 'not list "Search for ..." in category_index' do get :category_index, :category_path => [ 'my-category' ] assert_no_tag :content => /Search for ".*" in the whole site/ -- libgit2 0.21.2