Commit e842924bac0d9601be4499da74f4a7c8b30d6bda

Authored by Luciano Prestes
1 parent bac0d142

Fix namespaces for unit test

Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>
Signed-off-by: Pedro de Lyra Pereira <pedrodelyra@gmail.com>
src/noosfero-spb/software_communities/lib/software_communities_plugin/api.rb
... ... @@ -15,7 +15,7 @@ class SoftwareCommunitiesPlugin::API &lt; Grape::API
15 15  
16 16 get ':id' do
17 17 authenticate!
18   - software = SoftwareInfo.find_by_id(params[:id])
  18 + software = SoftwareCommunitiesPlugin::SoftwareInfo.find_by_id(params[:id])
19 19 present software, :with => Entities::SoftwareInfo
20 20 end
21 21  
... ...
src/noosfero-spb/software_communities/lib/software_communities_plugin/software_info.rb
... ... @@ -18,7 +18,7 @@ class SoftwareCommunitiesPlugin::SoftwareInfo &lt; ActiveRecord::Base
18 18 search_fields = SoftwareCommunitiesPlugin::SoftwareInfo.pg_search_plugin_fields
19 19  
20 20 if query.empty?
21   - SoftwareInfo.joins(:community).where("profiles.visible = ? AND environment_id = ? ", true, env.id)
  21 + SoftwareCommunitiesPlugin::SoftwareInfo.joins(:community).where("profiles.visible = ? AND environment_id = ? ", true, env.id)
22 22 else
23 23 searchable_software_objects = SoftwareCommunitiesPlugin::SoftwareInfo.transform_list_in_methods_list(SEARCHABLE_SOFTWARE_CLASSES)
24 24 includes(searchable_software_objects).where("to_tsvector('simple', #{search_fields}) @@ to_tsquery('#{filtered_query}')").where("profiles.visible = ?", true)
... ...
src/noosfero-spb/software_communities/test/unit/api_test.rb
... ... @@ -25,6 +25,7 @@ class SoftwareCommunitiesApiTest &lt; ActiveSupport::TestCase
25 25 get "/api/v1/software_communities/#{@software_info.id}?#{params.to_query}"
26 26  
27 27 json = JSON.parse(last_response.body)
  28 +
28 29 assert_equal @software_info.id, json["software_info"]["id"]
29 30 end
30 31  
... ...
src/noosfero-spb/software_communities/test/unit/software_info_test.rb
... ... @@ -37,11 +37,11 @@ class SoftwareInfoValidationTest &lt; ActiveSupport::TestCase
37 37 another_soft_profile.environment_id = other_env.id
38 38 another_soft_profile.save
39 39  
40   - assert_equal 2, SoftwareInfo.count
41   - assert_equal 1, SoftwareInfo.search_by_query("", Environment.default).count
42   - assert_equal software_info, SoftwareInfo.search_by_query("", Environment.default).first
43   - assert_equal 1, SoftwareInfo.search_by_query("", other_env).count
44   - assert_equal true, SoftwareInfo.search_by_query("", other_env).all.include?(another_software_info)
  40 + assert_equal 2, SoftwareCommunitiesPlugin::SoftwareInfo.count
  41 + assert_equal 1, SoftwareCommunitiesPlugin::SoftwareInfo.search_by_query("", Environment.default).count
  42 + assert_equal software_info, SoftwareCommunitiesPlugin::SoftwareInfo.search_by_query("", Environment.default).first
  43 + assert_equal 1, SoftwareCommunitiesPlugin::SoftwareInfo.search_by_query("", other_env).count
  44 + assert_equal true, SoftwareCommunitiesPlugin::SoftwareInfo.search_by_query("", other_env).all.include?(another_software_info)
45 45 end
46 46  
47 47 should "start another license with default values" do
... ...
src/noosfero-spb/software_communities/test/unit/software_registration_test.rb
... ... @@ -9,12 +9,6 @@ class SoftwareRegistrationTest &lt; ActiveSupport::TestCase
9 9 @license_info = SoftwareCommunitiesPlugin::LicenseInfo.create(:version => "New License", :link => "#")
10 10 end
11 11  
12   - def teardown
13   - Community.destroy_all
14   - SoftwareCommunitiesPlugin::SoftwareInfo.destroy_all
15   - Task.destroy_all
16   - end
17   -
18 12 should 'include software registration task if is admin' do
19 13 person = create_user('molly').person
20 14 @environment.add_admin(person)
... ...