BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
bbef8bb5
Commit
bbef8bb5
authored
Jun 08, 2013
by
Izaak Alpert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MR on fork validation error
Wasn't setting fields so validations would fail Change-Id: I0363c57bf6c8b9937cc1b4140d09071d7c5168c2
parent
216d5e2c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
17 deletions
+43
-17
merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+4
-2
_form.html.haml
app/views/projects/merge_requests/_form.html.haml
+14
-15
forked_merge_requests.feature
features/project/forked_merge_requests.feature
+8
-0
project_forked_merge_requests.rb
features/steps/project/project_forked_merge_requests.rb
+17
-0
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
bbef8bb5
...
...
@@ -70,7 +70,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request
.
reload_code
redirect_to
[
@merge_request
.
target_project
,
@merge_request
],
notice:
'Merge request was successfully created.'
else
render
"new"
@source_project
=
@merge_request
.
source_project
@target_project
=
@merge_request
.
target_project
render
action:
"new"
end
end
...
...
@@ -118,7 +120,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def
update_branches
@target_project
=
selected_target_project
@target_branches
=
(
@target_project
.
repository
.
branch_names
).
unshift
(
"Select branch"
)
@target_branches
=
@target_project
.
repository
.
branch_names
@target_branches
end
...
...
app/views/projects/merge_requests/_form.html.haml
View file @
bbef8bb5
...
...
@@ -64,21 +64,19 @@
:javascript
disableButtonIfEmptyField
(
"#merge_request_title"
,
".btn-save"
);
var
source_branch
=
$
(
"#merge_request_source_branch"
)
,
target_branch
=
$
(
"#merge_request_target_branch"
)
,
target_project
=
$
(
"#merge_request_target_project_id"
);
var
source_branch
=
$
(
"#merge_request_source_branch"
)
,
target_branch
=
$
(
"#merge_request_target_branch"
)
,
target_project
=
$
(
"#merge_request_target_project_id"
);
$
.
get
(
"
#{
branch_from_project_merge_requests_path
(
@source_project
)
}
"
,
{
ref
:
source_branch
.
val
()
});
$
.
get
(
"
#{
branch_to_project_merge_requests_path
(
@source_project
)
}
"
,
{
target_project_id
:
target_project
.
val
(),
ref
:
target_branch
.
val
()
});
target_project
.
live
(
"change"
,
function
()
{
$
.
get
(
"
#{
update_branches_project_merge_requests_path
(
@source_project
)
}
"
,
{
target_project_id
:
$
(
this
).
val
()
});
});
source_branch
.
live
(
"change"
,
function
()
{
$
.
get
(
"
#{
branch_from_project_merge_requests_path
(
@source_project
)
}
"
,
{
ref
:
$
(
this
).
val
()
});
});
target_branch
.
live
(
"change"
,
function
()
{
$
.
get
(
"
#{
branch_to_project_merge_requests_path
(
@source_project
)
}
"
,
{
target_project_id
:
target_project
.
val
(),
ref
:
$
(
this
).
val
()
});
});
$
.
get
(
"
#{
branch_from_project_merge_requests_path
(
@source_project
)
}
"
,
{
ref
:
source_branch
.
val
()
});
$
.
get
(
"
#{
branch_to_project_merge_requests_path
(
@source_project
)
}
"
,
{
target_project_id
:
target_project
.
val
(),
ref
:
target_branch
.
val
()
});
target_project
.
live
(
"change"
,
function
()
{
$
.
get
(
"
#{
update_branches_project_merge_requests_path
(
@source_project
)
}
"
,
{
target_project_id
:
$
(
this
).
val
()
});
});
source_branch
.
live
(
"change"
,
function
()
{
$
.
get
(
"
#{
branch_from_project_merge_requests_path
(
@source_project
)
}
"
,
{
ref
:
$
(
this
).
val
()
});
});
target_branch
.
live
(
"change"
,
function
()
{
$
.
get
(
"
#{
branch_to_project_merge_requests_path
(
@source_project
)
}
"
,
{
target_project_id
:
target_project
.
val
(),
ref
:
$
(
this
).
val
()
});
});
\ No newline at end of file
features/project/forked_merge_requests.feature
View file @
bbef8bb5
...
...
@@ -41,3 +41,10 @@ Feature: Project Forked Merge Requests
Then
I see the edit page prefilled for
"Merge Request On Forked Project"
@javascript
Scenario
:
I
cannot submit an invalid merge request
Given
I visit project
"Forked Shop"
merge requests page
And
I click link
"New Merge Request"
And
I fill out an invalid
"Merge Request On Forked Project"
merge request
And
I submit the merge request
Then
I should see validation errors
\ No newline at end of file
features/steps/project/project_forked_merge_requests.rb
View file @
bbef8bb5
...
...
@@ -152,6 +152,23 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
end
And
'I fill out an invalid "Merge Request On Forked Project" merge request'
do
#If this isn't filled in the rest of the validations won't be triggered
fill_in
"merge_request_title"
,
with:
"Merge Request On Forked Project"
find
(
:select
,
"merge_request_source_project_id"
,
{}).
value
.
should
==
@forked_project
.
id
.
to_s
find
(
:select
,
"merge_request_target_project_id"
,
{}).
value
.
should
==
@forked_project
.
id
.
to_s
find
(
:select
,
"merge_request_source_branch"
,
{}).
value
.
should
==
""
find
(
:select
,
"merge_request_target_branch"
,
{}).
value
.
should
==
""
end
Then
'I should see validation errors'
do
page
.
should
have_content
"Source branch can't be blank"
page
.
should
have_content
"Target branch can't be blank"
page
.
should
have_content
"Branch conflict You can not use same project/branch for source and target"
end
def
project
@project
||=
Project
.
find_by_name!
(
"Shop"
)
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