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
2e7cb429
Commit
2e7cb429
authored
Aug 27, 2020
by
Heinrich Lee Yu
Committed by
Eugenia Grieff
Sep 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix note spec
Provide persisted associations for some tests that need them
parent
e2e3b618
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
spec/models/note_spec.rb
spec/models/note_spec.rb
+11
-7
No files found.
spec/models/note_spec.rb
View file @
2e7cb429
...
...
@@ -67,7 +67,7 @@ RSpec.describe Note do
end
context
'when noteable is a personal snippet'
do
subject
{
build
(
:note_on_personal_snippet
)
}
subject
{
build
(
:note_on_personal_snippet
,
noteable:
create
(
:personal_snippet
)
)
}
it
'is valid without project'
do
is_expected
.
to
be_valid
...
...
@@ -109,7 +109,8 @@ RSpec.describe Note do
describe
'callbacks'
do
describe
'#notify_after_create'
do
it
'calls #after_note_created on the noteable'
do
note
=
build
(
:note
)
noteable
=
create
(
:issue
)
note
=
build
(
:note
,
project:
noteable
.
project
,
noteable:
noteable
)
expect
(
note
).
to
receive
(
:notify_after_create
).
and_call_original
expect
(
note
.
noteable
).
to
receive
(
:after_note_created
).
with
(
note
)
...
...
@@ -840,7 +841,8 @@ RSpec.describe Note do
let
(
:html
)
{
'<p>some html</p>'
}
context
'note for a project snippet'
do
let
(
:note
)
{
build
(
:note_on_project_snippet
)
}
let
(
:snippet
)
{
create
(
:project_snippet
)
}
let
(
:note
)
{
build
(
:note_on_project_snippet
,
project:
snippet
.
project
,
noteable:
snippet
)
}
before
do
expect
(
Banzai
::
Renderer
).
to
receive
(
:cacheless_render_field
)
...
...
@@ -855,7 +857,8 @@ RSpec.describe Note do
end
context
'note for a personal snippet'
do
let
(
:note
)
{
build
(
:note_on_personal_snippet
)
}
let
(
:snippet
)
{
create
(
:personal_snippet
)
}
let
(
:note
)
{
build
(
:note_on_personal_snippet
,
noteable:
snippet
)
}
before
do
expect
(
Banzai
::
Renderer
).
to
receive
(
:cacheless_render_field
)
...
...
@@ -889,7 +892,7 @@ RSpec.describe Note do
context
'for a note on a commit'
do
it
'returns true'
do
note
=
build
(
:note_on_commit
)
note
=
build
(
:note_on_commit
,
project:
create
(
:project
,
:repository
)
)
expect
(
note
.
can_be_discussion_note?
).
to
be_truthy
end
...
...
@@ -913,7 +916,7 @@ RSpec.describe Note do
context
'for a diff note on commit'
do
it
'returns false'
do
note
=
build
(
:diff_note_on_commit
)
note
=
build
(
:diff_note_on_commit
,
project:
create
(
:project
,
:repository
)
)
expect
(
note
.
can_be_discussion_note?
).
to
be_falsey
end
...
...
@@ -1143,7 +1146,8 @@ RSpec.describe Note do
end
describe
'expiring ETag cache'
do
let
(
:note
)
{
build
(
:note_on_issue
)
}
let_it_be
(
:issue
)
{
create
(
:issue
)
}
let
(
:note
)
{
build
(
:note
,
project:
issue
.
project
,
noteable:
issue
)
}
def
expect_expiration
(
noteable
)
expect_any_instance_of
(
Gitlab
::
EtagCaching
::
Store
)
...
...
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