diff --git a/app/views/admin/registrations/index.html.haml b/app/views/admin/registrations/index.html.haml index 4e3a843e..73003021 100644 --- a/app/views/admin/registrations/index.html.haml +++ b/app/views/admin/registrations/index.html.haml @@ -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 diff --git a/spec/views/admin/registrations/index.html.haml_spec.rb b/spec/views/admin/registrations/index.html.haml_spec.rb new file mode 100644 index 00000000..838ac607 --- /dev/null +++ b/spec/views/admin/registrations/index.html.haml_spec.rb @@ -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