From d2c6b685e4959d08e70bb5012af98fa01fcdebef Mon Sep 17 00:00:00 2001 From: Zeke Gabrielse Date: Wed, 14 Aug 2024 15:59:54 -0500 Subject: [PATCH] add nowhere example --- README.md | 7 +++++++ spec/transition_through_spec.rb | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 70288b7..f94820c 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,13 @@ it 'should transition through' do expect { count.call }.to transition { counter.count }.through [0, 1, 4, 2, 0] end + +it 'should transition nowhere' do + counter = Counter.new + count = -> {} + + expect { count.call }.to transition { counter.count }.nowhere +end ``` ## Supported Rubies diff --git a/spec/transition_through_spec.rb b/spec/transition_through_spec.rb index 2e4efc3..61f76bf 100644 --- a/spec/transition_through_spec.rb +++ b/spec/transition_through_spec.rb @@ -105,6 +105,13 @@ def decrement(n = 1, by: 1) = n.times { self.count += by } expect { count.call }.to transition { counter.count }.through [0, 1, 4, 2, 0] end + + it 'should transition nowhere' do + counter = Counter.new + count = -> {} + + expect { count.call }.to transition { counter.count }.nowhere + end end end end