[test] Fix style; add test for user#count_registration_tickets
This commit is contained in:
parent
6e3cdc2614
commit
11a4d200f7
3 changed files with 13 additions and 4 deletions
|
|
@ -34,8 +34,6 @@ class PaymentsController < ApplicationController
|
|||
redirect_to conference_physical_tickets_path,
|
||||
notice: 'Thanks! Your ticket is booked successfully.'
|
||||
end
|
||||
|
||||
@has_registration_ticket = nil
|
||||
else
|
||||
@total_amount_to_pay = Ticket.total_price(@conference, current_user, paid: false)
|
||||
@unpaid_ticket_purchases = current_user.ticket_purchases.unpaid.by_conference(@conference)
|
||||
|
|
|
|||
|
|
@ -31,14 +31,14 @@ class TicketPurchasesController < ApplicationController
|
|||
|
||||
# User needs to pay for tickets if any of them is not free.
|
||||
if current_user.ticket_purchases.by_conference(@conference).unpaid.any?
|
||||
has_registration_ticket = count_registration_tickets_before == 0 && count_registration_tickets_after == 1
|
||||
has_registration_ticket = count_registration_tickets_before.zero? && count_registration_tickets_after == 1
|
||||
redirect_to new_conference_payment_path(has_registration_ticket: has_registration_ticket),
|
||||
notice: 'Please pay here to get tickets.'
|
||||
return
|
||||
end
|
||||
|
||||
# Redirect to registration page for a user who didn't have a registration ticket and is purchasing one
|
||||
if count_registration_tickets_before == 0 && count_registration_tickets_after == 1
|
||||
if count_registration_tickets_before.zero? && count_registration_tickets_after == 1
|
||||
redirect_to new_conference_conference_registration_path(@conference.short_title),
|
||||
notice: 'Thanks! Your ticket is booked successfully. Please register for the conference.'
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue