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
Kazuhiko Shiozaki
gitlab-ce
Commits
2ab76ca5
Commit
2ab76ca5
authored
Dec 10, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix UserProject obserse spec
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
d75eb243
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
8 deletions
+4
-8
app/observers/users_project_observer.rb
app/observers/users_project_observer.rb
+0
-4
spec/observers/users_project_observer_spec.rb
spec/observers/users_project_observer_spec.rb
+4
-4
No files found.
app/observers/users_project_observer.rb
View file @
2ab76ca5
class
UsersProjectObserver
<
BaseObserver
class
UsersProjectObserver
<
BaseObserver
def
after_commit
(
users_project
)
return
if
users_project
.
destroyed?
end
def
after_create
(
users_project
)
def
after_create
(
users_project
)
Event
.
create
(
Event
.
create
(
project_id:
users_project
.
project
.
id
,
project_id:
users_project
.
project
.
id
,
...
...
spec/observers/users_project_observer_spec.rb
View file @
2ab76ca5
...
@@ -7,7 +7,7 @@ describe UsersProjectObserver do
...
@@ -7,7 +7,7 @@ describe UsersProjectObserver do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
subject
{
UsersProjectObserver
.
instance
}
subject
{
UsersProjectObserver
.
instance
}
before
{
subject
.
stub
(
notification:
mock
(
'NotificationService'
).
as_null_object
)
}
before
{
subject
.
stub
(
notification:
double
(
'NotificationService'
).
as_null_object
)
}
describe
"#after_commit"
do
describe
"#after_commit"
do
it
"should called when UsersProject created"
do
it
"should called when UsersProject created"
do
...
@@ -35,7 +35,7 @@ describe UsersProjectObserver do
...
@@ -35,7 +35,7 @@ describe UsersProjectObserver do
end
end
it
"should called when UsersProject updated"
do
it
"should called when UsersProject updated"
do
subject
.
should_receive
(
:after_
commit
)
subject
.
should_receive
(
:after_
update
)
@users_project
.
update_attribute
(
:project_access
,
UsersProject
::
MASTER
)
@users_project
.
update_attribute
(
:project_access
,
UsersProject
::
MASTER
)
end
end
...
@@ -45,7 +45,7 @@ describe UsersProjectObserver do
...
@@ -45,7 +45,7 @@ describe UsersProjectObserver do
end
end
it
"should not called after UsersProject destroyed"
do
it
"should not called after UsersProject destroyed"
do
subject
.
should_not_receive
(
:after_
commit
)
subject
.
should_not_receive
(
:after_
update
)
@users_project
.
destroy
@users_project
.
destroy
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