Commit 11a5fc50008cdd28a77710d45144990669095f97

Authored by Leandro Santos
1 parent d7b67378

compare arrays correctly

lib/noosfero/api/v1/communities.rb
... ... @@ -49,7 +49,7 @@ module Noosfero
49 49 end
50 50  
51 51 get ':id' do
52   - community = environment.communities.visible..find_by(id: params[:id])
  52 + community = environment.communities.visible.find_by(id: params[:id])
53 53 present community, :with => Entities::Community, :current_person => current_person
54 54 end
55 55  
... ...
test/api/communities_test.rb
... ... @@ -42,7 +42,7 @@ class CommunitiesTest < ActiveSupport::TestCase
42 42  
43 43 get "/api/v1/communities?#{params.to_query}"
44 44 json = JSON.parse(last_response.body)
45   - assert_equal [community1.id, community2.id], json['communities'].map {|c| c['id']}
  45 + assert_equivalent [community1.id, community2.id], json['communities'].map {|c| c['id']}
46 46 end
47 47  
48 48 should 'logged user list private community for members' do
... ... @@ -207,7 +207,7 @@ class CommunitiesTest < ActiveSupport::TestCase
207 207  
208 208 get "/api/v1/communities?#{params.to_query}"
209 209 json = JSON.parse(last_response.body)
210   - assert_equal [community1.id, community2.id], json['communities'].map {|c| c['id']}
  210 + assert_equivalent [community1.id, community2.id], json['communities'].map {|c| c['id']}
211 211 end
212 212  
213 213 should 'not, anonymous create a community' do
... ...