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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
c51eb666
Commit
c51eb666
authored
Jan 11, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature specs for squashing MRs
parent
5890b992
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
1 deletion
+109
-1
spec/features/merge_requests/squash_spec.rb
spec/features/merge_requests/squash_spec.rb
+107
-0
spec/support/test_env.rb
spec/support/test_env.rb
+2
-1
No files found.
spec/features/merge_requests/squash_spec.rb
0 → 100644
View file @
c51eb666
require
'spec_helper'
feature
'Squashing merge requests'
,
js:
true
,
feature:
true
do
include
WaitForAjax
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:source_branch
)
{
'csv'
}
let!
(
:original_head
)
{
project
.
repository
.
commit
(
'master'
)
}
shared_examples
'squash'
do
it
'squashes the commits into a single commit, and adds a merge commit'
do
latest_master_commits
=
project
.
repository
.
commits_between
(
original_head
.
sha
,
'master'
).
map
(
&
:raw
)
last_mr_commit
=
project
.
repository
.
commit
(
source_branch
)
squash_commit
=
an_object_having_attributes
(
sha:
a_string_matching
(
/\h{40}/
),
message:
"
#{
last_mr_commit
.
message
}
\n
"
,
author_name:
last_mr_commit
.
author_name
,
committer_name:
user
.
name
)
merge_commit
=
an_object_having_attributes
(
sha:
a_string_matching
(
/\h{40}/
),
message:
a_string_starting_with
(
"Merge branch 'csv' into 'master'"
),
author_name:
user
.
name
,
committer_name:
user
.
name
)
expect
(
project
.
repository
).
not_to
be_merged_to_root_ref
(
source_branch
)
expect
(
latest_master_commits
).
to
match
([
squash_commit
,
merge_commit
])
end
end
shared_examples
'no squash'
do
it
'accepts the merge request without squashing'
do
expect
(
project
.
repository
).
to
be_merged_to_root_ref
(
source_branch
)
end
end
def
accept_mr
click_on
'Accept Merge Request'
wait_for_ajax
end
before
do
project
.
team
<<
[
user
,
:master
]
login_as
user
end
context
'when squash is enabled on merge request creation'
do
before
do
visit
new_namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request:
{
source_branch:
source_branch
})
check
'merge_request[squash]'
click_on
'Submit merge request'
wait_for_ajax
end
it
'shows the squash checkbox as checked'
do
expect
(
page
).
to
have_checked_field
(
'squash'
)
end
context
'when accepting with squash checked'
do
before
do
accept_mr
end
include_examples
'squash'
end
context
'when accepting and unchecking squash'
do
before
do
uncheck
'squash'
accept_mr
end
include_examples
'no squash'
end
end
context
'when squash is not enabled on merge request creation'
do
before
do
visit
new_namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request:
{
source_branch:
source_branch
})
click_on
'Submit merge request'
wait_for_ajax
end
it
'shows the squash checkbox as unchecked'
do
expect
(
page
).
to
have_unchecked_field
(
'squash'
)
end
context
'when accepting and checking squash'
do
before
do
check
'squash'
accept_mr
end
include_examples
'squash'
end
context
'when accepting with squash unchecked'
do
before
do
accept_mr
end
include_examples
'no squash'
end
end
end
spec/support/test_env.rb
View file @
c51eb666
...
...
@@ -37,7 +37,8 @@ module TestEnv
'conflict-non-utf8'
=>
'd0a293c'
,
'conflict-too-large'
=>
'39fa04f'
,
'deleted-image-test'
=>
'6c17798'
,
'wip'
=>
'b9238ee'
'wip'
=>
'b9238ee'
,
'csv'
=>
'3dd0896'
}
# gitlab-test-fork is a fork of gitlab-fork, but we don't necessarily
...
...
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