GitLab steht aufgrund wichtiger Wartungsarbeiten am Montag, den 8. März, zwischen 17:00 und 19:00 Uhr nicht zur Verfügung.

Commit 32a1277d authored by Thong Kuah's avatar Thong Kuah

Fix license_template_spec to not modify String

Revamp how spec verifies proc#call called only once
parent 5cd63ace
......@@ -5,14 +5,15 @@
describe LicenseTemplate do
describe '#content' do
it 'calls a proc exactly once if provided' do
lazy = build_template(-> { 'bar' })
content = lazy.content
content_proc = -> { 'bar' }
expect(content_proc).to receive(:call).once.and_call_original
expect(content).to eq('bar')
expect(content.object_id).to eq(lazy.content.object_id)
lazy = build_template(content_proc)
expect(lazy.content).to eq('foo')
expect(lazy.content).to eq('bar')
# Subsequent calls should not call proc again
expect(lazy.content).to eq('bar')
it 'returns a string if provided' do
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment