Sha256: 9240837783cea10aaea73555bda7d8228a967ef4def67e5905b148ecec61c3de
Contents?: true
Size: 917 Bytes
Versions: 12
Compression:
Stored size: 917 Bytes
Contents
############################################################################## # Timecop Plugin ############################################################################## begin require 'timecop' RSpec.configure do |config| config.around(:each, time_mock: ->(v) { !!v }) do |example| options = example.metadata[:time_mock] options = case options when Time { time: options } when FalseClass false when TrueClass {} end if options mock_type = options.fetch(:type, :freeze) time = options.fetch(:time, Time.utc(2012, 7, 26, 18, 0, 0)) Timecop.public_send(mock_type, time) else Timecop.return end example.run Timecop.return end end rescue LoadError end
Version data entries
12 entries across 12 versions & 1 rubygems