Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
32a1277d
Commit
32a1277d
authored
Apr 01, 2019
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix license_template_spec to not modify String
Revamp how spec verifies proc#call called only once
parent
5cd63ace
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
spec/models/license_template_spec.rb
spec/models/license_template_spec.rb
+7
-6
No files found.
spec/models/license_template_spec.rb
View file @
32a1277d
...
@@ -5,14 +5,15 @@ require 'spec_helper'
...
@@ -5,14 +5,15 @@ require 'spec_helper'
describe
LicenseTemplate
do
describe
LicenseTemplate
do
describe
'#content'
do
describe
'#content'
do
it
'calls a proc exactly once if provided'
do
it
'calls a proc exactly once if provided'
do
lazy
=
build_template
(
->
{
'bar'
})
content_proc
=
->
{
'bar'
}
content
=
lazy
.
content
expect
(
content_proc
).
to
receive
(
:call
).
once
.
and_call_original
expect
(
content
).
to
eq
(
'bar'
)
lazy
=
build_template
(
content_proc
)
expect
(
content
.
object_id
).
to
eq
(
lazy
.
content
.
object_id
)
content
.
replace
(
'foo'
)
expect
(
lazy
.
content
).
to
eq
(
'bar'
)
expect
(
lazy
.
content
).
to
eq
(
'foo'
)
# Subsequent calls should not call proc again
expect
(
lazy
.
content
).
to
eq
(
'bar'
)
end
end
it
'returns a string if provided'
do
it
'returns a string if provided'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment