Sha256: 20d61ee98a15c2972eab14fc9840a1ff672f91d90c93b8a8e61f0ef61a65b1ab
Contents?: true
Size: 959 Bytes
Versions: 24
Compression:
Stored size: 959 Bytes
Contents
# frozen_string_literal: true ############################################################################## # 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.public_send(mock_type, time) else Timecop.return end example.run Timecop.return end end rescue LoadError end
Version data entries
24 entries across 24 versions & 1 rubygems