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

Version Path
rspectacular-0.53.1 lib/rspectacular/plugins/timecop.rb
rspectacular-0.53.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.52.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.51.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.50.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.49.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.48.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.47.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.46.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.45.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.44.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.43.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.42.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.41.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.40.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.39.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.38.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.37.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.36.0 lib/rspectacular/plugins/timecop.rb
rspectacular-0.35.0 lib/rspectacular/plugins/timecop.rb