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
7b262c43
Commit
7b262c43
authored
Oct 03, 2017
by
Mike Greiling
Committed by
Rémy Coutable
Oct 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Precompiled assets with digest strings are ignored in CI"
parent
18fee306
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
35 additions
and
16 deletions
+35
-16
config/environments/test.rb
config/environments/test.rb
+1
-1
spec/controllers/projects/jobs_controller_spec.rb
spec/controllers/projects/jobs_controller_spec.rb
+1
-1
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+1
-1
spec/controllers/projects/pipelines_controller_spec.rb
spec/controllers/projects/pipelines_controller_spec.rb
+1
-1
spec/helpers/groups_helper_spec.rb
spec/helpers/groups_helper_spec.rb
+1
-1
spec/helpers/page_layout_helper_spec.rb
spec/helpers/page_layout_helper_spec.rb
+3
-3
spec/lib/gitlab/path_regex_spec.rb
spec/lib/gitlab/path_regex_spec.rb
+4
-3
spec/lib/gitlab/popen_spec.rb
spec/lib/gitlab/popen_spec.rb
+1
-1
spec/serializers/build_serializer_spec.rb
spec/serializers/build_serializer_spec.rb
+1
-1
spec/serializers/pipeline_serializer_spec.rb
spec/serializers/pipeline_serializer_spec.rb
+1
-1
spec/serializers/status_entity_spec.rb
spec/serializers/status_entity_spec.rb
+2
-2
spec/spec_helper.rb
spec/spec_helper.rb
+18
-0
No files found.
config/environments/test.rb
View file @
7b262c43
...
...
@@ -16,7 +16,7 @@ Rails.application.configure do
config
.
cache_classes
=
ENV
[
'CACHE_CLASSES'
]
==
'true'
# Configure static asset server for tests with Cache-Control for performance
config
.
assets
.
digest
=
false
config
.
assets
.
compile
=
false
if
ENV
[
'CI'
]
config
.
serve_static_files
=
true
config
.
static_cache_control
=
"public, max-age=3600"
...
...
spec/controllers/projects/jobs_controller_spec.rb
View file @
7b262c43
...
...
@@ -216,7 +216,7 @@ describe Projects::JobsController do
expect
(
json_response
[
'text'
]).
to
eq
status
.
text
expect
(
json_response
[
'label'
]).
to
eq
status
.
label
expect
(
json_response
[
'icon'
]).
to
eq
status
.
icon
expect
(
json_response
[
'favicon'
]).
to
eq
"/assets/ci_favicons/
#{
status
.
favicon
}
.ico"
expect
(
json_response
[
'favicon'
]).
to
match_asset_path
"/assets/ci_favicons/
#{
status
.
favicon
}
.ico"
end
end
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
7b262c43
...
...
@@ -658,7 +658,7 @@ describe Projects::MergeRequestsController do
expect
(
json_response
[
'text'
]).
to
eq
status
.
text
expect
(
json_response
[
'label'
]).
to
eq
status
.
label
expect
(
json_response
[
'icon'
]).
to
eq
status
.
icon
expect
(
json_response
[
'favicon'
]).
to
eq
"/assets/ci_favicons/
#{
status
.
favicon
}
.ico"
expect
(
json_response
[
'favicon'
]).
to
match_asset_path
"/assets/ci_favicons/
#{
status
.
favicon
}
.ico"
end
end
...
...
spec/controllers/projects/pipelines_controller_spec.rb
View file @
7b262c43
...
...
@@ -142,7 +142,7 @@ describe Projects::PipelinesController do
expect
(
json_response
[
'text'
]).
to
eq
status
.
text
expect
(
json_response
[
'label'
]).
to
eq
status
.
label
expect
(
json_response
[
'icon'
]).
to
eq
status
.
icon
expect
(
json_response
[
'favicon'
]).
to
eq
"/assets/ci_favicons/
#{
status
.
favicon
}
.ico"
expect
(
json_response
[
'favicon'
]).
to
match_asset_path
(
"/assets/ci_favicons/
#{
status
.
favicon
}
.ico"
)
end
end
...
...
spec/helpers/groups_helper_spec.rb
View file @
7b262c43
...
...
@@ -17,7 +17,7 @@ describe GroupsHelper do
it
'gives default avatar_icon when no avatar is present'
do
group
=
create
(
:group
)
group
.
save!
expect
(
group_icon
(
group
.
path
)).
to
match
(
'group_avatar.png'
)
expect
(
group_icon
(
group
.
path
)).
to
match
_asset_path
(
'group_avatar.png'
)
end
end
...
...
spec/helpers/page_layout_helper_spec.rb
View file @
7b262c43
...
...
@@ -54,7 +54,7 @@ describe PageLayoutHelper do
describe
'page_image'
do
it
'defaults to the GitLab logo'
do
expect
(
helper
.
page_image
).
to
end_wi
th
'assets/gitlab_logo.png'
expect
(
helper
.
page_image
).
to
match_asset_pa
th
'assets/gitlab_logo.png'
end
%w(project user group)
.
each
do
|
type
|
...
...
@@ -70,13 +70,13 @@ describe PageLayoutHelper do
object
=
double
(
avatar_url:
nil
)
assign
(
type
,
object
)
expect
(
helper
.
page_image
).
to
end_wi
th
'assets/gitlab_logo.png'
expect
(
helper
.
page_image
).
to
match_asset_pa
th
'assets/gitlab_logo.png'
end
end
context
"with no assignments"
do
it
'falls back to the default'
do
expect
(
helper
.
page_image
).
to
end_wi
th
'assets/gitlab_logo.png'
expect
(
helper
.
page_image
).
to
match_asset_pa
th
'assets/gitlab_logo.png'
end
end
end
...
...
spec/lib/gitlab/path_regex_spec.rb
View file @
7b262c43
...
...
@@ -84,9 +84,9 @@ describe Gitlab::PathRegex do
let
(
:top_level_words
)
do
words
=
routes_not_starting_in_wildcard
.
map
do
|
route
|
route
.
split
(
'/'
)[
1
]
end
.
compact
.
uniq
end
.
compact
words
+
ee_top_level_words
+
files_in_public
+
Array
(
API
::
API
.
prefix
.
to_s
)
(
words
+
ee_top_level_words
+
files_in_public
+
Array
(
API
::
API
.
prefix
.
to_s
)).
uniq
end
let
(
:ee_top_level_words
)
do
...
...
@@ -95,10 +95,11 @@ describe Gitlab::PathRegex do
let
(
:files_in_public
)
do
git
=
Gitlab
.
config
.
git
.
bin_path
`cd
#{
Rails
.
root
}
&&
#{
git
}
ls-files public`
tracked
=
`cd
#{
Rails
.
root
}
&&
#{
git
}
ls-files public`
.
split
(
"
\n
"
)
.
map
{
|
entry
|
entry
.
gsub
(
'public/'
,
''
)
}
.
uniq
tracked
+
%w(assets uploads)
end
# All routes that start with a namespaced path, that have 1 or more
...
...
spec/lib/gitlab/popen_spec.rb
View file @
7b262c43
...
...
@@ -14,7 +14,7 @@ describe 'Gitlab::Popen' do
end
it
{
expect
(
@status
).
to
be_zero
}
it
{
expect
(
@output
).
to
include
(
'
cache
'
)
}
it
{
expect
(
@output
).
to
include
(
'
tests
'
)
}
end
context
'non-zero status'
do
...
...
spec/serializers/build_serializer_spec.rb
View file @
7b262c43
...
...
@@ -38,7 +38,7 @@ describe BuildSerializer do
expect
(
subject
[
:text
]).
to
eq
(
status
.
text
)
expect
(
subject
[
:label
]).
to
eq
(
status
.
label
)
expect
(
subject
[
:icon
]).
to
eq
(
status
.
icon
)
expect
(
subject
[
:favicon
]).
to
eq
(
"/assets/ci_favicons/
#{
status
.
favicon
}
.ico"
)
expect
(
subject
[
:favicon
]).
to
match_asset_path
(
"/assets/ci_favicons/
#{
status
.
favicon
}
.ico"
)
end
end
end
...
...
spec/serializers/pipeline_serializer_spec.rb
View file @
7b262c43
...
...
@@ -168,7 +168,7 @@ describe PipelineSerializer do
expect
(
subject
[
:text
]).
to
eq
(
status
.
text
)
expect
(
subject
[
:label
]).
to
eq
(
status
.
label
)
expect
(
subject
[
:icon
]).
to
eq
(
status
.
icon
)
expect
(
subject
[
:favicon
]).
to
eq
(
"/assets/ci_favicons/
#{
status
.
favicon
}
.ico"
)
expect
(
subject
[
:favicon
]).
to
match_asset_path
(
"/assets/ci_favicons/
#{
status
.
favicon
}
.ico"
)
end
end
end
...
...
spec/serializers/status_entity_spec.rb
View file @
7b262c43
...
...
@@ -18,12 +18,12 @@ describe StatusEntity do
it
'contains status details'
do
expect
(
subject
).
to
include
:text
,
:icon
,
:favicon
,
:label
,
:group
expect
(
subject
).
to
include
:has_details
,
:details_path
expect
(
subject
[
:favicon
]).
to
eq
(
'/assets/ci_favicons/favicon_status_success.ico'
)
expect
(
subject
[
:favicon
]).
to
match_asset_path
(
'/assets/ci_favicons/favicon_status_success.ico'
)
end
it
'contains a dev namespaced favicon if dev env'
do
allow
(
Rails
.
env
).
to
receive
(
:development?
)
{
true
}
expect
(
entity
.
as_json
[
:favicon
]).
to
eq
(
'/assets/ci_favicons/dev/favicon_status_success.ico'
)
expect
(
entity
.
as_json
[
:favicon
]).
to
match_asset_path
(
'/assets/ci_favicons/dev/favicon_status_success.ico'
)
end
end
end
spec/spec_helper.rb
View file @
7b262c43
...
...
@@ -169,6 +169,24 @@ RSpec.configure do |config|
end
end
# add simpler way to match asset paths containing digest strings
RSpec
::
Matchers
.
define
:match_asset_path
do
|
expected
|
match
do
|
actual
|
path
=
Regexp
.
escape
(
expected
)
extname
=
Regexp
.
escape
(
File
.
extname
(
expected
))
digest_regex
=
Regexp
.
new
(
path
.
sub
(
extname
,
"(?:-
\\
h+)?
#{
extname
}
"
)
<<
'$'
)
digest_regex
=~
actual
end
failure_message
do
|
actual
|
"expected that
#{
actual
}
would include an asset path for
#{
expected
}
"
end
failure_message_when_negated
do
|
actual
|
"expected that
#{
actual
}
would not include an asset path for
#{
expected
}
"
end
end
FactoryGirl
::
SyntaxRunner
.
class_eval
do
include
RSpec
::
Mocks
::
ExampleMethods
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