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
Tatuya Kamada
gitlab-ce
Commits
84edc9a2
Commit
84edc9a2
authored
Feb 14, 2016
by
Kamil Trzcinski
Committed by
James Edwards-Jones
Jan 31, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added spinach tests
parent
db35f3dc
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
220 additions
and
13 deletions
+220
-13
app/controllers/projects/pages_domains_controller.rb
app/controllers/projects/pages_domains_controller.rb
+0
-0
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+0
-4
app/views/projects/pages/_destroy.haml
app/views/projects/pages/_destroy.haml
+4
-5
app/views/projects/pages/_form.html.haml
app/views/projects/pages/_form.html.haml
+1
-1
app/views/projects/pages/index.html.haml
app/views/projects/pages/index.html.haml
+3
-3
features/project/pages.feature
features/project/pages.feature
+73
-0
features/steps/project/pages.rb
features/steps/project/pages.rb
+139
-0
No files found.
app/controllers/projects/pages_domains_controller.rb
0 → 100644
View file @
84edc9a2
app/helpers/projects_helper.rb
View file @
84edc9a2
...
@@ -81,10 +81,6 @@ module ProjectsHelper
...
@@ -81,10 +81,6 @@ module ProjectsHelper
"You are going to remove the fork relationship to source project
#{
@project
.
forked_from_project
.
name_with_namespace
}
. Are you ABSOLUTELY sure?"
"You are going to remove the fork relationship to source project
#{
@project
.
forked_from_project
.
name_with_namespace
}
. Are you ABSOLUTELY sure?"
end
end
def
remove_pages_message
(
project
)
"You are going to remove the pages for
#{
project
.
name_with_namespace
}
.
\n
Are you ABSOLUTELY sure?"
end
def
project_nav_tabs
def
project_nav_tabs
@nav_tabs
||=
get_project_nav_tabs
(
@project
,
current_user
)
@nav_tabs
||=
get_project_nav_tabs
(
@project
,
current_user
)
end
end
...
...
app/views/projects/pages/_destroy.haml
View file @
84edc9a2
...
@@ -3,8 +3,7 @@
...
@@ -3,8 +3,7 @@
.panel-heading
Remove pages
.panel-heading
Remove pages
.errors-holder
.errors-holder
.panel-body
.panel-body
=
form_tag
(
remove_pages_namespace_project_pages_path
(
@project
.
namespace
,
@project
),
method: :delete
,
class:
'form-horizontal'
)
do
%p
%p
Removing the pages will prevent from exposing them to outside world.
Removing the pages will prevent from exposing them to outside world.
.form-actions
.form-actions
=
button_to
'Remove pages'
,
'#'
,
class:
"btn btn-remove js-confirm-danger"
,
data:
{
"confirm-danger-message"
=>
remove_pages_message
(
@project
)
}
=
link_to
'Remove'
,
remove_pages_namespace_project_pages_path
(
@project
.
namespace
,
@project
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-remove"
app/views/projects/pages/_form.html.haml
View file @
84edc9a2
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
=
f
.
text_field
:domain
,
required:
true
,
autocomplete:
'off'
,
class:
'form-control'
=
f
.
text_field
:domain
,
required:
true
,
autocomplete:
'off'
,
class:
'form-control'
%span
.help-inline
* required
%span
.help-inline
* required
-
if
Settings
.
pages
.
external_https
-
if
Gitlab
.
config
.
pages
.
external_https
.form-group
.form-group
=
f
.
label
:certificate
,
class:
'control-label'
do
=
f
.
label
:certificate
,
class:
'control-label'
do
Certificate (PEM)
Certificate (PEM)
...
...
app/views/projects/pages/index.html.haml
View file @
84edc9a2
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
%h3
.page_title
%h3
.page_title
Pages
Pages
-
if
Settings
.
pages
.
external_http
||
Settings
.
pages
.
external_https
-
if
Gitlab
.
config
.
pages
.
external_http
||
Gitlab
.
config
.
pages
.
external_https
=
link_to
new_namespace_project_page_path
(
@project
.
namespace
,
@project
),
class:
"btn btn-new pull-right"
,
title:
"New Domain"
do
=
link_to
new_namespace_project_page_path
(
@project
.
namespace
,
@project
),
class:
"btn btn-new pull-right"
,
title:
"New Domain"
do
%i
.fa.fa-plus
%i
.fa.fa-plus
New Domain
New Domain
...
@@ -14,10 +14,10 @@
...
@@ -14,10 +14,10 @@
%hr
.clearfix
%hr
.clearfix
-
if
Settings
.
pages
.
enabled
-
if
Gitlab
.
config
.
pages
.
enabled
=
render
'access'
=
render
'access'
=
render
'use'
=
render
'use'
-
if
Settings
.
pages
.
external_http
||
Settings
.
pages
.
external_https
-
if
Gitlab
.
config
.
pages
.
external_http
||
Gitlab
.
config
.
pages
.
external_https
=
render
'list'
=
render
'list'
-
else
-
else
=
render
'no_domains'
=
render
'no_domains'
...
...
features/project/pages.feature
0 → 100644
View file @
84edc9a2
Feature
:
Project Pages
Background
:
Given
I sign in as a user
And
I own a project
Scenario
:
Pages are disabled
Given
pages are disabled
When
I visit the Project Pages
Then
I should see that GitLab Pages are disabled
Scenario
:
I
can see the pages usage if not deployed
Given
pages are enabled
When
I visit the Project Pages
Then
I should see the usage of GitLab Pages
Scenario
:
I
can access the pages if deployed
Given
pages are enabled
And
pages are deployed
When
I visit the Project Pages
Then
I should be able to access the Pages
Scenario
:
I
should message that domains support is disabled
Given
pages are enabled
And
pages are deployed
And
support for external domains is disabled
When
I visit the Project Pages
Then
I should see that support for domains is disabled
Scenario
:
I
should see a new domain button
Given
pages are enabled
And
pages are exposed on external HTTP address
When
I visit the Project Pages
And
I should be able to add a New Domain
Scenario
:
I
should be able to add a new domain
Given
pages are enabled
And
pages are exposed on external HTTP address
When
I visit add a new Pages Domain
And
I fill the domain
And
I click on
"Create New Domain"
Then
I should see a new domain added
Scenario
:
I
should be denied to add the same domain twice
Given
pages are enabled
And
pages are exposed on external HTTP address
And
pages domain is added
When
I visit add a new Pages Domain
And
I fill the domain
And
I click on
"Create New Domain"
Then
I should see error message that domain already exists
Scenario
:
I
should message that certificates support is disabled when trying to add a new domain
Given
pages are enabled
And
pages are exposed on external HTTP address
And
pages domain is added
When
I visit add a new Pages Domain
Then
I should see that support for certificates is disabled
Scenario
:
I
should be able to add a new domain with certificate
Given
pages are enabled
And
pages are exposed on external HTTPS address
When
I visit add a new Pages Domain
And
I fill the domain
And
I fill the certificate and key
And
I click on
"Create New Domain"
Then
I should see a new domain added
Scenario
:
I
can remove the pages if deployed
Given
pages are enabled
And
pages are deployed
When
I visit the Project Pages
And
I click Remove Pages
Then
The Pages should get removed
features/steps/project/pages.rb
0 → 100644
View file @
84edc9a2
class
Spinach::Features::ProjectPages
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
SharedProject
step
'pages are enabled'
do
Gitlab
.
config
.
pages
.
stub
(
:enabled
).
and_return
(
true
)
Gitlab
.
config
.
pages
.
stub
(
:host
).
and_return
(
'example.com'
)
Gitlab
.
config
.
pages
.
stub
(
:port
).
and_return
(
80
)
Gitlab
.
config
.
pages
.
stub
(
:https
).
and_return
(
false
)
end
step
'pages are disabled'
do
Gitlab
.
config
.
pages
.
stub
(
:enabled
).
and_return
(
false
)
end
step
'I visit the Project Pages'
do
visit
namespace_project_pages_path
(
@project
.
namespace
,
@project
)
end
step
'I should see that GitLab Pages are disabled'
do
expect
(
page
).
to
have_content
(
'GitLab Pages are disabled'
)
end
step
'I should see the usage of GitLab Pages'
do
expect
(
page
).
to
have_content
(
'Configure pages'
)
end
step
'pages are deployed'
do
commit
=
@project
.
ensure_ci_commit
(
@project
.
commit
(
'HEAD'
).
sha
)
build
=
build
(
:ci_build
,
project:
@project
,
commit:
commit
,
ref:
'HEAD'
,
artifacts_file:
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/pages.zip'
),
artifacts_metadata:
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/pages.zip.meta'
)
)
result
=
::
Projects
::
UpdatePagesService
.
new
(
@project
,
build
).
execute
expect
(
result
[
:status
]).
to
eq
(
:success
)
end
step
'I should be able to access the Pages'
do
expect
(
page
).
to
have_content
(
'Access pages'
)
end
step
'I should see that support for domains is disabled'
do
expect
(
page
).
to
have_content
(
'Support for domains and certificates is disabled'
)
end
step
'support for external domains is disabled'
do
Gitlab
.
config
.
pages
.
stub
(
:external_http
).
and_return
(
nil
)
Gitlab
.
config
.
pages
.
stub
(
:external_https
).
and_return
(
nil
)
end
step
'pages are exposed on external HTTP address'
do
Gitlab
.
config
.
pages
.
stub
(
:external_http
).
and_return
(
'1.1.1.1:80'
)
Gitlab
.
config
.
pages
.
stub
(
:external_https
).
and_return
(
nil
)
end
step
'pages are exposed on external HTTPS address'
do
Gitlab
.
config
.
pages
.
stub
(
:external_http
).
and_return
(
'1.1.1.1:80'
)
Gitlab
.
config
.
pages
.
stub
(
:external_https
).
and_return
(
'1.1.1.1:443'
)
end
step
'I should be able to add a New Domain'
do
expect
(
page
).
to
have_content
(
'New Domain'
)
end
step
'I visit add a new Pages Domain'
do
visit
new_namespace_project_page_path
(
@project
.
namespace
,
@project
)
end
step
'I fill the domain'
do
fill_in
'Domain'
,
with:
'my.test.domain.com'
end
step
'I click on "Create New Domain"'
do
click_button
'Create New Domain'
end
step
'I should see a new domain added'
do
expect
(
page
).
to
have_content
(
'Domains (1)'
)
expect
(
page
).
to
have_content
(
'my.test.domain.com'
)
end
step
'pages domain is added'
do
@project
.
pages_domains
.
create!
(
domain:
'my.test.domain.com'
)
end
step
'I should see error message that domain already exists'
do
expect
(
page
).
to
have_content
(
'Domain has already been taken'
)
end
step
'I should see that support for certificates is disabled'
do
expect
(
page
).
to
have_content
(
'Support for custom certificates is disabled'
)
end
step
'I fill the certificate and key'
do
fill_in
'Certificate (PEM)'
,
with:
'-----BEGIN CERTIFICATE-----
MIICGzCCAYSgAwIBAgIBATANBgkqhkiG9w0BAQUFADAbMRkwFwYDVQQDExB0ZXN0
LWNlcnRpZmljYXRlMB4XDTE2MDIxMj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/e4kXcIjeH6KwQsuR
5vrXfBZ3sQfflaiN4QJBANBt8JY2LIGQF8o89qwUpRL5vbnKQ4IzZ5+TOl4RLR7O
AQpJ81tGuINghO7aunctb6rrcKJrxmEH1whzComybrMCQQDKV49nOBudRBAIgG4K
EnLzsRKISUHMZSJiYTYnablof8cKw1JaQduw7zgrUlLwnroSaAGX88+Jw1f5n2Lh
Vlg5AkBDdUGnrDLtYBCDEQYZHblrkc7ZAeCllDOWjxUV+uMqlCv8A4Ey6omvY57C
m6I8DkWVAQx8VPtozhvHjUw80rZHAkB55HWHAM3h13axKG0htCt7klhPsZHpx6MH
EPjGlXIT+aW2XiPmK3ZlCDcWIenE+lmtbOpI159Wpk8BGXs/s/xBAkEAlAY3ymgx
63BDJEwvOb2IaP8lDDxNsXx9XJNVvQbv5n15vNsLHbjslHfAhAbxnLQ1fLhUPqSi
nNp/xedE1YxutQ==
-----END PRIVATE KEY-----'
end
step
'I click Remove Pages'
do
click_link
'Remove pages'
end
step
'The Pages should get removed'
do
expect
(
@project
.
pages_url
).
to
be_nil
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