Fix get_roles method of User model

Previous implementation was associating resources with all
the roles regardless of user role in the resource. ie:
if user is cfp member of conf1, the method was returning:
{ organizer => conf1,
  cfp => conf1,
  Info Desk => conf1,
  Volunteers Coordinator => conf1
}
This commit is contained in:
Aditya Prakash 2016-04-17 11:32:06 +05:30
parent 3c356cbaaf
commit 7e04a267cb
4 changed files with 19 additions and 6 deletions

View file

@ -0,0 +1,10 @@
require 'spec_helper'
describe ApplicationHelper, type: :helper do
describe 'show_roles' do
it 'formats the hash passed' do
roles = { 'organizer' => ['oSC16', 'oSC15'], 'cfp' => ['oSC16'] }
expect(show_roles(roles)).to eq 'Organizer (oSC16, oSC15), Cfp (oSC16)'
end
end
end