Commit 39945e5f34e6d3725dd11941ff0ab288ce20c785
Committed by
Gabriela Navarro
1 parent
c6a5f4ad
Exists in
master
and in
79 other branches
Add tests for search by acronym
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com> Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
Showing
2 changed files
with
21 additions
and
1 deletions
Show diff stats
test/functional/search_controller_test.rb
... | ... | @@ -196,6 +196,25 @@ class SearchControllerTest < ActionController::TestCase |
196 | 196 | assert_not_includes assigns(:searches)[:software_infos][:results], software_two.community |
197 | 197 | end |
198 | 198 | |
199 | + should "software_infos search by acronym" do | |
200 | + software_one = create_software_info("Software One", :acronym => "SFO", :finality => "Help") | |
201 | + software_two = create_software_info("Software Two", :acronym => "SFT", :finality => "Task") | |
202 | + | |
203 | + software_one.license_info = LicenseInfo.create :version=>"GPL - 1.0" | |
204 | + software_two.license_info = LicenseInfo.create :version=>"GPL - 1.0" | |
205 | + | |
206 | + software_one.save! | |
207 | + software_two.save! | |
208 | + | |
209 | + get( | |
210 | + :software_infos, | |
211 | + :query => "SFO", | |
212 | + ) | |
213 | + | |
214 | + assert_includes assigns(:searches)[:software_infos][:results], software_one.community | |
215 | + assert_not_includes assigns(:searches)[:software_infos][:results], software_two.community | |
216 | + end | |
217 | + | |
199 | 218 | private |
200 | 219 | |
201 | 220 | def create_software_categories | ... | ... |
test/helpers/plugin_test_helper.rb
... | ... | @@ -13,11 +13,12 @@ module PluginTestHelper |
13 | 13 | community |
14 | 14 | end |
15 | 15 | |
16 | - def create_software_info name, finality = "" | |
16 | + def create_software_info name, finality = "", acronym = "" | |
17 | 17 | community = create_community(name) |
18 | 18 | software_info = SoftwareInfo.new |
19 | 19 | software_info.community = community |
20 | 20 | software_info.finality = finality |
21 | + software_info.acronym = acronym | |
21 | 22 | software_info.public_software = true |
22 | 23 | software_info.save |
23 | 24 | software_info | ... | ... |