Sha256: 4cbf7a127de56774b7bc3de4173fc5741bdcf0ec51eb992ac85c29adc871b502
Contents?: true
Size: 910 Bytes
Versions: 2
Compression:
Stored size: 910 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.send(mock_type, time) else Timecop.return end example.run Timecop.return end end rescue LoadError end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rspectacular-0.63.0 | lib/rspectacular/plugins/timecop.rb |
rspectacular-0.62.1 | lib/rspectacular/plugins/timecop.rb |