[test] Fix style; add test for user#count_registration_tickets

This commit is contained in:
Jimmy 2021-03-09 18:25:15 -08:00
parent 6e3cdc2614
commit 11a4d200f7
3 changed files with 13 additions and 4 deletions

View file

@ -441,6 +441,17 @@ describe User do
end
end
end
describe '#count_registration_tickets' do
let(:registration_ticket) { create(:registration_ticket, price_cents: 0) }
let(:conference3) { create(:conference, short_title: 'oSC17', title: 'openSUSE Conference 2017', tickets: [registration_ticket]) }
let(:ticket_purchase) { create(user: user, conference: conference3, ticket: registration_ticket, quantity: 1) }
it 'counts the number of registration tickets of a conference held by user' do
expect(user.count_registration_tickets(conference3).eq(1))
expect(user.count_registration_tickets(conference2).eq(0))
end
end
end
describe 'rolify' do