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
67896ea9
Commit
67896ea9
authored
Jan 02, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed missing current user for issue observer
parent
6a9e7dc5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
25 deletions
+25
-25
lib/api/issues.rb
lib/api/issues.rb
+1
-0
spec/observers/users_project_observer_spec.rb
spec/observers/users_project_observer_spec.rb
+23
-24
spec/requests/atom/issues_spec.rb
spec/requests/atom/issues_spec.rb
+1
-1
No files found.
lib/api/issues.rb
View file @
67896ea9
...
@@ -78,6 +78,7 @@ module Gitlab
...
@@ -78,6 +78,7 @@ module Gitlab
attrs
=
attributes_for_keys
[
:title
,
:description
,
:assignee_id
,
:milestone_id
,
:closed
]
attrs
=
attributes_for_keys
[
:title
,
:description
,
:assignee_id
,
:milestone_id
,
:closed
]
attrs
[
:label_list
]
=
params
[
:labels
]
if
params
[
:labels
].
present?
attrs
[
:label_list
]
=
params
[
:labels
]
if
params
[
:labels
].
present?
IssueObserver
.
current_user
=
current_user
if
@issue
.
update_attributes
attrs
if
@issue
.
update_attributes
attrs
present
@issue
,
with:
Entities
::
Issue
present
@issue
,
with:
Entities
::
Issue
else
else
...
...
spec/observers/users_project_observer_spec.rb
View file @
67896ea9
...
@@ -3,63 +3,62 @@ require 'spec_helper'
...
@@ -3,63 +3,62 @@ require 'spec_helper'
describe
UsersProjectObserver
do
describe
UsersProjectObserver
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:users_project
)
{
create
(
:users_project
,
project:
project
,
user:
user
)}
subject
{
UsersProjectObserver
.
instance
}
subject
{
UsersProjectObserver
.
instance
}
describe
"#after_commit"
do
describe
"#after_commit"
do
it
"should called when UsersProject created"
do
it
"should called when UsersProject created"
do
subject
.
should_receive
(
:after_commit
)
.
once
subject
.
should_receive
(
:after_commit
)
create
(
:users_project
)
create
(
:users_project
)
end
end
it
"should send email to user"
do
it
"should send email to user"
do
Notify
.
should_receive
(
:project_access_granted_email
).
with
(
users_project
.
id
).
and_return
(
double
(
deliver:
true
))
Notify
.
should_receive
(
:project_access_granted_email
).
and_return
(
double
(
deliver:
true
))
subject
.
after_commit
(
users_project
)
Event
.
stub
(
:create
=>
true
)
Event
.
stub
(
:create
=>
true
)
create
(
:users_project
)
end
end
it
"should create new event"
do
it
"should create new event"
do
Event
.
should_receive
(
:create
).
with
(
Event
.
should_receive
(
:create
)
project_id:
users_project
.
project
.
id
,
action:
Event
::
Joined
,
author_id:
users_project
.
user
.
id
)
subject
.
after_create
(
users_project
)
create
(
:
users_project
)
end
end
end
end
describe
"#after_update"
do
describe
"#after_update"
do
before
do
@users_project
=
create
:users_project
end
it
"should called when UsersProject updated"
do
it
"should called when UsersProject updated"
do
subject
.
should_receive
(
:after_commit
)
.
once
subject
.
should_receive
(
:after_commit
)
create
(
:users_project
)
.
update_attribute
(
:project_access
,
UsersProject
::
MASTER
)
@users_project
.
update_attribute
(
:project_access
,
UsersProject
::
MASTER
)
end
end
it
"should send email to user"
do
it
"should send email to user"
do
Notify
.
should_receive
(
:project_access_granted_email
)
.
with
(
users_project
.
id
).
and_return
(
double
(
deliver:
true
))
Notify
.
should_receive
(
:project_access_granted_email
)
subject
.
after_commit
(
users_project
)
@users_project
.
update_attribute
(
:project_access
,
UsersProject
::
MASTER
)
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_commit
)
users_project
.
destroy
@
users_project
.
destroy
end
end
end
end
describe
"#after_destroy"
do
describe
"#after_destroy"
do
before
do
@users_project
=
create
:users_project
end
it
"should called when UsersProject destroyed"
do
it
"should called when UsersProject destroyed"
do
subject
.
should_receive
(
:after_destroy
)
subject
.
should_receive
(
:after_destroy
)
create
(
:users_project
)
.
destroy
@users_project
.
destroy
end
end
it
"should create new event"
do
it
"should create new event"
do
Event
.
should_receive
(
:create
).
with
(
Event
.
should_receive
(
:create
)
project_id:
users_project
.
project
.
id
,
@users_project
.
destroy
action:
Event
::
Left
,
author_id:
users_project
.
user
.
id
)
subject
.
after_destroy
(
users_project
)
end
end
end
end
end
end
spec/requests/atom/issues_spec.rb
View file @
67896ea9
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
"Issues Feed"
do
describe
"Issues Feed"
do
describe
"GET /issues"
do
describe
"GET /issues"
do
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
owner:
user
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let!
(
:issue
)
{
create
(
:issue
,
author:
user
,
project:
project
)
}
let!
(
:issue
)
{
create
(
:issue
,
author:
user
,
project:
project
)
}
before
{
project
.
add_access
(
user
,
:read
,
:write
)
}
before
{
project
.
add_access
(
user
,
:read
,
:write
)
}
...
...
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