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
6a40c216
Commit
6a40c216
authored
Oct 03, 2017
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update tests for new implementation
parent
dfd9185d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
58 deletions
+3
-58
spec/features/projects/artifacts/browse_spec.rb
spec/features/projects/artifacts/browse_spec.rb
+3
-6
spec/helpers/artifact_helper_spec.rb
spec/helpers/artifact_helper_spec.rb
+0
-52
No files found.
spec/features/projects/artifacts/browse_spec.rb
View file @
6a40c216
require
'spec_helper'
feature
'Browse artifact'
,
:js
do
include
ArtifactHelper
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
)
}
let
(
:job
)
{
create
(
:ci_build
,
:artifacts
,
pipeline:
pipeline
)
}
...
...
@@ -24,8 +22,8 @@ feature 'Browse artifact', :js do
end
end
context
'when browsing a directory with an
HTML
file'
do
let
(
:
html_entry
)
{
job
.
artifacts_metadata_entry
(
"other_artifacts_0.1.2/index.html"
)
}
context
'when browsing a directory with an
text
file'
do
let
(
:
txt_entry
)
{
job
.
artifacts_metadata_entry
(
'other_artifacts_0.1.2/doc_sample.txt'
)
}
before
do
allow
(
Gitlab
.
config
.
pages
).
to
receive
(
:enabled
).
and_return
(
true
)
...
...
@@ -37,8 +35,7 @@ feature 'Browse artifact', :js do
it
"shows external link icon and styles"
do
link
=
first
(
'.tree-item-file-external-link'
)
expect
(
link
).
to
have_content
(
'index.html'
)
expect
(
link
[
:href
]).
to
eq
(
html_artifact_url
(
project
,
job
,
html_entry
.
blob
))
expect
(
link
).
to
have_content
(
'doc_sample.txt'
)
expect
(
page
).
to
have_selector
(
'.js-artifact-tree-external-icon'
)
end
end
...
...
spec/helpers/artifact_helper_spec.rb
deleted
100644 → 0
View file @
dfd9185d
require
'spec_helper'
describe
ArtifactHelper
do
set
(
:job
)
{
create
(
:ci_build
,
:artifacts
)
}
let
(
:html_entry
)
{
job
.
artifacts_metadata_entry
(
"other_artifacts_0.1.2/index.html"
)
}
let
(
:txt_entry
)
{
job
.
artifacts_metadata_entry
(
"other_artifacts_0.1.2/doc_sample.txt"
)
}
before
do
allow
(
Gitlab
.
config
.
pages
).
to
receive
(
:enabled
).
and_return
(
true
)
allow
(
Gitlab
.
config
.
pages
).
to
receive
(
:artifacts_server
).
and_return
(
true
)
end
describe
'#link_to_artifact'
do
context
'link_to_pages returns true'
do
subject
{
link_to_artifact
(
job
.
project
,
job
,
entry
)
}
before
do
allow
(
Gitlab
.
config
.
pages
).
to
receive
(
:enabled
).
and_return
(
true
)
end
context
'when the entry is HTML'
do
let
(
:entry
)
{
html_entry
}
it
{
is_expected
.
to
match
Gitlab
.
config
.
pages
.
host
}
it
{
is_expected
.
to
match
/-\/jobs\/\d+\/artifacts/
}
end
context
'when the entry is not HTML'
do
let
(
:entry
)
{
txt_entry
}
it
{
is_expected
.
not_to
match
Gitlab
.
config
.
pages
.
host
}
end
end
end
describe
'#external_url?'
do
context
'pages enabled'
do
before
do
allow
(
Gitlab
.
config
.
pages
).
to
receive
(
:artifacts_server
).
and_return
(
true
)
end
it
'returns true for HTML files'
do
expect
(
external_url?
(
txt_entry
.
blob
)).
to
be
(
false
)
end
it
'returns true for HTML files'
do
expect
(
external_url?
(
html_entry
.
blob
)).
to
be
(
true
)
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