mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-28 09:24:24 +01:00
improve testing reservation w/ payment schedule
This commit is contained in:
parent
abe1619392
commit
8a808dbb2f
@ -724,12 +724,20 @@ class Reservations::CreateTest < ActionDispatch::IntegrationTest
|
||||
assert_equal payment_schedule_count + 1, PaymentSchedule.count, 'missing the payment schedule'
|
||||
assert_equal payment_schedule_items_count + 12, PaymentScheduleItem.count, 'missing some payment schedule items'
|
||||
|
||||
# get the objects
|
||||
reservation = Reservation.last
|
||||
payment_schedule = PaymentSchedule.last
|
||||
|
||||
# subscription assertions
|
||||
assert_equal 1, @user_without_subscription.subscriptions.count
|
||||
assert_not_nil @user_without_subscription.subscribed_plan, "user's subscribed plan was not found"
|
||||
assert_not_nil @user_without_subscription.subscription, "user's subscription was not found"
|
||||
assert_equal plan.id, @user_without_subscription.subscribed_plan.id, "user's plan does not match"
|
||||
|
||||
# reservation assertions
|
||||
assert reservation.payment_schedule
|
||||
assert_equal payment_schedule.scheduled, reservation
|
||||
|
||||
# Check the answer
|
||||
reservation = json_response(response.body)
|
||||
assert_equal plan.id, reservation[:user][:subscribed_plan][:id], 'subscribed plan does not match'
|
||||
|
Loading…
Reference in New Issue
Block a user