lib/mocktail/value/cabinet.rb in mocktail-0.0.6 vs lib/mocktail/value/cabinet.rb in mocktail-1.0.0

- old
+ new

@@ -1,22 +1,24 @@ # The Cabinet stores all thread-local state, so anything that goes here # is guaranteed by Mocktail to be local to the currently-running thread module Mocktail class Cabinet attr_writer :demonstration_in_progress - attr_reader :calls, :stubbings + attr_reader :calls, :stubbings, :unsatisfying_calls def initialize @doubles = [] @calls = [] @stubbings = [] + @unsatisfying_calls = [] @demonstration_in_progress = false end def reset! @calls = [] @stubbings = [] + @unsatisfying_calls = [] # Could cause an exception or prevent pollution—you decide! @demonstration_in_progress = false # note we don't reset doubles as they don't carry any # user-meaningful state on them, and clearing them on reset could result # in valid mocks being broken and stop working @@ -30,9 +32,13 @@ @calls << call end def store_stubbing(stubbing) @stubbings << stubbing + end + + def store_unsatisfying_call(unsatisfying_call) + @unsatisfying_calls << unsatisfying_call end def demonstration_in_progress? @demonstration_in_progress end