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
9b6224f9
Commit
9b6224f9
authored
Apr 03, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More test fixes
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
e1dd76d5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
14 deletions
+11
-14
app/services/merge_requests/create_service.rb
app/services/merge_requests/create_service.rb
+1
-0
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+8
-12
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+2
-2
No files found.
app/services/merge_requests/create_service.rb
View file @
9b6224f9
...
@@ -3,6 +3,7 @@ module MergeRequests
...
@@ -3,6 +3,7 @@ module MergeRequests
def
execute
def
execute
merge_request
=
MergeRequest
.
new
(
params
)
merge_request
=
MergeRequest
.
new
(
params
)
merge_request
.
source_project
=
project
merge_request
.
source_project
=
project
merge_request
.
target_project
||=
project
merge_request
.
author
=
current_user
merge_request
.
author
=
current_user
if
merge_request
.
save
if
merge_request
.
save
...
...
spec/requests/api/merge_requests_spec.rb
View file @
9b6224f9
...
@@ -6,7 +6,7 @@ describe API::API do
...
@@ -6,7 +6,7 @@ describe API::API do
after
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
disable
(
:user_observer
)
}
after
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
disable
(
:user_observer
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Test"
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
:simple
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Test"
)
}
let!
(
:note
)
{
create
(
:note_on_merge_request
,
author:
user
,
project:
project
,
noteable:
merge_request
,
note:
"a comment on a MR"
)
}
let!
(
:note
)
{
create
(
:note_on_merge_request
,
author:
user
,
project:
project
,
noteable:
merge_request
,
note:
"a comment on a MR"
)
}
before
{
before
{
project
.
team
<<
[
user
,
:reporters
]
project
.
team
<<
[
user
,
:reporters
]
...
@@ -79,16 +79,12 @@ describe API::API do
...
@@ -79,16 +79,12 @@ describe API::API do
end
end
context
'forked projects'
do
context
'forked projects'
do
let!
(
:user2
)
{
create
(
:user
)}
let!
(
:user2
)
{
create
(
:user
)
}
let!
(
:forked_project_link
)
{
build
(
:forked_project_link
)
}
let!
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
,
namespace:
user2
.
namespace
,
creator_id:
user2
.
id
)
}
let!
(
:fork_project
)
{
create
(
:project
,
forked_project_link:
forked_project_link
,
namespace:
user2
.
namespace
,
creator_id:
user2
.
id
)
}
let!
(
:unrelated_project
)
{
create
(
:project
,
namespace:
create
(
:user
).
namespace
,
creator_id:
user2
.
id
)
}
let!
(
:unrelated_project
)
{
create
(
:project
,
namespace:
create
(
:user
).
namespace
,
creator_id:
user2
.
id
)
}
before
:each
do
|
each
|
before
:each
do
|
each
|
fork_project
.
team
<<
[
user2
,
:reporters
]
fork_project
.
team
<<
[
user2
,
:reporters
]
forked_project_link
.
forked_from_project
=
project
forked_project_link
.
forked_to_project
=
fork_project
forked_project_link
.
save!
end
end
it
"should return merge_request"
do
it
"should return merge_request"
do
...
@@ -127,16 +123,16 @@ describe API::API do
...
@@ -127,16 +123,16 @@ describe API::API do
response
.
status
.
should
==
400
response
.
status
.
should
==
400
end
end
it
"should return 40
0
when target_branch is specified and not a forked project"
do
it
"should return 40
4
when target_branch is specified and not a forked project"
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
title:
'Test merge_request'
,
target_branch:
'master'
,
source_branch:
'stable'
,
author:
user
,
target_project_id:
fork_project
.
id
title:
'Test merge_request'
,
target_branch:
'master'
,
source_branch:
'stable'
,
author:
user
,
target_project_id:
fork_project
.
id
response
.
status
.
should
==
40
0
response
.
status
.
should
==
40
4
end
end
it
"should return 40
0
when target_branch is specified and for a different fork"
do
it
"should return 40
4
when target_branch is specified and for a different fork"
do
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
title:
'Test merge_request'
,
target_branch:
'master'
,
source_branch:
'stable'
,
author:
user2
,
target_project_id:
unrelated_project
.
id
title:
'Test merge_request'
,
target_branch:
'master'
,
source_branch:
'stable'
,
author:
user2
,
target_project_id:
unrelated_project
.
id
response
.
status
.
should
==
40
0
response
.
status
.
should
==
40
4
end
end
it
"should return 201 when target_branch is specified and for the same project"
do
it
"should return 201 when target_branch is specified and for the same project"
do
...
...
spec/services/notification_service_spec.rb
View file @
9b6224f9
...
@@ -5,7 +5,7 @@ describe NotificationService do
...
@@ -5,7 +5,7 @@ describe NotificationService do
describe
'Keys'
do
describe
'Keys'
do
describe
:new_key
do
describe
:new_key
do
let
(
:key
)
{
create
(
:personal_key
)
}
let
!
(
:key
)
{
create
(
:personal_key
)
}
it
{
notification
.
new_key
(
key
).
should
be_true
}
it
{
notification
.
new_key
(
key
).
should
be_true
}
...
@@ -18,7 +18,7 @@ describe NotificationService do
...
@@ -18,7 +18,7 @@ describe NotificationService do
describe
'Email'
do
describe
'Email'
do
describe
:new_email
do
describe
:new_email
do
let
(
:email
)
{
create
(
:email
)
}
let
!
(
:email
)
{
create
(
:email
)
}
it
{
notification
.
new_email
(
email
).
should
be_true
}
it
{
notification
.
new_email
(
email
).
should
be_true
}
...
...
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