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
a0d5b5ad
Commit
a0d5b5ad
authored
Nov 28, 2018
by
Luke Bennett
Committed by
Douglas Barbosa Alexandre
Dec 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for "only mirror protected branches" setting
parent
0566bbd0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
8 deletions
+50
-8
app/views/projects/mirrors/_mirror_repos.html.haml
app/views/projects/mirrors/_mirror_repos.html.haml
+1
-1
spec/features/projects/settings/repository_settings_spec.rb
spec/features/projects/settings/repository_settings_spec.rb
+49
-7
No files found.
app/views/projects/mirrors/_mirror_repos.html.haml
View file @
a0d5b5ad
...
...
@@ -32,7 +32,7 @@
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'user/project/protected_branches'
)
.panel-footer
=
f
.
submit
_
(
'Mirror repository'
),
class:
'btn btn-success'
,
name: :update_remote_mirror
=
f
.
submit
_
(
'Mirror repository'
),
class:
'btn btn-success
js-mirror-submit
'
,
name: :update_remote_mirror
.panel.panel-default
.table-responsive
...
...
spec/features/projects/settings/repository_settings_spec.rb
View file @
a0d5b5ad
...
...
@@ -133,19 +133,50 @@ describe 'Projects > Settings > Repository settings' do
expect
(
page
).
to
have_selector
(
'#mirror_direction'
)
end
it
'generates an SSH public key on submission'
,
:js
do
it
'creates a push mirror that mirrors all branches'
,
:js
do
expect
(
find
(
'.js-mirror-protected-hidden'
,
visible:
false
).
value
).
to
eq
(
'0'
)
fill_in
'url'
,
with:
'ssh://user@localhost/project.git'
select
'SSH public key'
,
from:
'Authentication method'
direction_select
=
find
(
'#mirror_direction'
)
select_direction
# In CE, this select box is disabled, but in EE, it is enabled
if
direction_select
.
disabled?
expect
(
direction_select
.
value
).
to
eq
(
'push'
)
else
direction_select
.
select
(
'Push'
)
Sidekiq
::
Testing
.
fake!
do
click_button
'Mirror repository'
end
project
.
reload
expect
(
page
).
to
have_content
(
'Mirroring settings were successfully updated'
)
expect
(
project
.
remote_mirrors
.
first
.
only_protected_branches
).
to
eq
(
false
)
end
it
'creates a push mirror that only mirrors protected branches'
,
:js
do
find
(
'#only_protected_branches'
).
click
expect
(
find
(
'.js-mirror-protected-hidden'
,
visible:
false
).
value
).
to
eq
(
'1'
)
fill_in
'url'
,
with:
'ssh://user@localhost/project.git'
select
'SSH public key'
,
from:
'Authentication method'
select_direction
Sidekiq
::
Testing
.
fake!
do
click_button
'Mirror repository'
end
project
.
reload
expect
(
page
).
to
have_content
(
'Mirroring settings were successfully updated'
)
expect
(
project
.
remote_mirrors
.
first
.
only_protected_branches
).
to
eq
(
true
)
end
it
'generates an SSH public key on submission'
,
:js
do
fill_in
'url'
,
with:
'ssh://user@localhost/project.git'
select
'SSH public key'
,
from:
'Authentication method'
select_direction
Sidekiq
::
Testing
.
fake!
do
click_button
'Mirror repository'
end
...
...
@@ -153,6 +184,17 @@ describe 'Projects > Settings > Repository settings' do
expect
(
page
).
to
have_content
(
'Mirroring settings were successfully updated'
)
expect
(
page
).
to
have_selector
(
'[title="Copy SSH public key"]'
)
end
def
select_direction
(
direction
=
'push'
)
direction_select
=
find
(
'#mirror_direction'
)
# In CE, this select box is disabled, but in EE, it is enabled
if
direction_select
.
disabled?
expect
(
direction_select
.
value
).
to
eq
(
direction
)
else
direction_select
.
select
(
direction
.
capitalize
)
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