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
eb1af340
Commit
eb1af340
authored
Dec 10, 2019
by
Kerri Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorganize specs
parent
ac1ef930
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
34 deletions
+7
-34
spec/lib/gitlab/diff/highlight_cache_spec.rb
spec/lib/gitlab/diff/highlight_cache_spec.rb
+7
-34
No files found.
spec/lib/gitlab/diff/highlight_cache_spec.rb
View file @
eb1af340
...
...
@@ -79,12 +79,9 @@ describe Gitlab::Diff::HighlightCache, :clean_gitlab_redis_cache do
end
end
describe
'#write_if_empty
'
do
shared_examples
'caches missing entries
'
do
it
'filters the key/value list of entries to be caches for each invocation'
do
paths
=
merge_request
.
diffs
.
diff_files
.
select
(
&
:text?
).
map
(
&
:file_path
)
expect
(
cache
).
to
receive
(
:write_to_redis_hash
)
.
with
(
hash_including
(
*
paths
))
.
once
.
and_call_original
...
...
@@ -96,6 +93,10 @@ describe Gitlab::Diff::HighlightCache, :clean_gitlab_redis_cache do
cache
.
write_if_empty
end
end
describe
'#write_if_empty'
do
it_behaves_like
'caches missing entries'
context
'different diff_collections for the same diffable'
do
before
do
...
...
@@ -109,21 +110,6 @@ describe Gitlab::Diff::HighlightCache, :clean_gitlab_redis_cache do
.
to
change
{
Gitlab
::
Redis
::
Cache
.
with
{
|
r
|
r
.
hgetall
(
cache_key
)
}
}
end
end
end
describe
`#file_paths`
do
it
'accesses path info without error'
do
expect
{
cache
.
send
(
:file_paths
)
}
.
not_to
raise_error
end
it
'returns an array of file path strings'
do
results
=
cache
.
send
(
:file_paths
)
expect
(
results
).
to
be_an
Array
expect
(
results
).
not_to
be_empty
expect
(
results
).
to
include
(
".DS_Store"
)
end
context
'when cache initialized with MergeRequestDiffBatch'
do
let
(
:merge_request_diff_batch
)
do
...
...
@@ -134,21 +120,8 @@ describe Gitlab::Diff::HighlightCache, :clean_gitlab_redis_cache do
diff_options:
nil
)
end
subject
(
:cache_with_merge_request_diff_batch
)
do
described_class
.
new
(
merge_request_diff_batch
)
end
it
'accesses path info without error'
do
expect
{
cache_with_merge_request_diff_batch
.
send
(
:file_paths
)
}
.
not_to
raise_error
end
it
'returns an array of file path strings'
do
results
=
cache_with_merge_request_diff_batch
.
send
(
:file_paths
)
expect
(
results
).
to
be_an
Array
expect
(
results
).
not_to
be_empty
expect
(
results
).
to
include
(
".DS_Store"
)
it_behaves_like
'caches missing entries'
do
let
(
:cache
)
{
described_class
.
new
(
merge_request_diff_batch
)
}
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