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
3cb98379
Commit
3cb98379
authored
May 08, 2018
by
blackst0ne
Committed by
Robert Speicher
May 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace the `project/ff_merge_requests.feature` spinach test with an rspec analog
parent
ee9d4386
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
87 additions
and
133 deletions
+87
-133
changelogs/unreleased/blackst0ne-replace-spinach-project-ff-merge-requests-feature.yml
...0ne-replace-spinach-project-ff-merge-requests-feature.yml
+5
-0
features/project/ff_merge_requests.feature
features/project/ff_merge_requests.feature
+0
-41
features/steps/project/ff_merge_requests.rb
features/steps/project/ff_merge_requests.rb
+0
-87
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+0
-5
spec/factories/merge_requests.rb
spec/factories/merge_requests.rb
+5
-0
spec/features/projects/merge_requests/user_merges_merge_request_spec.rb
...projects/merge_requests/user_merges_merge_request_spec.rb
+43
-0
spec/features/projects/merge_requests/user_rebases_merge_request_spec.rb
...rojects/merge_requests/user_rebases_merge_request_spec.rb
+34
-0
No files found.
changelogs/unreleased/blackst0ne-replace-spinach-project-ff-merge-requests-feature.yml
0 → 100644
View file @
3cb98379
---
title
:
'
Replace
the
`project/ff_merge_requests.feature`
spinach
test
with
an
rspec
analog'
merge_request
:
18800
author
:
'
@blackst0ne'
type
:
other
features/project/ff_merge_requests.feature
deleted
100644 → 0
View file @
ee9d4386
Feature
:
Project Ff Merge Requests
Background
:
Given
I sign in as a user
And
I own project
"Shop"
And
project
"Shop"
have
"Bug NS-05"
open merge request with diffs inside
And
merge request
"Bug NS-05"
is mergeable
@javascript
Scenario
:
I
do ff-only merge for rebased branch
Given
ff merge enabled
And
merge request
"Bug NS-05"
is rebased
When
I visit merge request page
"Bug NS-05"
Then
I should see ff-only merge button
When
I accept this merge request
Then
I should see merged request
@javascript
Scenario
:
I
do ff-only merge for merged branch
Given
ff merge enabled
And
merge request
"Bug NS-05"
merged target
When
I visit merge request page
"Bug NS-05"
Then
I should see ff-only merge button
When
I accept this merge request
Then
I should see merged request
@javascript
Scenario
:
I
do rebase before ff-only merge
Given
ff merge enabled
And
rebase before merge enabled
When
I visit merge request page
"Bug NS-05"
Then
I should see rebase button
When
I press rebase button
Then
I should see rebase in progress message
@javascript
Scenario
:
I
do rebase before regular merge
Given
rebase before merge enabled
When
I visit merge request page
"Bug NS-05"
Then
I should see rebase button
When
I press rebase button
Then
I should see rebase in progress message
features/steps/project/ff_merge_requests.rb
deleted
100644 → 0
View file @
ee9d4386
class
Spinach::Features::ProjectFfMergeRequests
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedIssuable
include
SharedProject
include
SharedNote
include
SharedPaths
include
SharedMarkdown
include
SharedDiffNote
include
SharedUser
include
WaitForRequests
step
'project "Shop" have "Bug NS-05" open merge request with diffs inside'
do
create
(
:merge_request_with_diffs
,
title:
"Bug NS-05"
,
source_project:
project
,
target_project:
project
,
author:
project
.
users
.
first
)
end
step
'merge request is mergeable'
do
expect
(
page
).
to
have_button
'Merge'
end
step
'I should see ff-only merge button'
do
expect
(
page
).
to
have_content
"Fast-forward merge without a merge commit"
expect
(
page
).
to
have_button
'Merge'
end
step
'merge request "Bug NS-05" is mergeable'
do
merge_request
.
mark_as_mergeable
end
step
'I accept this merge request'
do
page
.
within
'.mr-state-widget'
do
click_button
"Merge"
end
end
step
'I should see merged request'
do
page
.
within
'.status-box'
do
expect
(
page
).
to
have_content
"Merged"
wait_for_requests
end
end
step
'ff merge enabled'
do
project
=
merge_request
.
target_project
project
.
merge_requests_ff_only_enabled
=
true
project
.
save!
end
step
'I should see rebase button'
do
expect
(
page
).
to
have_button
"Rebase"
end
step
'merge request "Bug NS-05" is rebased'
do
merge_request
.
source_branch
=
'flatten-dir'
merge_request
.
target_branch
=
'improve/awesome'
merge_request
.
reload_diff
merge_request
.
save!
end
step
'merge request "Bug NS-05" merged target'
do
merge_request
.
source_branch
=
'merged-target'
merge_request
.
target_branch
=
'improve/awesome'
merge_request
.
reload_diff
merge_request
.
save!
end
step
'rebase before merge enabled'
do
project
=
merge_request
.
target_project
project
.
merge_requests_rebase_enabled
=
true
project
.
save!
end
step
'I press rebase button'
do
click_button
"Rebase"
end
step
"I should see rebase in progress message"
do
expect
(
page
).
to
have_content
(
"Rebase in progress"
)
end
def
merge_request
@merge_request
||=
MergeRequest
.
find_by!
(
title:
"Bug NS-05"
)
end
end
features/steps/shared/paths.rb
View file @
3cb98379
...
@@ -336,11 +336,6 @@ module SharedPaths
...
@@ -336,11 +336,6 @@ module SharedPaths
wait_for_requests
wait_for_requests
end
end
step
'I visit merge request page "Bug NS-05"'
do
visit
merge_request_path
(
"Bug NS-05"
)
wait_for_requests
end
step
'I visit merge request page "Bug NS-07"'
do
step
'I visit merge request page "Bug NS-07"'
do
visit
merge_request_path
(
"Bug NS-07"
)
visit
merge_request_path
(
"Bug NS-07"
)
wait_for_requests
wait_for_requests
...
...
spec/factories/merge_requests.rb
View file @
3cb98379
...
@@ -41,6 +41,11 @@ FactoryBot.define do
...
@@ -41,6 +41,11 @@ FactoryBot.define do
state
:merged
state
:merged
end
end
trait
:merged_target
do
source_branch
"merged-target"
target_branch
"improve/awesome"
end
trait
:closed
do
trait
:closed
do
state
:closed
state
:closed
end
end
...
...
spec/features/projects/merge_requests/user_merges_merge_request_spec.rb
0 → 100644
View file @
3cb98379
require
"spec_helper"
describe
"User merges a merge request"
,
:js
do
let
(
:user
)
{
project
.
owner
}
before
do
sign_in
(
user
)
end
shared_examples
"fast forward merge a merge request"
do
it
"merges a merge request"
do
expect
(
page
).
to
have_content
(
"Fast-forward merge without a merge commit"
).
and
have_button
(
"Merge"
)
page
.
within
(
".mr-state-widget"
)
do
click_button
(
"Merge"
)
end
page
.
within
(
".status-box"
)
do
expect
(
page
).
to
have_content
(
"Merged"
)
end
end
end
context
"ff-only merge"
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
,
merge_requests_ff_only_enabled:
true
)
}
before
do
visit
(
merge_request_path
(
merge_request
))
end
context
"when branch is rebased"
do
let!
(
:merge_request
)
{
create
(
:merge_request
,
:rebased
,
source_project:
project
)
}
it_behaves_like
"fast forward merge a merge request"
end
context
"when branch is merged"
do
let!
(
:merge_request
)
{
create
(
:merge_request
,
:merged_target
,
source_project:
project
)
}
it_behaves_like
"fast forward merge a merge request"
end
end
end
spec/features/projects/merge_requests/user_rebases_merge_request_spec.rb
0 → 100644
View file @
3cb98379
require
"spec_helper"
describe
"User rebases a merge request"
,
:js
do
let
(
:merge_request
)
{
create
(
:merge_request
,
:simple
,
source_project:
project
)
}
let
(
:user
)
{
project
.
owner
}
before
do
sign_in
(
user
)
end
shared_examples
"rebases"
do
it
"rebases"
do
visit
(
merge_request_path
(
merge_request
))
expect
(
page
).
to
have_button
(
"Rebase"
)
click_button
(
"Rebase"
)
expect
(
page
).
to
have_content
(
"Rebase in progress"
)
end
end
context
"when merge is regular"
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
,
merge_requests_rebase_enabled:
true
)
}
it_behaves_like
"rebases"
end
context
"when merge is ff-only"
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
,
merge_requests_ff_only_enabled:
true
)
}
it_behaves_like
"rebases"
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