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
c5e0bd56
Commit
c5e0bd56
authored
Aug 24, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extract shared example
parent
64855c8e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
20 deletions
+19
-20
spec/lib/gitlab/gpg/commit_spec.rb
spec/lib/gitlab/gpg/commit_spec.rb
+19
-20
No files found.
spec/lib/gitlab/gpg/commit_spec.rb
View file @
c5e0bd56
...
...
@@ -2,6 +2,19 @@ require 'rails_helper'
describe
Gitlab
::
Gpg
::
Commit
do
describe
'#signature'
do
shared_examples
'returns the cached signature on second call'
do
it
'returns the cached signature on second call'
do
gpg_commit
=
described_class
.
new
(
commit
)
expect
(
gpg_commit
).
to
receive
(
:using_keychain
).
and_call_original
gpg_commit
.
signature
# consecutive call
expect
(
gpg_commit
).
not_to
receive
(
:using_keychain
).
and_call_original
gpg_commit
.
signature
end
end
let!
(
:project
)
{
create
:project
,
:repository
,
path:
'sample-project'
}
let!
(
:commit_sha
)
{
'0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
}
...
...
@@ -48,16 +61,7 @@ describe Gitlab::Gpg::Commit do
)
end
it
'returns the cached signature on second call'
do
gpg_commit
=
described_class
.
new
(
commit
)
expect
(
gpg_commit
).
to
receive
(
:using_keychain
).
and_call_original
gpg_commit
.
signature
# consecutive call
expect
(
gpg_commit
).
not_to
receive
(
:using_keychain
).
and_call_original
gpg_commit
.
signature
end
it_behaves_like
'returns the cached signature on second call'
end
context
'user does not match the committer'
do
...
...
@@ -92,6 +96,8 @@ describe Gitlab::Gpg::Commit do
verification_status:
'other_user'
)
end
it_behaves_like
'returns the cached signature on second call'
end
end
...
...
@@ -127,6 +133,8 @@ describe Gitlab::Gpg::Commit do
verification_status:
'unverified_key'
)
end
it_behaves_like
'returns the cached signature on second call'
end
end
...
...
@@ -157,16 +165,7 @@ describe Gitlab::Gpg::Commit do
)
end
it
'returns the cached signature on second call'
do
gpg_commit
=
described_class
.
new
(
commit
)
expect
(
gpg_commit
).
to
receive
(
:using_keychain
).
and_call_original
gpg_commit
.
signature
# consecutive call
expect
(
gpg_commit
).
not_to
receive
(
:using_keychain
).
and_call_original
gpg_commit
.
signature
end
it_behaves_like
'returns the cached signature on second call'
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