Skip to content

Commit

Permalink
Change service to be 'void' type, change test
Browse files Browse the repository at this point in the history
  • Loading branch information
marlena-b committed Sep 16, 2024
1 parent e6c1ab2 commit d1c12af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 3 additions & 4 deletions rails_application/app/services/orders/submit_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d1c12af

Please sign in to comment.