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
7d8d9bd1
Commit
7d8d9bd1
authored
Apr 02, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove issue observer tests
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
ed67ba96
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
99 deletions
+0
-99
spec/observers/issue_observer_spec.rb
spec/observers/issue_observer_spec.rb
+0
-99
No files found.
spec/observers/issue_observer_spec.rb
deleted
100644 → 0
View file @
ed67ba96
require
'spec_helper'
describe
IssueObserver
do
let
(
:some_user
)
{
create
:user
}
let
(
:assignee
)
{
create
:user
}
let
(
:author
)
{
create
:user
}
let
(
:mock_issue
)
{
create
(
:issue
,
assignee:
assignee
,
author:
author
)
}
before
{
subject
.
stub
(
:current_user
).
and_return
(
some_user
)
}
before
{
subject
.
stub
(
:current_commit
).
and_return
(
nil
)
}
before
{
subject
.
stub
(
notification:
double
(
'NotificationService'
).
as_null_object
)
}
before
{
mock_issue
.
project
.
stub_chain
(
:repository
,
:commit
).
and_return
(
nil
)
}
subject
{
IssueObserver
.
instance
}
describe
'#after_create'
do
it
'trigger notification to send emails'
do
subject
.
should_receive
(
:notification
)
subject
.
after_create
(
mock_issue
)
end
it
'should create cross-reference notes'
do
other_issue
=
create
(
:issue
)
mock_issue
.
stub
(
references:
[
other_issue
])
Note
.
should_receive
(
:create_cross_reference_note
).
with
(
other_issue
,
mock_issue
,
some_user
,
mock_issue
.
project
)
subject
.
after_create
(
mock_issue
)
end
end
context
'#after_close'
do
context
'a status "closed"'
do
before
{
mock_issue
.
stub
(
state:
'closed'
)
}
it
'note is created if the issue is being closed'
do
Note
.
should_receive
(
:create_status_change_note
).
with
(
mock_issue
,
mock_issue
.
project
,
some_user
,
'closed'
,
nil
)
subject
.
after_close
(
mock_issue
,
nil
)
end
it
'trigger notification to send emails'
do
subject
.
notification
.
should_receive
(
:close_issue
).
with
(
mock_issue
,
some_user
)
subject
.
after_close
(
mock_issue
,
nil
)
end
it
'appends a mention to the closing commit if one is present'
do
commit
=
double
(
'commit'
,
gfm_reference:
'commit 123456'
)
subject
.
stub
(
current_commit:
commit
)
Note
.
should_receive
(
:create_status_change_note
).
with
(
mock_issue
,
mock_issue
.
project
,
some_user
,
'closed'
,
commit
)
subject
.
after_close
(
mock_issue
,
nil
)
end
end
context
'a status "reopened"'
do
before
{
mock_issue
.
stub
(
state:
'reopened'
)
}
it
'note is created if the issue is being reopened'
do
Note
.
should_receive
(
:create_status_change_note
).
with
(
mock_issue
,
mock_issue
.
project
,
some_user
,
'reopened'
,
nil
)
subject
.
after_reopen
(
mock_issue
,
nil
)
end
end
end
context
'#after_update'
do
before
(
:each
)
do
mock_issue
.
stub
(
:is_being_reassigned?
).
and_return
(
false
)
end
context
'notification'
do
it
'triggered if the issue is being reassigned'
do
mock_issue
.
should_receive
(
:is_being_reassigned?
).
and_return
(
true
)
subject
.
should_receive
(
:notification
)
subject
.
after_update
(
mock_issue
)
end
it
'is not triggered if the issue is not being reassigned'
do
mock_issue
.
should_receive
(
:is_being_reassigned?
).
and_return
(
false
)
subject
.
should_not_receive
(
:notification
)
subject
.
after_update
(
mock_issue
)
end
end
context
'cross-references'
do
it
'notices added references'
do
mock_issue
.
should_receive
(
:notice_added_references
)
subject
.
after_update
(
mock_issue
)
end
end
end
end
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