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
046f4086
Commit
046f4086
authored
Apr 10, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve test examples for container repository class
parent
5fbeb73a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
spec/models/container_repository_spec.rb
spec/models/container_repository_spec.rb
+21
-21
No files found.
spec/models/container_repository_spec.rb
View file @
046f4086
...
@@ -4,7 +4,7 @@ describe ContainerRepository do
...
@@ -4,7 +4,7 @@ describe ContainerRepository do
let
(
:group
)
{
create
(
:group
,
name:
'group'
)
}
let
(
:group
)
{
create
(
:group
,
name:
'group'
)
}
let
(
:project
)
{
create
(
:project
,
path:
'test'
,
group:
group
)
}
let
(
:project
)
{
create
(
:project
,
path:
'test'
,
group:
group
)
}
let
(
:
container_
repository
)
do
let
(
:repository
)
do
create
(
:container_repository
,
name:
'my_image'
,
project:
project
)
create
(
:container_repository
,
name:
'my_image'
,
project:
project
)
end
end
...
@@ -23,48 +23,48 @@ describe ContainerRepository do
...
@@ -23,48 +23,48 @@ describe ContainerRepository do
describe
'associations'
do
describe
'associations'
do
it
'belongs to the project'
do
it
'belongs to the project'
do
expect
(
container_
repository
).
to
belong_to
(
:project
)
expect
(
repository
).
to
belong_to
(
:project
)
end
end
end
end
describe
'#tag'
do
describe
'#tag'
do
it
'has a test tag'
do
it
'has a test tag'
do
expect
(
container_
repository
.
tag
(
'test'
)).
not_to
be_nil
expect
(
repository
.
tag
(
'test'
)).
not_to
be_nil
end
end
end
end
describe
'#path'
do
describe
'#path'
do
it
'returns a full path to the repository'
do
it
'returns a full path to the repository'
do
expect
(
container_
repository
.
path
).
to
eq
(
'group/test/my_image'
)
expect
(
repository
.
path
).
to
eq
(
'group/test/my_image'
)
end
end
end
end
describe
'#manifest'
do
describe
'#manifest'
do
subject
{
container_repository
.
manifest
}
it
'returns non-empty manifest'
do
expect
(
repository
.
manifest
).
not_to
be_nil
it
{
is_expected
.
not_to
be_nil
}
end
end
end
describe
'#valid?'
do
describe
'#valid?'
do
subject
{
container_repository
.
valid?
}
it
'is a valid repository'
do
expect
(
repository
).
to
be_valid
it
{
is_expected
.
to
be_truthy
}
end
end
end
describe
'#tags'
do
describe
'#tags'
do
subject
{
container_repository
.
tags
}
it
'returns non-empty tags list'
do
expect
(
repository
.
tags
).
not_to
be_empty
it
{
is_expected
.
not_to
be_empty
}
end
end
end
describe
'#has_tags?'
do
describe
'#has_tags?'
do
it
'has tags'
do
it
'has tags'
do
expect
(
container_
repository
).
to
have_tags
expect
(
repository
).
to
have_tags
end
end
end
end
describe
'#delete_tags!'
do
describe
'#delete_tags!'
do
let
(
:
container_
repository
)
do
let
(
:repository
)
do
create
(
:container_repository
,
name:
'my_image'
,
create
(
:container_repository
,
name:
'my_image'
,
tags:
%w[latest rc1]
,
tags:
%w[latest rc1]
,
project:
project
)
project:
project
)
...
@@ -72,21 +72,21 @@ describe ContainerRepository do
...
@@ -72,21 +72,21 @@ describe ContainerRepository do
context
'when action succeeds'
do
context
'when action succeeds'
do
it
'returns status that indicates success'
do
it
'returns status that indicates success'
do
expect
(
container_
repository
.
client
)
expect
(
repository
.
client
)
.
to
receive
(
:delete_repository_tag
)
.
to
receive
(
:delete_repository_tag
)
.
and_return
(
true
)
.
and_return
(
true
)
expect
(
container_
repository
.
delete_tags!
).
to
be_truthy
expect
(
repository
.
delete_tags!
).
to
be_truthy
end
end
end
end
context
'when action fails'
do
context
'when action fails'
do
it
'returns status that indicates failure'
do
it
'returns status that indicates failure'
do
expect
(
container_
repository
.
client
)
expect
(
repository
.
client
)
.
to
receive
(
:delete_repository_tag
)
.
to
receive
(
:delete_repository_tag
)
.
and_return
(
false
)
.
and_return
(
false
)
expect
(
container_
repository
.
delete_tags!
).
to
be_falsey
expect
(
repository
.
delete_tags!
).
to
be_falsey
end
end
end
end
end
end
...
@@ -100,7 +100,7 @@ describe ContainerRepository do
...
@@ -100,7 +100,7 @@ describe ContainerRepository do
end
end
it
'returns a full location of the repository'
do
it
'returns a full location of the repository'
do
expect
(
container_
repository
.
location
)
expect
(
repository
.
location
)
.
to
eq
'registry.gitlab:5000/group/test/my_image'
.
to
eq
'registry.gitlab:5000/group/test/my_image'
end
end
end
end
...
@@ -117,7 +117,7 @@ describe ContainerRepository do
...
@@ -117,7 +117,7 @@ describe ContainerRepository do
context
'when repository is not a root repository'
do
context
'when repository is not a root repository'
do
it
'returns false'
do
it
'returns false'
do
expect
(
container_
repository
).
not_to
be_root_repository
expect
(
repository
).
not_to
be_root_repository
end
end
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