diff --git a/rails_application/app/services/orders/submit_service.rb b/rails_application/app/services/orders/submit_service.rb index e4eba9a1..84c6889c 100644 --- a/rails_application/app/services/orders/submit_service.rb +++ b/rails_application/app/services/orders/submit_service.rb @@ -22,10 +22,9 @@ def call end .call - if unavailable_products.any? - raise OrderHasUnavailableProducts.new(unavailable_products) - end - true + if unavailable_products.any? + raise OrderHasUnavailableProducts.new(unavailable_products) + end end private diff --git a/rails_application/test/services/orders/submit_service_test.rb b/rails_application/test/services/orders/submit_service_test.rb index 96542571..3c0048fd 100644 --- a/rails_application/test/services/orders/submit_service_test.rb +++ b/rails_application/test/services/orders/submit_service_test.rb @@ -13,7 +13,12 @@ def test_successful_order_submission prepare_product(product_id, "Async Remote", 49) run_command(Ordering::AddItemToBasket.new(order_id: order_id, product_id: product_id)) - assert_equal true, Orders::SubmitService.new(order_id: order_id, customer_id: customer_id).call + Orders::SubmitService.new(order_id: order_id, customer_id: customer_id).call + + order = Order.find_by!(uid: order_id) + + assert_equal "Submitted", order.state + assert_equal "John Doe", order.customer end def test_order_submission_with_unavailable_products