Display roles in registration list

This commit is contained in:
Justin Harrison 2016-03-26 13:01:16 -04:00
parent 10ef898a0d
commit 7c38622e8f
2 changed files with 25 additions and 0 deletions

View file

@ -28,6 +28,10 @@
= registration.id
%td
= registration.name
- @conference.roles.each do |role|
- role.users.each do |user|
- if user == registration.user
%span.label.label-info= role.name.titleize
%td
= registration.email
%td

View file

@ -0,0 +1,21 @@
require 'spec_helper'
describe 'admin/registrations/index' do
let(:conference) { create(:conference, roles: [role1, role2]) }
let(:user) { create(:user) }
let(:role1) { create(:organizer_role, users: [user]) }
let(:role2) { create(:cfp_role, users: [user]) }
before :each do
assign :conference, conference
assign :registrations, [create(:registration, user: user, conference: conference)]
render
end
it 'renders index' do
expect(rendered).to have_selector('table tbody td', text: user.name)
expect(rendered).to have_selector('table tbody td span:nth-of-type(1)', text: role1.name.titleize)
expect(rendered).to have_selector('table tbody td span:nth-of-type(2)', text: role2.name.titleize)
end
end