Sha256: 0db1a6c6e69785432b1c43639fd11b19b7cdd9b5580099d2f269d2d901ad2e0d
Contents?: true
Size: 794 Bytes
Versions: 54
Compression:
Stored size: 794 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 TrueClass {} end mock_type = options.fetch(:type, :freeze) time = options.fetch(:time, Time.utc(2012, 7, 26, 18, 0, 0)) Timecop.send(mock_type, time) example.run Timecop.return end end rescue LoadError end
Version data entries
54 entries across 54 versions & 1 rubygems