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:
parent
494b64c63a
commit
0339d4bced
@ -61,12 +61,28 @@ describe Rackstash::Fields::AbstractCollection do
|
|||||||
end
|
end
|
||||||
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
|
describe '#dup' do
|
||||||
it 'dups the raw value' do
|
it 'dups the raw value' do
|
||||||
raw = 'hello'
|
raw = 'hello'
|
||||||
collection.send(:raw=, raw)
|
collection.send(:raw=, raw)
|
||||||
expect(collection.send(:raw)).to equal raw
|
expect(collection.send(:raw)).to equal raw
|
||||||
|
|
||||||
|
expect(raw).to receive(:dup).and_call_original
|
||||||
duped = collection.dup
|
duped = collection.dup
|
||||||
|
|
||||||
expect(duped).not_to equal collection
|
expect(duped).not_to equal collection
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user