pass paid value as hash, improve code reviews
This commit is contained in:
parent
8b03f1be74
commit
893f517ab0
7 changed files with 32 additions and 34 deletions
|
|
@ -49,7 +49,7 @@ describe Payment do
|
|||
|
||||
end
|
||||
|
||||
describe 'self#purchase' do
|
||||
describe 'purchase' do
|
||||
let!(:participant) { create(:user) }
|
||||
let!(:ticket_1) { create(:ticket) }
|
||||
let!(:conference) { create(:conference, tickets: [ticket_1]) }
|
||||
|
|
|
|||
|
|
@ -108,11 +108,11 @@ describe Ticket do
|
|||
user: user,
|
||||
ticket: ticket,
|
||||
quantity: 20)
|
||||
expect(ticket.quantity_bought_by(user, false)).to eq(20)
|
||||
expect(ticket.quantity_bought_by(user, :paid => false)).to eq(20)
|
||||
end
|
||||
|
||||
it 'returns zero if the user has not bought this ticket' do
|
||||
expect(ticket.quantity_bought_by(user, false)).to eq(0)
|
||||
expect(ticket.quantity_bought_by(user, :paid => false)).to eq(0)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -122,11 +122,11 @@ describe Ticket do
|
|||
user: user,
|
||||
ticket: ticket,
|
||||
quantity: 20)
|
||||
expect(ticket.total_price(user, false)).to eq(Money.new(100000, 'USD'))
|
||||
expect(ticket.total_price(user, :paid => false)).to eq(Money.new(100000, 'USD'))
|
||||
end
|
||||
|
||||
it 'returns zero if the user has not bought this ticket' do
|
||||
expect(ticket.total_price(user, false)).to eq(Money.new(0, 'USD'))
|
||||
expect(ticket.total_price(user, :paid => false)).to eq(Money.new(0, 'USD'))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ describe Ticket do
|
|||
describe 'user has bought' do
|
||||
context 'no tickets' do
|
||||
it 'returns zero' do
|
||||
expect(Ticket.total_price(conference, user, false)).to eq(Money.new(0, 'USD'))
|
||||
expect(Ticket.total_price(conference, user, :paid => false)).to eq(Money.new(0, 'USD'))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ describe Ticket do
|
|||
end
|
||||
|
||||
it 'returns the correct total price' do
|
||||
expect(Ticket.total_price(conference, user, false)).to eq(Money.new(100000, 'USD'))
|
||||
expect(Ticket.total_price(conference, user, :paid => false)).to eq(Money.new(100000, 'USD'))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ describe Ticket do
|
|||
|
||||
it 'returns the correct total price' do
|
||||
total_price = Money.new(200000, 'USD')
|
||||
expect(Ticket.total_price(conference, user, false)).to eq(total_price)
|
||||
expect(Ticket.total_price(conference, user, :paid => false)).to eq(total_price)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue