Sha256: e3c66bf4f46eaa8f854fcd187c6690c76e23824cf0ad94728ac6a500a7f59173
Contents?: true
Size: 821 Bytes
Versions: 13
Compression:
Stored size: 821 Bytes
Contents
# frozen_string_literal: true RSpec.configure do |config| config.around(:each, :time_mock => lambda { |v| !!v }) do |example| config.rspeckled_logger.debug("Around Each - Start - #{__FILE__}") 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 config.rspeckled_logger.debug("Around Each - End - #{__FILE__}") end end
Version data entries
13 entries across 13 versions & 1 rubygems