1
0
mirror of https://github.com/meineerde/rackstash.git synced 2025-12-19 15:01:12 +00:00

Set the Buffer's timestamp when setting a tag

This commit is contained in:
Holger Just 2017-08-17 00:49:10 +02:00
parent ff50daf1eb
commit 78466f9439
2 changed files with 6 additions and 0 deletions

View File

@ -252,6 +252,7 @@ module Rackstash
# @return [Fields::Tags] the resolved tags which are set on the buffer.
# All strings are frozen.
def tag(*new_tags, scope: nil)
timestamp
tags.merge!(new_tags, scope: scope)
end

View File

@ -429,6 +429,11 @@ describe Rackstash::Buffer do
expect(buffer.tags).to contain_exactly('tag')
end
it 'sets the timestamp' do
expect(buffer).to receive(:timestamp)
buffer.tag('hello')
end
describe 'when passing procs' do
let(:struct) {
Struct.new(:value) do