mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Fix tickets turnover calculation
This commit is contained in:
parent
69de418ccd
commit
58cb62dd6d
3 changed files with 20 additions and 6 deletions
|
|
@ -65,6 +65,17 @@ describe Ticket do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#tickets_turnover_total' do
|
||||
let!(:purchase1) { create :ticket_purchase, ticket: ticket, amount_paid: 5_000, quantity: 1, paid: true, user: user }
|
||||
let!(:purchase2) { create :ticket_purchase, ticket: ticket, amount_paid: 5_000, quantity: 2, paid: true, user: user }
|
||||
let!(:purchase3) { create :ticket_purchase, ticket: ticket, amount_paid: 5_000, quantity: 10, paid: false, user: user }
|
||||
subject { ticket.tickets_turnover_total ticket.id }
|
||||
|
||||
it 'returns turnover as Money with ticket\'s currency' do
|
||||
is_expected.to eq Money.new(5_000 * 3, ticket.price_currency)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#unpaid?' do
|
||||
let!(:ticket_purchase) { create(:ticket_purchase, user: user, ticket: ticket) }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue