1
0
mirror of https://github.com/meineerde/rackstash.git synced 2025-10-17 14:01:01 +00:00

Test Rackstssh::Fields::AbstractCollection#clone

This commit is contained in:
Holger Just 2017-02-16 23:08:42 +01:00
parent 494b64c63a
commit 0339d4bced

View File

@ -61,12 +61,28 @@ describe Rackstash::Fields::AbstractCollection do
end
end
describe '#clone' do
it 'clones the raw value' do
raw = 'hello'
collection.send(:raw=, raw)
expect(collection.send(:raw)).to equal raw
expect(raw).to receive(:clone).and_call_original
cloned = collection.clone
expect(cloned).not_to equal collection
expect(cloned.send(:raw)).to eql 'hello'
expect(cloned.send(:raw)).not_to equal raw
end
end
describe '#dup' do
it 'dups the raw value' do
raw = 'hello'
collection.send(:raw=, raw)
expect(collection.send(:raw)).to equal raw
expect(raw).to receive(:dup).and_call_original
duped = collection.dup
expect(duped).not_to equal collection