Commit d17e27672f833433ac90c24ac295ee16d64c37ee

Authored by Antonio Terceiro
1 parent 6c88dddf

Fixing tests in SearchController

Showing 1 changed file with 7 additions and 7 deletions   Show diff stats
test/functional/search_controller_test.rb
@@ -423,7 +423,7 @@ class SearchControllerTest < ActionController::TestCase @@ -423,7 +423,7 @@ class SearchControllerTest < ActionController::TestCase
423 get :index, :category_path => [ 'randomcat', 'randomchild' ], :query => 'some random query', :search_whole_site => 'yes' 423 get :index, :category_path => [ 'randomcat', 'randomchild' ], :query => 'some random query', :search_whole_site => 'yes'
424 424
425 # search_whole_site must be removed to precent a infinite redirect loop 425 # search_whole_site must be removed to precent a infinite redirect loop
426 - assert_redirected_to :action => 'index', :category_path => [], :query => 'some random query', :search_whole_site => nil 426 + assert_redirected_to :controller.to_s => 'search', :action.to_s => 'index', :category_path.to_s => [], :query.to_s => 'some random query', :search_whole_site.to_s => nil, :search_whole_site_yes.to_s => nil
427 end 427 end
428 428
429 should 'submit form to root when not inside a filter' do 429 should 'submit form to root when not inside a filter' do
@@ -456,7 +456,7 @@ class SearchControllerTest < ActionController::TestCase @@ -456,7 +456,7 @@ class SearchControllerTest < ActionController::TestCase
456 finder = CategoryFinder.new(@category) 456 finder = CategoryFinder.new(@category)
457 finder.expects(:recent).with(any_parameters).at_least_once 457 finder.expects(:recent).with(any_parameters).at_least_once
458 finder.expects(:recent).with('text_articles', anything).returns(recent) 458 finder.expects(:recent).with('text_articles', anything).returns(recent)
459 - CategoryFinder.expects(:new).with(@category).returns(finder) 459 + CategoryFinder.stubs(:new).with(@category).returns(finder)
460 460
461 get :category_index, :category_path => [ 'my-category' ] 461 get :category_index, :category_path => [ 'my-category' ]
462 assert_same recent, assigns(:results)[:articles] 462 assert_same recent, assigns(:results)[:articles]
@@ -466,7 +466,7 @@ class SearchControllerTest < ActionController::TestCase @@ -466,7 +466,7 @@ class SearchControllerTest < ActionController::TestCase
466 most_commented = [] 466 most_commented = []
467 finder = CategoryFinder.new(@category) 467 finder = CategoryFinder.new(@category)
468 finder.expects(:most_commented_articles).returns(most_commented) 468 finder.expects(:most_commented_articles).returns(most_commented)
469 - CategoryFinder.expects(:new).with(@category).returns(finder) 469 + CategoryFinder.stubs(:new).with(@category).returns(finder)
470 470
471 get :category_index, :category_path => [ 'my-category' ] 471 get :category_index, :category_path => [ 'my-category' ]
472 assert_same most_commented, assigns(:results)[:most_commented_articles] 472 assert_same most_commented, assigns(:results)[:most_commented_articles]
@@ -477,7 +477,7 @@ class SearchControllerTest < ActionController::TestCase @@ -477,7 +477,7 @@ class SearchControllerTest < ActionController::TestCase
477 finder = CategoryFinder.new(@category) 477 finder = CategoryFinder.new(@category)
478 finder.expects(:recent).with(any_parameters).at_least_once 478 finder.expects(:recent).with(any_parameters).at_least_once
479 finder.expects(:recent).with('people', kind_of(Integer)).returns(recent_people) 479 finder.expects(:recent).with('people', kind_of(Integer)).returns(recent_people)
480 - CategoryFinder.expects(:new).with(@category).returns(finder) 480 + CategoryFinder.stubs(:new).with(@category).returns(finder)
481 481
482 get :category_index, :category_path => [ 'my-category' ] 482 get :category_index, :category_path => [ 'my-category' ]
483 assert_same recent_people, assigns(:results)[:people] 483 assert_same recent_people, assigns(:results)[:people]
@@ -488,7 +488,7 @@ class SearchControllerTest < ActionController::TestCase @@ -488,7 +488,7 @@ class SearchControllerTest < ActionController::TestCase
488 finder = CategoryFinder.new(@category) 488 finder = CategoryFinder.new(@category)
489 finder.expects(:recent).with(any_parameters).at_least_once 489 finder.expects(:recent).with(any_parameters).at_least_once
490 finder.expects(:recent).with('communities', anything).returns(recent_communities) 490 finder.expects(:recent).with('communities', anything).returns(recent_communities)
491 - CategoryFinder.expects(:new).with(@category).returns(finder) 491 + CategoryFinder.stubs(:new).with(@category).returns(finder)
492 492
493 get :category_index, :category_path => [ 'my-category' ] 493 get :category_index, :category_path => [ 'my-category' ]
494 assert_same recent_communities, assigns(:results)[:communities] 494 assert_same recent_communities, assigns(:results)[:communities]
@@ -499,7 +499,7 @@ class SearchControllerTest < ActionController::TestCase @@ -499,7 +499,7 @@ class SearchControllerTest < ActionController::TestCase
499 finder = CategoryFinder.new(@category) 499 finder = CategoryFinder.new(@category)
500 finder.expects(:recent).with(any_parameters).at_least_once 500 finder.expects(:recent).with(any_parameters).at_least_once
501 finder.expects(:recent).with('enterprises', anything).returns(recent_enterptises) 501 finder.expects(:recent).with('enterprises', anything).returns(recent_enterptises)
502 - CategoryFinder.expects(:new).with(@category).returns(finder) 502 + CategoryFinder.stubs(:new).with(@category).returns(finder)
503 503
504 get :category_index, :category_path => [ 'my-category' ] 504 get :category_index, :category_path => [ 'my-category' ]
505 assert_same recent_enterptises, assigns(:results)[:enterprises] 505 assert_same recent_enterptises, assigns(:results)[:enterprises]
@@ -987,7 +987,7 @@ class SearchControllerTest < ActionController::TestCase @@ -987,7 +987,7 @@ class SearchControllerTest < ActionController::TestCase
987 most_commented = [art] 987 most_commented = [art]
988 finder = CategoryFinder.new(@category) 988 finder = CategoryFinder.new(@category)
989 finder.expects(:most_commented_articles).returns(most_commented) 989 finder.expects(:most_commented_articles).returns(most_commented)
990 - CategoryFinder.expects(:new).with(@category).returns(finder) 990 + CategoryFinder.stubs(:new).with(@category).returns(finder)
991 991
992 get :category_index, :category_path => [ 'my-category' ] 992 get :category_index, :category_path => [ 'my-category' ]
993 assert_tag :tag => 'div', :attributes => {:class => /search-results-most_commented_articles/} , :descendant => {:tag => 'a', :attributes => { :href => '/search/index/my-category?asset=articles'}} 993 assert_tag :tag => 'div', :attributes => {:class => /search-results-most_commented_articles/} , :descendant => {:tag => 'a', :attributes => { :href => '/search/index/my-category?asset=articles'}}