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
f18ec707
Commit
f18ec707
authored
May 04, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport changes from gitlab-org/gitlab-ee!372
Mostly replaces several Spinach tests with RSpec Feature tests.
parent
fad7b392
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
80 additions
and
48 deletions
+80
-48
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+2
-1
features/project/create.feature
features/project/create.feature
+2
-14
features/steps/project/create.rb
features/steps/project/create.rb
+1
-25
spec/factories/projects.rb
spec/factories/projects.rb
+7
-3
spec/features/projects/developer_views_empty_project_instructions_spec.rb
...ojects/developer_views_empty_project_instructions_spec.rb
+63
-0
spec/helpers/projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+5
-5
No files found.
app/helpers/projects_helper.rb
View file @
f18ec707
...
...
@@ -209,7 +209,8 @@ module ProjectsHelper
end
def
default_url_to_repo
(
project
=
@project
)
if
default_clone_protocol
==
"ssh"
case
default_clone_protocol
when
'ssh'
project
.
ssh_url_to_repo
else
project
.
http_url_to_repo
...
...
features/project/create.feature
View file @
f18ec707
...
...
@@ -6,21 +6,9 @@ Feature: Project Create
@javascript
Scenario
:
User create a project
Given
I sign in as a user
When
I visit new project page
And
I have an ssh key
And
fill project form with valid data
Then
I should see project page
And
I should see empty project instuctions
@javascript
Scenario
:
Empty project instructions
Given
I sign in as a user
And
I have an ssh key
When
I visit new project page
And
fill project form with valid data
Then
I see empty project instuctions
And
I click on HTTP
Then
Remote url should update to http link
And
If I click on SSH
Then
Remote url should update to ssh link
Then
I should see project page
And
I should see empty project instructions
features/steps/project/create.rb
View file @
f18ec707
...
...
@@ -13,33 +13,9 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps
expect
(
current_path
).
to
eq
namespace_project_path
(
Project
.
last
.
namespace
,
Project
.
last
)
end
step
'I should see empty project instuctions'
do
step
'I should see empty project inst
r
uctions'
do
expect
(
page
).
to
have_content
"git init"
expect
(
page
).
to
have_content
"git remote"
expect
(
page
).
to
have_content
Project
.
last
.
url_to_repo
end
step
'I see empty project instuctions'
do
expect
(
page
).
to
have_content
"git init"
expect
(
page
).
to
have_content
"git remote"
expect
(
page
).
to
have_content
Project
.
last
.
url_to_repo
end
step
'I click on HTTP'
do
find
(
'#clone-dropdown'
).
click
find
(
'.http-selector'
).
click
end
step
'Remote url should update to http link'
do
expect
(
page
).
to
have_content
"git remote add origin
#{
Project
.
last
.
http_url_to_repo
}
"
end
step
'If I click on SSH'
do
find
(
'#clone-dropdown'
).
click
find
(
'.ssh-selector'
).
click
end
step
'Remote url should update to ssh link'
do
expect
(
page
).
to
have_content
"git remote add origin
#{
Project
.
last
.
url_to_repo
}
"
end
end
spec/factories/projects.rb
View file @
f18ec707
...
...
@@ -61,6 +61,12 @@ FactoryGirl.define do
trait
:private
do
visibility_level
Gitlab
::
VisibilityLevel
::
PRIVATE
end
trait
:empty_repo
do
after
(
:create
)
do
|
project
|
project
.
create_repository
end
end
end
# Project with empty repository
...
...
@@ -68,9 +74,7 @@ FactoryGirl.define do
# This is a case when you just created a project
# but not pushed any code there yet
factory
:project_empty_repo
,
parent: :empty_project
do
after
:create
do
|
project
|
project
.
create_repository
end
empty_repo
end
# Project with test repository
...
...
spec/features/projects/developer_views_empty_project_instructions_spec.rb
0 → 100644
View file @
f18ec707
require
'rails_helper'
feature
'Developer views empty project instructions'
,
feature:
true
do
let
(
:project
)
{
create
(
:empty_project
,
:empty_repo
)
}
let
(
:developer
)
{
create
(
:user
)
}
background
do
project
.
team
<<
[
developer
,
:developer
]
login_as
(
developer
)
end
context
'without an SSH key'
do
scenario
'defaults to HTTP'
do
visit_project
expect_instructions_for
(
'http'
)
end
scenario
'switches to SSH'
,
js:
true
do
visit_project
select_protocol
(
'SSH'
)
expect_instructions_for
(
'ssh'
)
end
end
context
'with an SSH key'
do
background
do
create
(
:personal_key
,
user:
developer
)
end
scenario
'defaults to SSH'
do
visit_project
expect_instructions_for
(
'ssh'
)
end
scenario
'switches to HTTP'
,
js:
true
do
visit_project
select_protocol
(
'HTTP'
)
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
expect_instructions_for
(
protocol
)
msg
=
:"
#{
protocol
.
downcase
}
_url_to_repo"
expect
(
page
).
to
have_content
(
"git clone
#{
project
.
send
(
msg
)
}
"
)
end
end
spec/helpers/projects_helper_spec.rb
View file @
f18ec707
...
...
@@ -88,18 +88,18 @@ describe ProjectsHelper do
end
describe
'default_clone_protocol'
do
describe
'using
HTTP'
do
context
'when user is not logged in and gitlab protocol is
HTTP'
do
it
'returns HTTP'
do
expect
(
helper
).
to
receive
(
:current_user
).
and_return
(
nil
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
nil
)
expect
(
helper
.
send
(
:default_clone_protocol
)).
to
eq
(
'http'
)
end
end
describe
'using
HTTPS'
do
context
'when user is not logged in and gitlab protocol is
HTTPS'
do
it
'returns HTTPS'
do
allow
(
Gitlab
.
config
.
gitlab
).
to
receive
(
:protocol
).
and_return
(
'https'
)
expect
(
helper
).
to
receive
(
:current_user
).
and_return
(
nil
)
stub_config_setting
(
protocol:
'https'
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
nil
)
expect
(
helper
.
send
(
:default_clone_protocol
)).
to
eq
(
'https'
)
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