21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-05-21 01:48:39 +02:00
chexpire/test/services/notifier/processor_test.rb

32 lines
733 B
Ruby
Raw Normal View History

2018-06-04 14:06:37 +02:00
require "test_helper"
module Notifier
class ProcessorTest < ActiveSupport::TestCase
private
# rubocop:disable Metrics/MethodLength
def test_interval_respected(process_method, count_expected)
configuration = Minitest::Mock.new
count_expected.times do
configuration.expect(:interval, 0.000001)
end
processor = Processor.new(configuration)
mock = Minitest::Mock.new
assert_stub = lambda { |actual_time|
assert_equal 0.000001, actual_time
mock
}
processor.stub :sleep, assert_stub do
processor.public_send(process_method)
end
configuration.verify
mock.verify
end
# rubocop:enable Metrics/MethodLength
end
end