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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
f212210d
Commit
f212210d
authored
Aug 30, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize system note service specs
parent
aacc6110
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
22 deletions
+8
-22
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+8
-22
No files found.
spec/services/system_note_service_spec.rb
View file @
f212210d
...
@@ -3,9 +3,9 @@ require 'spec_helper'
...
@@ -3,9 +3,9 @@ require 'spec_helper'
describe
SystemNoteService
do
describe
SystemNoteService
do
include
Gitlab
::
Routing
include
Gitlab
::
Routing
l
et
(
:group
)
{
create
(
:group
)
}
s
et
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
set
(
:project
)
{
create
(
:project
,
:repository
,
group:
group
)
}
l
et
(
:author
)
{
create
(
:user
)
}
s
et
(
:author
)
{
create
(
:user
)
}
let
(
:noteable
)
{
create
(
:issue
,
project:
project
)
}
let
(
:noteable
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
noteable
}
let
(
:issue
)
{
noteable
}
...
@@ -29,8 +29,7 @@ describe SystemNoteService do
...
@@ -29,8 +29,7 @@ describe SystemNoteService do
describe
'.add_commits'
do
describe
'.add_commits'
do
subject
{
described_class
.
add_commits
(
noteable
,
project
,
author
,
new_commits
,
old_commits
,
oldrev
)
}
subject
{
described_class
.
add_commits
(
noteable
,
project
,
author
,
new_commits
,
old_commits
,
oldrev
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:noteable
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
let
(
:noteable
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:new_commits
)
{
noteable
.
commits
}
let
(
:new_commits
)
{
noteable
.
commits
}
let
(
:old_commits
)
{
[]
}
let
(
:old_commits
)
{
[]
}
let
(
:oldrev
)
{
nil
}
let
(
:oldrev
)
{
nil
}
...
@@ -185,7 +184,7 @@ describe SystemNoteService do
...
@@ -185,7 +184,7 @@ describe SystemNoteService do
describe
'.change_label'
do
describe
'.change_label'
do
subject
{
described_class
.
change_label
(
noteable
,
project
,
author
,
added
,
removed
)
}
subject
{
described_class
.
change_label
(
noteable
,
project
,
author
,
added
,
removed
)
}
let
(
:labels
)
{
create_list
(
:label
,
2
)
}
let
(
:labels
)
{
create_list
(
:label
,
2
,
project:
project
)
}
let
(
:added
)
{
[]
}
let
(
:added
)
{
[]
}
let
(
:removed
)
{
[]
}
let
(
:removed
)
{
[]
}
...
@@ -294,7 +293,6 @@ describe SystemNoteService do
...
@@ -294,7 +293,6 @@ describe SystemNoteService do
end
end
describe
'.merge_when_pipeline_succeeds'
do
describe
'.merge_when_pipeline_succeeds'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
{
build
(
:ci_pipeline_without_jobs
)}
let
(
:pipeline
)
{
build
(
:ci_pipeline_without_jobs
)}
let
(
:noteable
)
do
let
(
:noteable
)
do
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
...
@@ -312,7 +310,6 @@ describe SystemNoteService do
...
@@ -312,7 +310,6 @@ describe SystemNoteService do
end
end
describe
'.cancel_merge_when_pipeline_succeeds'
do
describe
'.cancel_merge_when_pipeline_succeeds'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:noteable
)
do
let
(
:noteable
)
do
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
end
end
...
@@ -390,7 +387,6 @@ describe SystemNoteService do
...
@@ -390,7 +387,6 @@ describe SystemNoteService do
describe
'.change_branch'
do
describe
'.change_branch'
do
subject
{
described_class
.
change_branch
(
noteable
,
project
,
author
,
'target'
,
old_branch
,
new_branch
)
}
subject
{
described_class
.
change_branch
(
noteable
,
project
,
author
,
'target'
,
old_branch
,
new_branch
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:old_branch
)
{
'old_branch'
}
let
(
:old_branch
)
{
'old_branch'
}
let
(
:new_branch
)
{
'new_branch'
}
let
(
:new_branch
)
{
'new_branch'
}
...
@@ -408,8 +404,6 @@ describe SystemNoteService do
...
@@ -408,8 +404,6 @@ describe SystemNoteService do
describe
'.change_branch_presence'
do
describe
'.change_branch_presence'
do
subject
{
described_class
.
change_branch_presence
(
noteable
,
project
,
author
,
:source
,
'feature'
,
:delete
)
}
subject
{
described_class
.
change_branch_presence
(
noteable
,
project
,
author
,
:source
,
'feature'
,
:delete
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
it_behaves_like
'a system note'
do
it_behaves_like
'a system note'
do
let
(
:action
)
{
'branch'
}
let
(
:action
)
{
'branch'
}
end
end
...
@@ -424,8 +418,6 @@ describe SystemNoteService do
...
@@ -424,8 +418,6 @@ describe SystemNoteService do
describe
'.new_issue_branch'
do
describe
'.new_issue_branch'
do
subject
{
described_class
.
new_issue_branch
(
noteable
,
project
,
author
,
"1-mepmep"
)
}
subject
{
described_class
.
new_issue_branch
(
noteable
,
project
,
author
,
"1-mepmep"
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
it_behaves_like
'a system note'
do
it_behaves_like
'a system note'
do
let
(
:action
)
{
'branch'
}
let
(
:action
)
{
'branch'
}
end
end
...
@@ -471,7 +463,7 @@ describe SystemNoteService do
...
@@ -471,7 +463,7 @@ describe SystemNoteService do
describe
'note_body'
do
describe
'note_body'
do
context
'cross-project'
do
context
'cross-project'
do
let
(
:project2
)
{
create
(
:project
,
:repository
)
}
let
(
:project2
)
{
create
(
:project
,
:repository
)
}
let
(
:mentioner
)
{
create
(
:issue
,
project:
project2
)
}
let
(
:mentioner
)
{
create
(
:issue
,
project:
project2
)
}
context
'from Commit'
do
context
'from Commit'
do
...
@@ -491,7 +483,6 @@ describe SystemNoteService do
...
@@ -491,7 +483,6 @@ describe SystemNoteService do
context
'within the same project'
do
context
'within the same project'
do
context
'from Commit'
do
context
'from Commit'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:mentioner
)
{
project
.
repository
.
commit
}
let
(
:mentioner
)
{
project
.
repository
.
commit
}
it
'references the mentioning commit'
do
it
'references the mentioning commit'
do
...
@@ -533,7 +524,6 @@ describe SystemNoteService do
...
@@ -533,7 +524,6 @@ describe SystemNoteService do
end
end
context
'when mentioner is a MergeRequest'
do
context
'when mentioner is a MergeRequest'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:mentioner
)
{
create
(
:merge_request
,
:simple
,
source_project:
project
)
}
let
(
:mentioner
)
{
create
(
:merge_request
,
:simple
,
source_project:
project
)
}
let
(
:noteable
)
{
project
.
commit
}
let
(
:noteable
)
{
project
.
commit
}
...
@@ -561,7 +551,6 @@ describe SystemNoteService do
...
@@ -561,7 +551,6 @@ describe SystemNoteService do
end
end
describe
'.cross_reference_exists?'
do
describe
'.cross_reference_exists?'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:commit0
)
{
project
.
commit
}
let
(
:commit0
)
{
project
.
commit
}
let
(
:commit1
)
{
project
.
commit
(
'HEAD~2'
)
}
let
(
:commit1
)
{
project
.
commit
(
'HEAD~2'
)
}
...
@@ -899,9 +888,8 @@ describe SystemNoteService do
...
@@ -899,9 +888,8 @@ describe SystemNoteService do
end
end
describe
'.discussion_continued_in_issue'
do
describe
'.discussion_continued_in_issue'
do
let
(
:discussion
)
{
create
(
:diff_note_on_merge_request
).
to_discussion
}
let
(
:discussion
)
{
create
(
:diff_note_on_merge_request
,
project:
project
).
to_discussion
}
let
(
:merge_request
)
{
discussion
.
noteable
}
let
(
:merge_request
)
{
discussion
.
noteable
}
let
(
:project
)
{
merge_request
.
source_project
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
def
reloaded_merge_request
def
reloaded_merge_request
...
@@ -1023,7 +1011,6 @@ describe SystemNoteService do
...
@@ -1023,7 +1011,6 @@ describe SystemNoteService do
end
end
describe
'.add_merge_request_wip_from_commit'
do
describe
'.add_merge_request_wip_from_commit'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:noteable
)
do
let
(
:noteable
)
do
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
end
end
...
@@ -1078,9 +1065,8 @@ describe SystemNoteService do
...
@@ -1078,9 +1065,8 @@ describe SystemNoteService do
end
end
describe
'.diff_discussion_outdated'
do
describe
'.diff_discussion_outdated'
do
let
(
:discussion
)
{
create
(
:diff_note_on_merge_request
).
to_discussion
}
let
(
:discussion
)
{
create
(
:diff_note_on_merge_request
,
project:
project
).
to_discussion
}
let
(
:merge_request
)
{
discussion
.
noteable
}
let
(
:merge_request
)
{
discussion
.
noteable
}
let
(
:project
)
{
merge_request
.
source_project
}
let
(
:change_position
)
{
discussion
.
position
}
let
(
:change_position
)
{
discussion
.
position
}
def
reloaded_merge_request
def
reloaded_merge_request
...
...
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