Skip to content

Commit

Permalink
redundant test - no longer needed
Browse files Browse the repository at this point in the history
  • Loading branch information
pjurewicz committed May 7, 2024
1 parent 26299ea commit 4b2804e
Showing 1 changed file with 0 additions and 50 deletions.
50 changes: 0 additions & 50 deletions ecommerce/ordering/test/order_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,55 +35,5 @@ def test_order_lines_after_adding_twice_and_remove_once
order.submit(NumberGenerator.new.call)
assert_equal({ @product_id => 1 }, order.unpublished_events.to_a.last.data[:order_lines])
end

def test_disallowed_order_state_transitions
draft_order.submit(NumberGenerator.new.call)
assert_raises(Order::InvalidState) { draft_order.accept }
assert_raises(Order::InvalidState) { draft_order.reject }
draft_order.expire

assert_raises(Order::InvalidState) { submitted_order.submit(NumberGenerator.new.call) }
submitted_order.accept
submitted_order.reject
assert_raises(Order::InvalidState) { submitted_order.expire }

assert_raises(Order::InvalidState) { accepted_order.submit(NumberGenerator.new.call) }
assert_raises(Order::InvalidState) { accepted_order.accept }
assert_raises(Order::InvalidState) { accepted_order.reject }
assert_raises(Order::InvalidState) { accepted_order.expire }

assert_raises(Order::InvalidState) { expired_order.submit(NumberGenerator.new.call) }
assert_raises(Order::InvalidState) { expired_order.accept }
assert_raises(Order::InvalidState) { expired_order.reject }
assert_raises(Order::InvalidState) { expired_order.expire }
end

def draft_order
Order.new(@order_id)
end

def submitted_order
draft_order.tap do |order|
order.submit(NumberGenerator.new.call)
end
end

def accepted_order
submitted_order.tap do |order|
order.accept
end
end

def rejected_order
submitted_order.tap do |order|
order.reject
end
end

def expired_order
draft_order.tap do |order|
order.expire
end
end
end
end

0 comments on commit 4b2804e

Please sign in to comment.