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
c5d0a7b9
Commit
c5d0a7b9
authored
Jun 05, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature spec for Geo clone icon
parent
070792a7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
0 deletions
+81
-0
spec/features/projects/ee/geo_clone_instructions_spec.rb
spec/features/projects/ee/geo_clone_instructions_spec.rb
+81
-0
No files found.
spec/features/projects/ee/geo_clone_instructions_spec.rb
0 → 100644
View file @
c5d0a7b9
require
'rails_helper'
feature
'Geo clone instructions'
,
feature:
true
,
js:
true
do
include
Devise
::
Test
::
IntegrationHelpers
let
(
:project
)
{
create
(
:empty_project
,
:empty_repo
)
}
let
(
:developer
)
{
create
(
:user
)
}
background
do
primary
=
create
(
:geo_node
,
:primary
,
schema:
'https'
,
host:
'primary.domain.com'
,
port:
443
)
primary
.
update_attribute
(
:clone_url_prefix
,
'git@primary.domain.com:'
)
create
(
:geo_node
,
:current
)
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary?
).
and_return
(
true
)
project
.
team
<<
[
developer
,
:developer
]
sign_in
(
developer
)
end
context
'with an SSH key'
do
background
do
create
(
:personal_key
,
user:
developer
)
end
scenario
'defaults to SSH'
do
visit_project
show_geo_clone_instructions
expect_instructions_for
(
'ssh'
)
end
scenario
'switches to HTTP'
do
visit_project
select_protocol
(
'HTTP'
)
show_geo_clone_instructions
expect_instructions_for
(
'http'
)
end
end
def
visit_project
visit
namespace_project_path
(
project
.
namespace
,
project
)
end
def
select_protocol
(
protocol
)
find
(
'#clone-dropdown'
).
click
find
(
".
#{
protocol
.
downcase
}
-selector"
).
click
end
def
show_geo_clone_instructions
find
(
'.btn-geo'
).
click
end
def
expect_instructions_for
(
protocol
)
primary_remote
=
primary_url
(
protocol
)
secondary_remote
=
secondary_url
(
protocol
)
expect
(
page
).
to
have_content
(
'How to work faster with Geo'
)
expect
(
page
).
to
have_content
(
"git clone
#{
secondary_remote
}
"
)
expect
(
page
).
to
have_content
(
"git remote set-url --push origin
#{
primary_remote
}
"
)
end
def
primary_url
(
protocol
)
case
protocol
when
'ssh'
'git@primary.domain.com:'
when
'http'
'https://primary.domain.com'
end
end
def
secondary_url
(
protocol
)
case
protocol
when
'ssh'
project
.
ssh_url_to_repo
when
'http'
project
.
http_url_to_repo
(
developer
)
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