Commit 0d6b796f27a9946dc37a3d477b0c19ff8156e83c
1 parent
f34a30e2
Exists in
sisp_simple_version
Add test for search sisp software by category
Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>
Showing
1 changed file
with
22 additions
and
0 deletions
Show diff stats
src/noosfero-spb/software_communities/test/functional/search_controller_test.rb
| @@ -297,6 +297,28 @@ class SearchControllerTest < ActionController::TestCase | @@ -297,6 +297,28 @@ class SearchControllerTest < ActionController::TestCase | ||
| 297 | assert_not_includes assigns(:searches)[:sisp][:results], software_one.community | 297 | assert_not_includes assigns(:searches)[:sisp][:results], software_one.community |
| 298 | end | 298 | end |
| 299 | 299 | ||
| 300 | + should "sisp search by category" do | ||
| 301 | + software_one = create_software_info("Software ABC", :acronym => "SFO", :finality => "Help") | ||
| 302 | + software_two = create_software_info("Python", :acronym => "SFT", :finality => "Task") | ||
| 303 | + software_three = create_software_info("Software DEF", :acronym => "SFW", :finality => "Java") | ||
| 304 | + | ||
| 305 | + software_two.sisp = true | ||
| 306 | + software_two.community.categories << Category.last | ||
| 307 | + software_two.save! | ||
| 308 | + | ||
| 309 | + software_three.sisp = true | ||
| 310 | + software_three.save! | ||
| 311 | + | ||
| 312 | + get( | ||
| 313 | + :sisp, | ||
| 314 | + :selected_categories_id => [Category.last.id] | ||
| 315 | + ) | ||
| 316 | + | ||
| 317 | + assert_includes assigns(:searches)[:sisp][:results], software_two.community | ||
| 318 | + assert_not_includes assigns(:searches)[:sisp][:results], software_three.community | ||
| 319 | + assert_not_includes assigns(:searches)[:sisp][:results], software_one.community | ||
| 320 | + end | ||
| 321 | + | ||
| 300 | private | 322 | private |
| 301 | 323 | ||
| 302 | def create_software_categories | 324 | def create_software_categories |