Commit f6f306c510141dfe5cd03c0ffb0b7b27dbe7139e

Authored by Victor Costa
1 parent ed065de8

people_block: remove redundant distinct from with_role scope

plugins/people_block/lib/ext/person.rb
... ... @@ -3,7 +3,7 @@ require_dependency 'person'
3 3 class Person
4 4  
5 5 scope :with_role, -> role_id {
6   - select('DISTINCT profiles.*').joins(:role_assignments).
  6 + joins(:role_assignments).
7 7 where("role_assignments.role_id = #{role_id}")
8 8 }
9 9  
... ...
plugins/people_block/test/unit/members_block_test.rb
... ... @@ -240,6 +240,10 @@ class MembersBlockTest < ActionView::TestCase
240 240  
241 241 assert_includes profiles, profile1
242 242 assert_not_includes profiles, profile2
  243 +
  244 + profile_list = block.profile_list
  245 + assert_includes profile_list, profile1
  246 + assert_not_includes profile_list, profile2
243 247 end
244 248  
245 249 should 'list only profiles with member role' do
... ... @@ -261,6 +265,10 @@ class MembersBlockTest < ActionView::TestCase
261 265  
262 266 assert_not_includes profiles, profile1
263 267 assert_includes profiles, profile2
  268 +
  269 + profile_list = block.profile_list
  270 + assert_not_includes profile_list, profile1
  271 + assert_includes profile_list, profile2
264 272 end
265 273  
266 274 should 'list available roles' do
... ...