BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
22 deletions
+8
-22
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'
describe
SystemNoteService
do
include
Gitlab
::
Routing
l
et
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
l
et
(
:author
)
{
create
(
:user
)
}
s
et
(
:group
)
{
create
(
:group
)
}
set
(
:project
)
{
create
(
:project
,
:repository
,
group:
group
)
}
s
et
(
:author
)
{
create
(
:user
)
}
let
(
:noteable
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
noteable
}
...
...
@@ -29,8 +29,7 @@ describe SystemNoteService do
describe
'.add_commits'
do
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
)
}
let
(
:noteable
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
let
(
:new_commits
)
{
noteable
.
commits
}
let
(
:old_commits
)
{
[]
}
let
(
:oldrev
)
{
nil
}
...
...
@@ -185,7 +184,7 @@ describe SystemNoteService do
describe
'.change_label'
do
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
(
:removed
)
{
[]
}
...
...
@@ -294,7 +293,6 @@ describe SystemNoteService do
end
describe
'.merge_when_pipeline_succeeds'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
{
build
(
:ci_pipeline_without_jobs
)}
let
(
:noteable
)
do
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
...
...
@@ -312,7 +310,6 @@ describe SystemNoteService do
end
describe
'.cancel_merge_when_pipeline_succeeds'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:noteable
)
do
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
end
...
...
@@ -390,7 +387,6 @@ describe SystemNoteService do
describe
'.change_branch'
do
subject
{
described_class
.
change_branch
(
noteable
,
project
,
author
,
'target'
,
old_branch
,
new_branch
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:old_branch
)
{
'old_branch'
}
let
(
:new_branch
)
{
'new_branch'
}
...
...
@@ -408,8 +404,6 @@ describe SystemNoteService do
describe
'.change_branch_presence'
do
subject
{
described_class
.
change_branch_presence
(
noteable
,
project
,
author
,
:source
,
'feature'
,
:delete
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
it_behaves_like
'a system note'
do
let
(
:action
)
{
'branch'
}
end
...
...
@@ -424,8 +418,6 @@ describe SystemNoteService do
describe
'.new_issue_branch'
do
subject
{
described_class
.
new_issue_branch
(
noteable
,
project
,
author
,
"1-mepmep"
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
it_behaves_like
'a system note'
do
let
(
:action
)
{
'branch'
}
end
...
...
@@ -471,7 +463,7 @@ describe SystemNoteService do
describe
'note_body'
do
context
'cross-project'
do
let
(
:project2
)
{
create
(
:project
,
:repository
)
}
let
(
:project2
)
{
create
(
:project
,
:repository
)
}
let
(
:mentioner
)
{
create
(
:issue
,
project:
project2
)
}
context
'from Commit'
do
...
...
@@ -491,7 +483,6 @@ describe SystemNoteService do
context
'within the same project'
do
context
'from Commit'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:mentioner
)
{
project
.
repository
.
commit
}
it
'references the mentioning commit'
do
...
...
@@ -533,7 +524,6 @@ describe SystemNoteService do
end
context
'when mentioner is a MergeRequest'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:mentioner
)
{
create
(
:merge_request
,
:simple
,
source_project:
project
)
}
let
(
:noteable
)
{
project
.
commit
}
...
...
@@ -561,7 +551,6 @@ describe SystemNoteService do
end
describe
'.cross_reference_exists?'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:commit0
)
{
project
.
commit
}
let
(
:commit1
)
{
project
.
commit
(
'HEAD~2'
)
}
...
...
@@ -899,9 +888,8 @@ describe SystemNoteService do
end
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
(
:project
)
{
merge_request
.
source_project
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
def
reloaded_merge_request
...
...
@@ -1023,7 +1011,6 @@ describe SystemNoteService do
end
describe
'.add_merge_request_wip_from_commit'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:noteable
)
do
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
end
...
...
@@ -1078,9 +1065,8 @@ describe SystemNoteService do
end
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
(
:project
)
{
merge_request
.
source_project
}
let
(
:change_position
)
{
discussion
.
position
}
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