From d22574dae4d3eb7511fe891b1604b0ea64ca8fa6 Mon Sep 17 00:00:00 2001 From: Nicolas Florentin Date: Fri, 8 Apr 2016 11:11:42 +0200 Subject: [PATCH] UsersCredits::Manager is more strict about arguments that have to be passed --- app/services/users_credits/manager.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/services/users_credits/manager.rb b/app/services/users_credits/manager.rb index eec89155a..4021d5676 100644 --- a/app/services/users_credits/manager.rb +++ b/app/services/users_credits/manager.rb @@ -15,7 +15,11 @@ module UsersCredits @manager = Managers::Training.new(reservation, plan) elsif reservation.reservable_type == "Machine" @manager = Managers::Machine.new(reservation, plan) + else + raise ArgumentError, "reservation.reservable_type must be Training or Machine" end + else + raise ArgumentError, "you have to pass either a reservation or a user to initialize a UsersCredits::Manager" end end