mirror of
https://github.com/meineerde/rackstash.git
synced 2025-12-20 15:21:12 +00:00
Freeze Messages directly after initialization
This ensures that they are actually immutable.
This commit is contained in:
parent
57f200ab35
commit
667beb662f
@ -53,6 +53,8 @@ module Rackstash
|
|||||||
@progname = dup_freeze(progname)
|
@progname = dup_freeze(progname)
|
||||||
|
|
||||||
@message = cleanup(message)
|
@message = cleanup(message)
|
||||||
|
|
||||||
|
freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
# @return [String] the guman readable label for the {#severity}.
|
# @return [String] the guman readable label for the {#severity}.
|
||||||
|
|||||||
@ -50,6 +50,10 @@ describe Rackstash::Message do
|
|||||||
expect(message.message).not_to equal str
|
expect(message.message).not_to equal str
|
||||||
expect(message.message).to eql str
|
expect(message.message).to eql str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'freezes the Message' do
|
||||||
|
expect(described_class.new('message')).to be_frozen
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#message' do
|
describe '#message' do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user