Commit e842924bac0d9601be4499da74f4a7c8b30d6bda
1 parent
bac0d142
Exists in
refactor_software_info_to_software
and in
1 other branch
Fix namespaces for unit test
Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com> Signed-off-by: Pedro de Lyra Pereira <pedrodelyra@gmail.com>
Showing
5 changed files
with
8 additions
and
13 deletions
Show diff stats
src/noosfero-spb/software_communities/lib/software_communities_plugin/api.rb
... | ... | @@ -15,7 +15,7 @@ class SoftwareCommunitiesPlugin::API < 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 < 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 < 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 < 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 < 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) | ... | ... |