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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
54db527b
Commit
54db527b
authored
May 10, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorganize SystemNoteService spec a bit
parent
3e8efce3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+17
-13
No files found.
spec/services/system_note_service_spec.rb
View file @
54db527b
...
@@ -6,6 +6,10 @@ describe SystemNoteService do
...
@@ -6,6 +6,10 @@ describe SystemNoteService do
let
(
:noteable
)
{
create
(
:issue
,
project:
project
)
}
let
(
:noteable
)
{
create
(
:issue
,
project:
project
)
}
shared_examples_for
'a system note'
do
shared_examples_for
'a system note'
do
it
'is valid'
do
expect
(
subject
).
to
be_valid
end
it
'sets the noteable model'
do
it
'sets the noteable model'
do
expect
(
subject
.
noteable
).
to
eq
noteable
expect
(
subject
.
noteable
).
to
eq
noteable
end
end
...
@@ -24,13 +28,13 @@ describe SystemNoteService do
...
@@ -24,13 +28,13 @@ describe SystemNoteService do
end
end
describe
'.add_commits'
do
describe
'.add_commits'
do
subject
{
described_class
.
add_commits
(
noteable
,
project
,
author
,
new_commits
,
old_commits
,
oldrev
)
}
let
(
:noteable
)
{
create
(
:merge_request
,
source_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
}
subject
{
described_class
.
add_commits
(
noteable
,
project
,
author
,
new_commits
,
old_commits
,
oldrev
)
}
it_behaves_like
'a system note'
it_behaves_like
'a system note'
describe
'note body'
do
describe
'note body'
do
...
@@ -100,10 +104,10 @@ describe SystemNoteService do
...
@@ -100,10 +104,10 @@ describe SystemNoteService do
end
end
describe
'.change_assignee'
do
describe
'.change_assignee'
do
let
(
:assignee
)
{
create
(
:user
)
}
subject
{
described_class
.
change_assignee
(
noteable
,
project
,
author
,
assignee
)
}
subject
{
described_class
.
change_assignee
(
noteable
,
project
,
author
,
assignee
)
}
let
(
:assignee
)
{
create
(
:user
)
}
it_behaves_like
'a system note'
it_behaves_like
'a system note'
context
'when assignee added'
do
context
'when assignee added'
do
...
@@ -122,12 +126,12 @@ describe SystemNoteService do
...
@@ -122,12 +126,12 @@ describe SystemNoteService do
end
end
describe
'.change_label'
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
)
}
let
(
:added
)
{
[]
}
let
(
:added
)
{
[]
}
let
(
:removed
)
{
[]
}
let
(
:removed
)
{
[]
}
subject
{
described_class
.
change_label
(
noteable
,
project
,
author
,
added
,
removed
)
}
it_behaves_like
'a system note'
it_behaves_like
'a system note'
context
'with added labels'
do
context
'with added labels'
do
...
@@ -159,10 +163,10 @@ describe SystemNoteService do
...
@@ -159,10 +163,10 @@ describe SystemNoteService do
end
end
describe
'.change_milestone'
do
describe
'.change_milestone'
do
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
subject
{
described_class
.
change_milestone
(
noteable
,
project
,
author
,
milestone
)
}
subject
{
described_class
.
change_milestone
(
noteable
,
project
,
author
,
milestone
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
it_behaves_like
'a system note'
it_behaves_like
'a system note'
context
'when milestone added'
do
context
'when milestone added'
do
...
@@ -181,11 +185,11 @@ describe SystemNoteService do
...
@@ -181,11 +185,11 @@ describe SystemNoteService do
end
end
describe
'.change_status'
do
describe
'.change_status'
do
subject
{
described_class
.
change_status
(
noteable
,
project
,
author
,
status
,
source
)
}
let
(
:status
)
{
'new_status'
}
let
(
:status
)
{
'new_status'
}
let
(
:source
)
{
nil
}
let
(
:source
)
{
nil
}
subject
{
described_class
.
change_status
(
noteable
,
project
,
author
,
status
,
source
)
}
it_behaves_like
'a system note'
it_behaves_like
'a system note'
context
'with a source'
do
context
'with a source'
do
...
@@ -204,10 +208,10 @@ describe SystemNoteService do
...
@@ -204,10 +208,10 @@ describe SystemNoteService do
end
end
describe
'.cross_reference'
do
describe
'.cross_reference'
do
let
(
:mentioner
)
{
create
(
:issue
,
project:
project
)
}
subject
{
described_class
.
cross_reference
(
noteable
,
mentioner
,
author
)
}
subject
{
described_class
.
cross_reference
(
noteable
,
mentioner
,
author
)
}
let
(
:mentioner
)
{
create
(
:issue
,
project:
project
)
}
it_behaves_like
'a system note'
it_behaves_like
'a system note'
context
'when cross-reference disallowed'
do
context
'when cross-reference disallowed'
do
...
@@ -245,7 +249,7 @@ describe SystemNoteService do
...
@@ -245,7 +249,7 @@ describe SystemNoteService do
end
end
end
end
context
'same project'
do
context
'
within the
same project'
do
context
'from Commit'
do
context
'from Commit'
do
let
(
:mentioner
)
{
project
.
repository
.
commit
}
let
(
:mentioner
)
{
project
.
repository
.
commit
}
...
...
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