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
5ec7bf04
Commit
5ec7bf04
authored
Sep 28, 2020
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix conflicts with rubby 2.7 and snippet_repository spec
parent
911ff9eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
spec/models/snippet_repository_spec.rb
spec/models/snippet_repository_spec.rb
+17
-17
No files found.
spec/models/snippet_repository_spec.rb
View file @
5ec7bf04
...
@@ -35,7 +35,7 @@ RSpec.describe SnippetRepository do
...
@@ -35,7 +35,7 @@ RSpec.describe SnippetRepository do
it
'returns nil when files argument is empty'
do
it
'returns nil when files argument is empty'
do
expect
(
snippet
.
repository
).
not_to
receive
(
:multi_action
)
expect
(
snippet
.
repository
).
not_to
receive
(
:multi_action
)
operation
=
snippet_repository
.
multi_files_action
(
user
,
[],
commit_opts
)
operation
=
snippet_repository
.
multi_files_action
(
user
,
[],
**
commit_opts
)
expect
(
operation
).
to
be_nil
expect
(
operation
).
to
be_nil
end
end
...
@@ -43,7 +43,7 @@ RSpec.describe SnippetRepository do
...
@@ -43,7 +43,7 @@ RSpec.describe SnippetRepository do
it
'returns nil when files argument is nil'
do
it
'returns nil when files argument is nil'
do
expect
(
snippet
.
repository
).
not_to
receive
(
:multi_action
)
expect
(
snippet
.
repository
).
not_to
receive
(
:multi_action
)
operation
=
snippet_repository
.
multi_files_action
(
user
,
nil
,
commit_opts
)
operation
=
snippet_repository
.
multi_files_action
(
user
,
nil
,
**
commit_opts
)
expect
(
operation
).
to
be_nil
expect
(
operation
).
to
be_nil
end
end
...
@@ -60,7 +60,7 @@ RSpec.describe SnippetRepository do
...
@@ -60,7 +60,7 @@ RSpec.describe SnippetRepository do
end
end
expect
do
expect
do
snippet_repository
.
multi_files_action
(
user
,
data
,
commit_opts
)
snippet_repository
.
multi_files_action
(
user
,
data
,
**
commit_opts
)
end
.
not_to
raise_error
end
.
not_to
raise_error
aggregate_failures
do
aggregate_failures
do
...
@@ -77,13 +77,13 @@ RSpec.describe SnippetRepository do
...
@@ -77,13 +77,13 @@ RSpec.describe SnippetRepository do
it
'tries to obtain an exclusive lease'
do
it
'tries to obtain an exclusive lease'
do
expect
(
Gitlab
::
ExclusiveLease
).
to
receive
(
:new
).
with
(
"multi_files_action:
#{
snippet
.
id
}
"
,
anything
).
and_call_original
expect
(
Gitlab
::
ExclusiveLease
).
to
receive
(
:new
).
with
(
"multi_files_action:
#{
snippet
.
id
}
"
,
anything
).
and_call_original
snippet_repository
.
multi_files_action
(
user
,
data
,
commit_opts
)
snippet_repository
.
multi_files_action
(
user
,
data
,
**
commit_opts
)
end
end
it
'cancels the lease when the method has finished'
do
it
'cancels the lease when the method has finished'
do
expect
(
Gitlab
::
ExclusiveLease
).
to
receive
(
:cancel
).
with
(
"multi_files_action:
#{
snippet
.
id
}
"
,
anything
).
and_call_original
expect
(
Gitlab
::
ExclusiveLease
).
to
receive
(
:cancel
).
with
(
"multi_files_action:
#{
snippet
.
id
}
"
,
anything
).
and_call_original
snippet_repository
.
multi_files_action
(
user
,
data
,
commit_opts
)
snippet_repository
.
multi_files_action
(
user
,
data
,
**
commit_opts
)
end
end
it
'raises an error if the lease cannot be obtained'
do
it
'raises an error if the lease cannot be obtained'
do
...
@@ -92,7 +92,7 @@ RSpec.describe SnippetRepository do
...
@@ -92,7 +92,7 @@ RSpec.describe SnippetRepository do
end
end
expect
do
expect
do
snippet_repository
.
multi_files_action
(
user
,
data
,
commit_opts
)
snippet_repository
.
multi_files_action
(
user
,
data
,
**
commit_opts
)
end
.
to
raise_error
(
described_class
::
CommitError
)
end
.
to
raise_error
(
described_class
::
CommitError
)
end
end
...
@@ -114,7 +114,7 @@ RSpec.describe SnippetRepository do
...
@@ -114,7 +114,7 @@ RSpec.describe SnippetRepository do
it
'infers the commit action based on the parameters if not present'
do
it
'infers the commit action based on the parameters if not present'
do
expect
(
repo
).
to
receive
(
:multi_action
).
with
(
user
,
hash_including
(
actions:
result
))
expect
(
repo
).
to
receive
(
:multi_action
).
with
(
user
,
hash_including
(
actions:
result
))
snippet_repository
.
multi_files_action
(
user
,
data
,
commit_opts
)
snippet_repository
.
multi_files_action
(
user
,
data
,
**
commit_opts
)
end
end
context
'when commit actions are present'
do
context
'when commit actions are present'
do
...
@@ -128,7 +128,7 @@ RSpec.describe SnippetRepository do
...
@@ -128,7 +128,7 @@ RSpec.describe SnippetRepository do
user
,
user
,
hash_including
(
actions:
array_including
(
hash_including
(
action:
expected_action
)))))
hash_including
(
actions:
array_including
(
hash_including
(
action:
expected_action
)))))
snippet_repository
.
multi_files_action
(
user
,
data
,
commit_opts
)
snippet_repository
.
multi_files_action
(
user
,
data
,
**
commit_opts
)
end
end
end
end
...
@@ -149,7 +149,7 @@ RSpec.describe SnippetRepository do
...
@@ -149,7 +149,7 @@ RSpec.describe SnippetRepository do
specify
do
specify
do
existing_content
=
blob_at
(
snippet
,
previous_path
).
data
existing_content
=
blob_at
(
snippet
,
previous_path
).
data
snippet_repository
.
multi_files_action
(
user
,
[
move_action
],
commit_opts
)
snippet_repository
.
multi_files_action
(
user
,
[
move_action
],
**
commit_opts
)
blob
=
blob_at
(
snippet
,
new_path
)
blob
=
blob_at
(
snippet
,
new_path
)
expect
(
blob
).
not_to
be_nil
expect
(
blob
).
not_to
be_nil
...
@@ -177,7 +177,7 @@ RSpec.describe SnippetRepository do
...
@@ -177,7 +177,7 @@ RSpec.describe SnippetRepository do
specify
do
specify
do
last_commit_id
=
snippet
.
repository
.
head_commit
.
id
last_commit_id
=
snippet
.
repository
.
head_commit
.
id
snippet_repository
.
multi_files_action
(
user
,
[
update_action
],
commit_opts
)
snippet_repository
.
multi_files_action
(
user
,
[
update_action
],
**
commit_opts
)
expect
(
snippet
.
repository
.
head_commit
.
id
).
to
eq
last_commit_id
expect
(
snippet
.
repository
.
head_commit
.
id
).
to
eq
last_commit_id
end
end
...
@@ -214,13 +214,13 @@ RSpec.describe SnippetRepository do
...
@@ -214,13 +214,13 @@ RSpec.describe SnippetRepository do
before
do
before
do
expect
(
blob_at
(
snippet
,
default_name
)).
to
be_nil
expect
(
blob_at
(
snippet
,
default_name
)).
to
be_nil
snippet_repository
.
multi_files_action
(
user
,
[
new_file
],
commit_opts
)
snippet_repository
.
multi_files_action
(
user
,
[
new_file
],
**
commit_opts
)
expect
(
blob_at
(
snippet
,
default_name
)).
to
be
expect
(
blob_at
(
snippet
,
default_name
)).
to
be
end
end
it
'reuses the existing file name'
do
it
'reuses the existing file name'
do
snippet_repository
.
multi_files_action
(
user
,
[
existing_file
],
commit_opts
)
snippet_repository
.
multi_files_action
(
user
,
[
existing_file
],
**
commit_opts
)
blob
=
blob_at
(
snippet
,
default_name
)
blob
=
blob_at
(
snippet
,
default_name
)
expect
(
blob
.
data
).
to
eq
existing_file
[
:content
]
expect
(
blob
.
data
).
to
eq
existing_file
[
:content
]
...
@@ -234,7 +234,7 @@ RSpec.describe SnippetRepository do
...
@@ -234,7 +234,7 @@ RSpec.describe SnippetRepository do
it
'assigns a new name to the file'
do
it
'assigns a new name to the file'
do
expect
(
blob_at
(
snippet
,
default_name
)).
to
be_nil
expect
(
blob_at
(
snippet
,
default_name
)).
to
be_nil
snippet_repository
.
multi_files_action
(
user
,
[
new_file
],
commit_opts
)
snippet_repository
.
multi_files_action
(
user
,
[
new_file
],
**
commit_opts
)
blob
=
blob_at
(
snippet
,
default_name
)
blob
=
blob_at
(
snippet
,
default_name
)
expect
(
blob
.
data
).
to
eq
new_file
[
:content
]
expect
(
blob
.
data
).
to
eq
new_file
[
:content
]
...
@@ -246,7 +246,7 @@ RSpec.describe SnippetRepository do
...
@@ -246,7 +246,7 @@ RSpec.describe SnippetRepository do
before
do
before
do
expect
do
expect
do
snippet_repository
.
multi_files_action
(
user
,
data
,
commit_opts
)
snippet_repository
.
multi_files_action
(
user
,
data
,
**
commit_opts
)
end
.
not_to
raise_error
end
.
not_to
raise_error
end
end
...
@@ -259,10 +259,10 @@ RSpec.describe SnippetRepository do
...
@@ -259,10 +259,10 @@ RSpec.describe SnippetRepository do
before
do
before
do
# Pre-populate repository with 9 unnamed snippets.
# Pre-populate repository with 9 unnamed snippets.
snippet_repository
.
multi_files_action
(
user
,
pre_populate_data
,
commit_opts
)
snippet_repository
.
multi_files_action
(
user
,
pre_populate_data
,
**
commit_opts
)
expect
do
expect
do
snippet_repository
.
multi_files_action
(
user
,
data
,
commit_opts
)
snippet_repository
.
multi_files_action
(
user
,
data
,
**
commit_opts
)
end
.
not_to
raise_error
end
.
not_to
raise_error
end
end
...
@@ -274,7 +274,7 @@ RSpec.describe SnippetRepository do
...
@@ -274,7 +274,7 @@ RSpec.describe SnippetRepository do
it
'raises a path specific error'
do
it
'raises a path specific error'
do
expect
do
expect
do
snippet_repository
.
multi_files_action
(
user
,
data
,
commit_opts
)
snippet_repository
.
multi_files_action
(
user
,
data
,
**
commit_opts
)
end
.
to
raise_error
(
error
)
end
.
to
raise_error
(
error
)
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