modify tests for changed payment flow

This commit is contained in:
Rishabh Saxena 2016-07-27 19:44:32 +05:30
parent ab262ecb46
commit a5bb038f61
3 changed files with 66 additions and 40 deletions

View file

@ -26,26 +26,12 @@ feature Registration do
fill_in "tickets__#{ticket.id}", with: '2'
expect(current_path).to eq(conference_tickets_path(conference.short_title))
click_button 'Support'
click_button 'Continue'
expect(current_path).to eq(new_conference_payment_path(conference.short_title))
expect(flash).to eq('Please pay here to purchase tickets.')
purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first
expect(purchase.quantity).to eq(2)
expect(current_path).to eq(conference_conference_registration_path(conference.short_title))
expect(flash).
to eq("Thank you for supporting #{conference.title} by purchasing a ticket.")
expect(page.has_content?("2 #{ticket.title} Tickets for 10")).to be true
end
scenario 'deletes a purchased ticket', feature: true, js: true do
create(:registration, conference: conference, user: participant)
create(:ticket_purchase, conference: conference, user: participant, ticket: ticket, quantity: 4)
visit conference_conference_registration_path(conference.short_title)
expect(page.has_content?("4 #{ticket.title} Tickets for 10")).to be true
click_link "ticket-#{ticket.id}-delete"
expect(flash).to eq('Ticket successfully deleted.')
expect(TicketPurchase.count).to eq(0)
end
end
end