Sha256: 22ed2008e8745352de78ffa6fec0fd6c633a16d097f108bb966f573265bb733d
Contents?: true
Size: 1 KB
Versions: 3
Compression:
Stored size: 1 KB
Contents
# 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 def initialize @doubles = [] @calls = [] @stubbings = [] @demonstration_in_progress = false end def reset! @calls = [] @stubbings = [] # 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 end def store_double(double) @doubles << double end def store_call(call) @calls << call end def store_stubbing(stubbing) @stubbings << stubbing end def demonstration_in_progress? @demonstration_in_progress end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mocktail-0.0.3 | lib/mocktail/value/cabinet.rb |
mocktail-0.0.2 | lib/mocktail/value/cabinet.rb |
mocktail-0.0.1 | lib/mocktail/value/cabinet.rb |