test/minion_test.rb in parallel_minion-1.2.0 vs test/minion_test.rb in parallel_minion-1.2.1
- old
+ new
@@ -9,11 +9,11 @@
[false, true].each do |enabled|
describe enabled ? 'enabled' : 'disabled' do
before do
ParallelMinion::Minion.enabled = enabled
- $log_structs = []
+ $log_structs.clear
end
it 'without parameters' do
minion = ParallelMinion::Minion.new { 196 }
assert_equal 196, minion.result
@@ -71,13 +71,44 @@
it 'copy across logging tags' do
minion = nil
SemanticLogger.tagged('TAG') do
assert_equal 'TAG', SemanticLogger.tags.last
minion = ParallelMinion::Minion.new(description: 'Tag Test') do
+ logger.info "Tag Test"
logger.tags.last
end
end
assert_equal 'TAG', minion.result
+ end
+
+ it 'copy across named tags' do
+ minion = nil
+ SemanticLogger.named_tagged(tag: 'TAG') do
+ assert_equal({tag: 'TAG'}, SemanticLogger.named_tags)
+ minion = ParallelMinion::Minion.new(description: 'Named Tags Test') do
+ logger.info "Named Tags Test"
+ SemanticLogger.named_tags
+ end
+ end
+ assert_equal({tag: 'TAG'}, minion.result)
+ end
+
+ it 'copy across tags and named tags' do
+ minion = nil
+ SemanticLogger.tagged('TAG') do
+ SemanticLogger.named_tagged(tag: 'TAG') do
+ assert_equal({tag: 'TAG'}, SemanticLogger.named_tags)
+ assert_equal 'TAG', SemanticLogger.tags.last
+ minion = ParallelMinion::Minion.new(description: 'Tags Test') do
+ logger.info "Tags Test"
+ [SemanticLogger.named_tags, SemanticLogger.tags.last]
+ end
+
+ assert_equal({tag: 'TAG'}, minion.result.first)
+ assert_equal 'TAG', minion.result.last
+ end
+ end
+
end
it 'include metric' do
metric_name = 'model/method'
hash = {value: 23}