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
435a4698
Commit
435a4698
authored
May 15, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move shared examples to their correct place and create new helpers
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
f37b0081
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
27 deletions
+25
-27
spec/features/projects/branches_spec.rb
spec/features/projects/branches_spec.rb
+2
-6
spec/features/protected_branches_spec.rb
spec/features/protected_branches_spec.rb
+2
-18
spec/support/protected_branch_helpers.rb
spec/support/protected_branch_helpers.rb
+18
-0
spec/support/shared_examples/features/protected_branches_access_control_ce_spec.rb
...les/features/protected_branches_access_control_ce_spec.rb
+2
-2
spec/support/shared_examples/features/protected_branches_access_control_ee_spec.rb
...les/features/protected_branches_access_control_ee_spec.rb
+1
-1
No files found.
spec/features/projects/branches_spec.rb
View file @
435a4698
require
'spec_helper'
describe
'Branches'
,
feature:
true
do
include
ProtectedBranchHelpers
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:repository
)
{
project
.
repository
}
def
set_protected_branch_name
(
branch_name
)
find
(
".js-protected-branch-select"
).
click
find
(
".dropdown-input-field"
).
set
(
branch_name
)
click_on
(
"Create wildcard
#{
branch_name
}
"
)
end
context
'logged in as developer'
do
before
do
login_as
:user
...
...
spec/features/protected_branches_spec.rb
View file @
435a4698
require
'spec_helper'
Dir
[
"./spec/features/protected_branches/*.rb"
].
sort
.
each
{
|
f
|
require
f
}
feature
'Projected Branches'
,
feature:
true
,
js:
true
do
include
ProtectedBranchHelpers
let
(
:user
)
{
create
(
:user
,
:admin
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
before
{
login_as
(
user
)
}
def
set_allowed_to
(
operation
,
option
=
'Masters'
,
form:
'#new_protected_branch'
)
within
form
do
find
(
".js-allowed-to-
#{
operation
}
"
).
trigger
(
'click'
)
wait_for_ajax
Array
(
option
).
each
{
|
opt
|
click_on
(
opt
)
}
find
(
".js-allowed-to-
#{
operation
}
"
).
trigger
(
'click'
)
# needed to submit form in some cases
end
end
def
set_protected_branch_name
(
branch_name
)
find
(
".js-protected-branch-select"
).
trigger
(
'click'
)
find
(
".dropdown-input-field"
).
set
(
branch_name
)
click_on
(
"Create wildcard
#{
branch_name
}
"
)
end
describe
"explicit protected branches"
do
it
"allows creating explicit protected branches"
do
visit
namespace_project_protected_branches_path
(
project
.
namespace
,
project
)
...
...
spec/support/protected_branch_helpers.rb
0 → 100644
View file @
435a4698
module
ProtectedBranchHelpers
def
set_allowed_to
(
operation
,
option
=
'Masters'
,
form:
'#new_protected_branch'
)
within
form
do
find
(
".js-allowed-to-
#{
operation
}
"
).
trigger
(
'click'
)
wait_for_ajax
Array
(
option
).
each
{
|
opt
|
click_on
(
opt
)
}
find
(
".js-allowed-to-
#{
operation
}
"
).
trigger
(
'click'
)
# needed to submit form in some cases
end
end
def
set_protected_branch_name
(
branch_name
)
find
(
".js-protected-branch-select"
).
trigger
(
'click'
)
find
(
".dropdown-input-field"
).
set
(
branch_name
)
click_on
(
"Create wildcard
#{
branch_name
}
"
)
end
end
spec/
features/protected_branches/
access_control_ce_spec.rb
→
spec/
support/shared_examples/features/protected_branches_
access_control_ce_spec.rb
View file @
435a4698
RSpec
.
shared_examples
"protected branches > access control > CE"
do
shared_examples
"protected branches > access control > CE"
do
ProtectedBranch
::
PushAccessLevel
.
human_access_levels
.
each
do
|
(
access_type_id
,
access_type_name
)
|
it
"allows creating protected branches that
#{
access_type_name
}
can push to"
do
visit
namespace_project_protected_branches_path
(
project
.
namespace
,
project
)
...
...
spec/
features/protected_branches/
access_control_ee_spec.rb
→
spec/
support/shared_examples/features/protected_branches_
access_control_ee_spec.rb
View file @
435a4698
RSpec
.
shared_examples
"protected branches > access control > EE"
do
shared_examples
"protected branches > access control > EE"
do
[[
'merge'
,
ProtectedBranch
::
MergeAccessLevel
],
[
'push'
,
ProtectedBranch
::
PushAccessLevel
]].
each
do
|
git_operation
,
access_level_class
|
# Need to set a default for the `git_operation` access level that _isn't_ being tested
other_git_operation
=
git_operation
==
'merge'
?
'push'
:
'merge'
...
...
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