Sha256: b6c7dd7ca5a8529df1b5723434064a5e791ef10af8d66305f7d87ddfd06a07c4
Contents?: true
Size: 761 Bytes
Versions: 18
Compression:
Stored size: 761 Bytes
Contents
RSpec::Matchers.define :create_file do |expected| match do |block| @before = exists?(expected) block.call @after = exists?(expected) !@before && @after end failure_message_for_should do |block| existed_before_message expected do "The file #{expected.inspect} was not created" end end failure_message_for_should_not do |block| existed_before_message expected do "The file #{expected.inspect} was created" end end def exists?(expected) # Allows us to use wildcard checks for existence. !Dir.glob(expected).empty? end def existed_before_message(expected) if @before "The file #{expected.inspect} existed before, so this test doesn't work" else yield end end end
Version data entries
18 entries across 18 versions & 1 rubygems