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
6d9f16c0
Commit
6d9f16c0
authored
Apr 11, 2018
by
blackst0ne
Committed by
Rémy Coutable
Apr 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace the `project/commits/branches.feature` spinach test with an rspec analog
parent
3efe1703
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
141 additions
and
107 deletions
+141
-107
changelogs/unreleased/blackst0ne-replace-spinach-project-commits-branches-feature.yml
...t0ne-replace-spinach-project-commits-branches-feature.yml
+5
-0
features/project/commits/branches.feature
features/project/commits/branches.feature
+0
-42
features/steps/project/commits/branches.rb
features/steps/project/commits/branches.rb
+0
-57
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+0
-8
spec/features/projects/branches/user_creates_branch_spec.rb
spec/features/projects/branches/user_creates_branch_spec.rb
+46
-0
spec/features/projects/branches/user_deletes_branch_spec.rb
spec/features/projects/branches/user_deletes_branch_spec.rb
+23
-0
spec/features/projects/branches/user_views_branches_spec.rb
spec/features/projects/branches/user_views_branches_spec.rb
+34
-0
spec/support/helpers/features/branches_helpers.rb
spec/support/helpers/features/branches_helpers.rb
+33
-0
No files found.
changelogs/unreleased/blackst0ne-replace-spinach-project-commits-branches-feature.yml
0 → 100644
View file @
6d9f16c0
---
title
:
"
Replace
the
`project/commits/branches.feature`
spinach
test
with
an
rspec
analog"
merge_request
:
18302
author
:
"
@blackst0ne"
type
:
other
features/project/commits/branches.feature
deleted
100644 → 0
View file @
3efe1703
@project_commits
Feature
:
Project Commits Branches
Background
:
Given
I sign in as a user
And
I own project
"Shop"
And
project
"Shop"
has protected branches
Scenario
:
I
can see project all git branches
Given
I visit project branches page
Then
I should see
"Shop"
all branches list
Scenario
:
I
can see project protected git branches
Given
I visit project protected branches page
Then
I should see
"Shop"
protected branches list
@javascript
Scenario
:
I
create a branch
Given
I visit project branches page
And
I click new branch link
And
I submit new branch form
Then
I should see new branch created
@javascript
Scenario
:
I
delete a branch
Given
I visit project branches page
And
I filter for branch improve/awesome
And
I click branch 'improve/awesome' delete link
Then
I should not see branch 'improve/awesome'
@javascript
Scenario
:
I
create a branch with invalid name
Given
I visit project branches page
And
I click new branch link
And
I submit new branch form with invalid name
Then
I should see new an error that branch is invalid
@javascript
Scenario
:
I
create a branch that already exists
Given
I visit project branches page
And
I click new branch link
And
I submit new branch form with branch that already exists
Then
I should see new an error that branch already exists
features/steps/project/commits/branches.rb
View file @
6d9f16c0
...
@@ -7,37 +7,14 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps
...
@@ -7,37 +7,14 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps
click_link
"All"
click_link
"All"
end
end
step
'I should see "Shop" all branches list'
do
expect
(
page
).
to
have_content
"Branches"
expect
(
page
).
to
have_content
"master"
end
step
'I click link "Protected"'
do
step
'I click link "Protected"'
do
click_link
"Protected"
click_link
"Protected"
end
end
step
'I should see "Shop" protected branches list'
do
page
.
within
".protected-branches-list"
do
expect
(
page
).
to
have_content
"stable"
expect
(
page
).
not_to
have_content
"master"
end
end
step
'project "Shop" has protected branches'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
create
(
:protected_branch
,
project:
project
,
name:
"stable"
)
end
step
'I click new branch link'
do
step
'I click new branch link'
do
click_link
"New branch"
click_link
"New branch"
end
end
step
'I submit new branch form'
do
fill_in
'branch_name'
,
with:
'deploy_keys'
select_branch
(
'master'
)
click_button
'Create branch'
end
step
'I submit new branch form with invalid name'
do
step
'I submit new branch form with invalid name'
do
fill_in
'branch_name'
,
with:
'1.0 stable'
fill_in
'branch_name'
,
with:
'1.0 stable'
page
.
find
(
"body"
).
click
# defocus the branch_name input
page
.
find
(
"body"
).
click
# defocus the branch_name input
...
@@ -45,40 +22,6 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps
...
@@ -45,40 +22,6 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps
click_button
'Create branch'
click_button
'Create branch'
end
end
step
'I submit new branch form with branch that already exists'
do
fill_in
'branch_name'
,
with:
'master'
select_branch
(
'master'
)
click_button
'Create branch'
end
step
'I should see new branch created'
do
expect
(
page
).
to
have_content
'deploy_keys'
end
step
'I should see new an error that branch is invalid'
do
expect
(
page
).
to
have_content
'Branch name is invalid'
expect
(
page
).
to
have_content
"can't contain spaces"
end
step
'I should see new an error that branch already exists'
do
expect
(
page
).
to
have_content
'Branch already exists'
end
step
'I filter for branch improve/awesome'
do
fill_in
'branch-search'
,
with:
'improve/awesome'
find
(
'#branch-search'
).
native
.
send_keys
(
:enter
)
end
step
"I click branch 'improve/awesome' delete link"
do
page
.
within
'.js-branch-improve\/awesome'
do
accept_alert
{
find
(
'.btn-remove'
).
click
}
end
end
step
"I should not see branch 'improve/awesome'"
do
expect
(
page
).
to
have_css
(
'.js-branch-improve\\/awesome'
,
visible: :hidden
)
end
def
select_branch
(
branch_name
)
def
select_branch
(
branch_name
)
find
(
'.git-revision-dropdown-toggle'
).
click
find
(
'.git-revision-dropdown-toggle'
).
click
...
...
features/steps/shared/paths.rb
View file @
6d9f16c0
...
@@ -276,14 +276,6 @@ module SharedPaths
...
@@ -276,14 +276,6 @@ module SharedPaths
visit
edit_project_path
(
project
)
visit
edit_project_path
(
project
)
end
end
step
'I visit project branches page'
do
visit
project_branches_path
(
@project
)
end
step
'I visit project protected branches page'
do
visit
project_protected_branches_path
(
@project
)
end
step
'I visit compare refs page'
do
step
'I visit compare refs page'
do
visit
project_compare_index_path
(
@project
)
visit
project_compare_index_path
(
@project
)
end
end
...
...
spec/features/projects/branches/user_creates_branch_spec.rb
0 → 100644
View file @
6d9f16c0
require
"spec_helper"
describe
"User creates branch"
,
:js
do
include
Spec
::
Support
::
Helpers
::
Features
::
BranchesHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
visit
(
new_project_branch_path
(
project
))
end
it
"creates new branch"
do
BRANCH_NAME
=
"deploy_keys"
.
freeze
create_branch
(
BRANCH_NAME
)
expect
(
page
).
to
have_content
(
BRANCH_NAME
)
end
context
"when branch name is invalid"
do
it
"does not create new branch"
do
INVALID_BRANCH_NAME
=
"1.0 stable"
.
freeze
fill_in
(
"branch_name"
,
with:
INVALID_BRANCH_NAME
)
page
.
find
(
"body"
).
click
# defocus the branch_name input
select_branch
(
"master"
)
click_button
(
"Create branch"
)
expect
(
page
).
to
have_content
(
"Branch name is invalid"
)
expect
(
page
).
to
have_content
(
"can't contain spaces"
)
end
end
context
"when branch name already exists"
do
it
"does not create new branch"
do
create_branch
(
"master"
)
expect
(
page
).
to
have_content
(
"Branch already exists"
)
end
end
end
spec/features/projects/branches/user_deletes_branch_spec.rb
0 → 100644
View file @
6d9f16c0
require
"spec_helper"
describe
"User deletes branch"
,
:js
do
set
(
:user
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
visit
(
project_branches_path
(
project
))
end
it
"deletes branch"
do
fill_in
(
"branch-search"
,
with:
"improve/awesome"
).
native
.
send_keys
(
:enter
)
page
.
within
(
".js-branch-improve
\\
/awesome"
)
do
accept_alert
{
find
(
".btn-remove"
).
click
}
end
expect
(
page
).
to
have_css
(
".js-branch-improve
\\
/awesome"
,
visible: :hidden
)
end
end
spec/features/projects/branches/user_views_branches_spec.rb
0 → 100644
View file @
6d9f16c0
require
"spec_helper"
describe
"User views branches"
do
set
(
:project
)
{
create
(
:project
,
:repository
)
}
set
(
:user
)
{
project
.
owner
}
before
do
sign_in
(
user
)
end
context
"all branches"
do
before
do
visit
(
project_branches_path
(
project
))
end
it
"shows branches"
do
expect
(
page
).
to
have_content
(
"Branches"
).
and
have_content
(
"master"
)
end
end
context
"protected branches"
do
set
(
:protected_branch
)
{
create
(
:protected_branch
,
project:
project
)
}
before
do
visit
(
project_protected_branches_path
(
project
))
end
it
"shows branches"
do
page
.
within
(
".protected-branches-list"
)
do
expect
(
page
).
to
have_content
(
protected_branch
.
name
).
and
have_no_content
(
"master"
)
end
end
end
end
spec/support/helpers/features/branches_helpers.rb
0 → 100644
View file @
6d9f16c0
# These helpers allow you to manipulate with sorting features.
#
# Usage:
# describe "..." do
# include Spec::Support::Helpers::Features::BranchesHelpers
# ...
#
# create_branch("feature")
# select_branch("master")
#
module
Spec
module
Support
module
Helpers
module
Features
module
BranchesHelpers
def
create_branch
(
branch_name
,
source_branch_name
=
"master"
)
fill_in
(
"branch_name"
,
with:
branch_name
)
select_branch
(
source_branch_name
)
click_button
(
"Create branch"
)
end
def
select_branch
(
branch_name
)
find
(
".git-revision-dropdown-toggle"
).
click
page
.
within
(
"#new-branch-form .dropdown-menu"
)
do
click_link
(
branch_name
)
end
end
end
end
end
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