Commit 83206c1bc214830e5cb35e9d3caf8defb5c3f7b5
1 parent
5b5d62d8
Exists in
master
and in
23 other branches
A few assertions on SearchControllerTest to check facets
Showing
1 changed file
with
6 additions
and
0 deletions
Show diff stats
test/functional/search_controller_test.rb
| @@ -72,6 +72,7 @@ class SearchControllerTest < ActionController::TestCase | @@ -72,6 +72,7 @@ class SearchControllerTest < ActionController::TestCase | ||
| 72 | 72 | ||
| 73 | get 'articles', :query => 'article found' | 73 | get 'articles', :query => 'article found' |
| 74 | assert_includes assigns(:results)[:articles], art | 74 | assert_includes assigns(:results)[:articles], art |
| 75 | + assert !assigns(:results)[:articles].facets.nil? | ||
| 75 | end | 76 | end |
| 76 | 77 | ||
| 77 | should 'redirect contents to articles' do | 78 | should 'redirect contents to articles' do |
| @@ -100,6 +101,7 @@ class SearchControllerTest < ActionController::TestCase | @@ -100,6 +101,7 @@ class SearchControllerTest < ActionController::TestCase | ||
| 100 | ent = create_profile_with_optional_category(Enterprise, 'teste') | 101 | ent = create_profile_with_optional_category(Enterprise, 'teste') |
| 101 | get :enterprises, :query => 'teste' | 102 | get :enterprises, :query => 'teste' |
| 102 | assert_includes assigns(:results)[:enterprises], ent | 103 | assert_includes assigns(:results)[:enterprises], ent |
| 104 | + assert !assigns(:results)[:enterprises].facets.nil? | ||
| 103 | end | 105 | end |
| 104 | 106 | ||
| 105 | should 'list enterprises in general' do | 107 | should 'list enterprises in general' do |
| @@ -115,6 +117,7 @@ class SearchControllerTest < ActionController::TestCase | @@ -115,6 +117,7 @@ class SearchControllerTest < ActionController::TestCase | ||
| 115 | p1 = create_user('people_1').person; p1.name = 'a beautiful person'; p1.save! | 117 | p1 = create_user('people_1').person; p1.name = 'a beautiful person'; p1.save! |
| 116 | get :people, :query => 'beautiful' | 118 | get :people, :query => 'beautiful' |
| 117 | assert_includes assigns(:results)[:people], p1 | 119 | assert_includes assigns(:results)[:people], p1 |
| 120 | + assert !assigns(:results)[:people].facets.nil? | ||
| 118 | end | 121 | end |
| 119 | 122 | ||
| 120 | # 'assets' menu outside any category | 123 | # 'assets' menu outside any category |
| @@ -133,6 +136,7 @@ class SearchControllerTest < ActionController::TestCase | @@ -133,6 +136,7 @@ class SearchControllerTest < ActionController::TestCase | ||
| 133 | c1 = create_profile_with_optional_category(Community, 'a beautiful community') | 136 | c1 = create_profile_with_optional_category(Community, 'a beautiful community') |
| 134 | get :communities, :query => 'beautiful' | 137 | get :communities, :query => 'beautiful' |
| 135 | assert_includes assigns(:results)[:communities], c1 | 138 | assert_includes assigns(:results)[:communities], c1 |
| 139 | + assert !assigns(:results)[:communities].facets.nil? | ||
| 136 | end | 140 | end |
| 137 | 141 | ||
| 138 | # 'assets' menu outside any category | 142 | # 'assets' menu outside any category |
| @@ -149,6 +153,7 @@ class SearchControllerTest < ActionController::TestCase | @@ -149,6 +153,7 @@ class SearchControllerTest < ActionController::TestCase | ||
| 149 | prod = ent.products.create!(:name => 'a beautiful product', :product_category => @product_category) | 153 | prod = ent.products.create!(:name => 'a beautiful product', :product_category => @product_category) |
| 150 | get :products, :query => 'beautiful' | 154 | get :products, :query => 'beautiful' |
| 151 | assert_includes assigns(:results)[:products], prod | 155 | assert_includes assigns(:results)[:products], prod |
| 156 | + assert !assigns(:results)[:products].facets.nil? | ||
| 152 | end | 157 | end |
| 153 | 158 | ||
| 154 | # 'assets' menu outside any category | 159 | # 'assets' menu outside any category |
| @@ -332,6 +337,7 @@ class SearchControllerTest < ActionController::TestCase | @@ -332,6 +337,7 @@ class SearchControllerTest < ActionController::TestCase | ||
| 332 | get :events, :query => 'event found' | 337 | get :events, :query => 'event found' |
| 333 | 338 | ||
| 334 | assert_includes assigns(:results)[:events], ev | 339 | assert_includes assigns(:results)[:events], ev |
| 340 | + assert !assigns(:results)[:events].facets.nil? | ||
| 335 | end | 341 | end |
| 336 | 342 | ||
| 337 | should 'list events for a given month' do | 343 | should 'list events for a given month' do |