From aa1b281f9a5cd35624ede7030cade9f60409f81d Mon Sep 17 00:00:00 2001 From: Jimmy Date: Wed, 10 Mar 2021 11:00:14 -0800 Subject: [PATCH] [test] Fix test for user#count_registration_tickets --- spec/models/user_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 7353ecf5..98c791b6 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -445,9 +445,11 @@ describe User do 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) } + let(:ticket_purchase) { create(:ticket_purchase, user: user, conference: conference3, ticket: registration_ticket, quantity: 1) } it 'counts the number of registration tickets of a conference held by user' do + user.ticket_purchases << ticket_purchase + expect(user.count_registration_tickets(conference3)).to eq(1) expect(user.count_registration_tickets(conference2)).to eq(0) end