Sha256: 67a5f7098ef534186fb359de5ea69b8c52eb7ccb416460fcda52f4ab00195650
Contents?: true
Size: 1.27 KB
Versions: 8
Compression:
Stored size: 1.27 KB
Contents
# frozen_string_literal: true require 'spec_helper' module QueueBus describe Heartbeat do def now_attributes { 'epoch_seconds' => (Time.now.to_i / 60) * 60, # rounded 'epoch_minutes' => Time.now.to_i / 60, 'epoch_hours' => Time.now.to_i / (60 * 60), 'epoch_days' => Time.now.to_i / (60 * 60 * 24), 'minute' => Time.now.min, 'hour' => Time.now.hour, 'day' => Time.now.day, 'month' => Time.now.month, 'year' => Time.now.year, 'yday' => Time.now.yday, 'wday' => Time.now.wday } end it 'should publish the current time once' do Timecop.freeze '12/12/2013 12:01:19' do expect(QueueBus).to receive(:publish).with('heartbeat_minutes', now_attributes) Heartbeat.perform end Timecop.freeze '12/12/2013 12:01:40' do Heartbeat.perform end end it 'should publish a minute later' do Timecop.freeze '12/12/2013 12:01:19' do expect(QueueBus).to receive(:publish).with('heartbeat_minutes', now_attributes) Heartbeat.perform end Timecop.freeze '12/12/2013 12:02:01' do expect(QueueBus).to receive(:publish).with('heartbeat_minutes', now_attributes) Heartbeat.perform end end end end
Version data entries
8 entries across 8 versions & 1 rubygems