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
Jérome Perrin
gitlab-ce
Commits
8589824f
Commit
8589824f
authored
Sep 12, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add UsersGroup observer
Trigger notification service when new user-group relation was created
parent
73446fe1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
app/observers/users_group_observer.rb
app/observers/users_group_observer.rb
+9
-0
spec/observers/users_group_observer_spec.rb
spec/observers/users_group_observer_spec.rb
+27
-0
No files found.
app/observers/users_group_observer.rb
0 → 100644
View file @
8589824f
class
UsersGroupObserver
<
BaseObserver
def
after_create
(
membership
)
notification
.
new_group_member
(
membership
)
end
def
after_update
(
membership
)
notification
.
update_group_member
(
membership
)
end
end
spec/observers/users_group_observer_spec.rb
0 → 100644
View file @
8589824f
require
'spec_helper'
describe
UsersGroupObserver
do
before
(
:each
)
{
enable_observers
}
after
(
:each
)
{
disable_observers
}
subject
{
UsersGroupObserver
.
instance
}
before
{
subject
.
stub
(
notification:
mock
(
'NotificationService'
).
as_null_object
)
}
describe
"#after_create"
do
it
"should send email to user"
do
subject
.
should_receive
(
:notification
)
create
(
:users_group
)
end
end
describe
"#after_update"
do
before
do
@membership
=
create
:users_group
end
it
"should send email to user"
do
subject
.
should_receive
(
:notification
)
@membership
.
update_attribute
(
:group_access
,
UsersGroup
::
MASTER
)
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