Sha256: 05306541c11ea385dc9a28c15fecfc7930031192460a836694cd1fb81e53307a
Contents?: true
Size: 921 Bytes
Versions: 9
Compression:
Stored size: 921 Bytes
Contents
############################################################################## # Timecop Plugin ############################################################################## begin require 'timecop' RSpec.configure do |config| config.around(:each, :time_mock => lambda { |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.send(mock_type, time) else Timecop.return end example.run Timecop.return end end rescue LoadError end
Version data entries
9 entries across 9 versions & 1 rubygems