Sha256: 1575ae08c74003d69ce263065becfbd0ef47fd5b2eba75c52dac796a4db4e704
Contents?: true
Size: 1.75 KB
Versions: 3
Compression:
Stored size: 1.75 KB
Contents
require_relative '../../test_helper' # Unit Test for RocketJob::Job module Plugins module Job class LoggerTest < Minitest::Test class LoggerJob < RocketJob::Job def perform logger.debug('DONE', value: 123, other_value: 'HI') end end describe RocketJob::Plugins::Job::Logger do before do LoggerJob.delete_all end after do @job.destroy if @job && !@job.new_record? SemanticLogger.flush end describe '#logger' do it 'uses semantic logger' do @job = LoggerJob.new assert_kind_of SemanticLogger::Logger, @job.logger, @job.logger.ai assert_equal @job.class.name, @job.logger.name, @job.logger.ai end it 'allows perform to log its own data' do @job = LoggerJob.new @job.perform_now end it 'adds start logging' do @job = LoggerJob.new info_called = false @job.logger.stub(:info, ->(description) { info_called = true if description == 'Start #perform' }) do @job.perform_now end assert info_called, "In Plugins::Job::Logger.around_perform logger.info('Start #perform') not called" end it 'adds completed logging' do @job = LoggerJob.new measure_called = false @job.logger.stub(:measure_info, ->(description, *_args) { measure_called = true if description == 'Completed #perform' }) do @job.perform_now end assert measure_called, "In Plugins::Job::Logger.around_perform logger.measure_info('Completed #perform') not called" end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rocketjob-3.5.2 | test/plugins/job/logger_test.rb |
rocketjob-3.5.1 | test/plugins/job/logger_test.rb |
rocketjob-3.5.0 | test/plugins/job/logger_test.rb |