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
2be136b6
Commit
2be136b6
authored
Nov 20, 2019
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests that rely on a specific tags list
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
4b9d7b80
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
37 additions
and
37 deletions
+37
-37
spec/controllers/projects/tags_controller_spec.rb
spec/controllers/projects/tags_controller_spec.rb
+1
-1
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+1
-2
spec/features/projects/tags/user_edits_tags_spec.rb
spec/features/projects/tags/user_edits_tags_spec.rb
+5
-7
spec/features/tags/developer_deletes_tag_spec.rb
spec/features/tags/developer_deletes_tag_spec.rb
+4
-4
spec/features/tags/developer_updates_tag_spec.rb
spec/features/tags/developer_updates_tag_spec.rb
+1
-3
spec/finders/tags_finder_spec.rb
spec/finders/tags_finder_spec.rb
+14
-13
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+5
-3
spec/requests/api/tags_spec.rb
spec/requests/api/tags_spec.rb
+6
-4
No files found.
spec/controllers/projects/tags_controller_spec.rb
View file @
2be136b6
...
@@ -13,7 +13,7 @@ describe Projects::TagsController do
...
@@ -13,7 +13,7 @@ describe Projects::TagsController do
end
end
it
'returns the tags for the page'
do
it
'returns the tags for the page'
do
expect
(
assigns
(
:tags
).
map
(
&
:name
)).
to
eq
([
'v1.1.0'
,
'v1.0.0'
]
)
expect
(
assigns
(
:tags
).
map
(
&
:name
)).
to
include
(
'v1.1.0'
,
'v1.0.0'
)
end
end
it
'returns releases matching those tags'
do
it
'returns releases matching those tags'
do
...
...
spec/controllers/projects_controller_spec.rb
View file @
2be136b6
...
@@ -837,8 +837,7 @@ describe ProjectsController do
...
@@ -837,8 +837,7 @@ describe ProjectsController do
get
:refs
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
,
sort:
'updated_desc'
}
get
:refs
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
,
sort:
'updated_desc'
}
expect
(
json_response
[
'Branches'
]).
to
include
(
'master'
)
expect
(
json_response
[
'Branches'
]).
to
include
(
'master'
)
expect
(
json_response
[
'Tags'
].
first
).
to
eq
(
'v1.1.0'
)
expect
(
json_response
[
'Tags'
]).
to
include
(
'v1.0.0'
)
expect
(
json_response
[
'Tags'
].
last
).
to
eq
(
'v1.0.0'
)
expect
(
json_response
[
'Commits'
]).
to
be_nil
expect
(
json_response
[
'Commits'
]).
to
be_nil
end
end
...
...
spec/features/projects/tags/user_edits_tags_spec.rb
View file @
2be136b6
...
@@ -21,23 +21,21 @@ describe 'Project > Tags', :js do
...
@@ -21,23 +21,21 @@ describe 'Project > Tags', :js do
context
'page with tags list'
do
context
'page with tags list'
do
it
'shows tag name'
do
it
'shows tag name'
do
page
.
within
first
(
'.tags > .content-list > li'
)
do
expect
(
page
).
to
have_content
'v1.1.0 Version 1.1.0'
expect
(
page
.
find
(
'.row-main-content'
)).
to
have_content
'v1.1.0 Version 1.1.0'
end
end
end
it
'shows tag edit button'
do
it
'shows tag edit button'
do
page
.
within
first
(
'.tags > .content-list > li'
)
do
page
.
within
'.tags > .content-list'
do
edit_btn
=
page
.
find
(
'.row-fixed-content.controls a.btn-edit'
)
edit_btn
=
page
.
find
(
"li > .row-fixed-content.controls a.btn-edit[href='/
#{
project
.
full_path
}
/-/tags/v1.1.0/release/edit']"
)
expect
(
edit_btn
[
'href'
]).
to
have_content
'/tags/v1.1.0/release/edit'
expect
(
edit_btn
[
'href'
]).
to
end_with
(
"/
#{
project
.
full_path
}
/-/tags/v1.1.0/release/edit"
)
end
end
end
end
end
end
context
'edit tag release notes'
do
context
'edit tag release notes'
do
before
do
before
do
find
(
'.tags > .content-list > li:first-child .row-fixed-content.controls a.btn-edit'
).
click
page
.
find
(
"li > .row-fixed-content.controls a.btn-edit[href='/
#{
project
.
full_path
}
/-/tags/v1.1.0/release/edit']"
).
click
end
end
it
'shows tag name header'
do
it
'shows tag name header'
do
...
...
spec/features/tags/developer_deletes_tag_spec.rb
View file @
2be136b6
...
@@ -17,7 +17,7 @@ describe 'Developer deletes tag' do
...
@@ -17,7 +17,7 @@ describe 'Developer deletes tag' do
it
'deletes the tag'
do
it
'deletes the tag'
do
expect
(
page
).
to
have_content
'v1.1.0'
expect
(
page
).
to
have_content
'v1.1.0'
delete_
first_tag
delete_
tag
'v1.1.0'
expect
(
page
).
not_to
have_content
'v1.1.0'
expect
(
page
).
not_to
have_content
'v1.1.0'
end
end
...
@@ -46,15 +46,15 @@ describe 'Developer deletes tag' do
...
@@ -46,15 +46,15 @@ describe 'Developer deletes tag' do
end
end
it
'shows the error message'
do
it
'shows the error message'
do
delete_
first_tag
delete_
tag
'v1.1.0'
expect
(
page
).
to
have_content
(
'Do not delete tags'
)
expect
(
page
).
to
have_content
(
'Do not delete tags'
)
end
end
end
end
def
delete_
first_tag
def
delete_
tag
(
tag
)
page
.
within
(
'.content'
)
do
page
.
within
(
'.content'
)
do
accept_confirm
{
fi
rst
(
'.btn-remove'
).
click
}
accept_confirm
{
fi
nd
(
"li > .row-fixed-content.controls a.btn-remove[href='/
#{
project
.
full_path
}
/-/tags/
#{
tag
}
']"
).
click
}
end
end
end
end
end
end
spec/features/tags/developer_updates_tag_spec.rb
View file @
2be136b6
...
@@ -15,9 +15,7 @@ describe 'Developer updates tag' do
...
@@ -15,9 +15,7 @@ describe 'Developer updates tag' do
context
'from the tags list page'
do
context
'from the tags list page'
do
it
'updates the release notes'
do
it
'updates the release notes'
do
page
.
within
(
first
(
'.content-list .controls'
))
do
find
(
"li > .row-fixed-content.controls a.btn-edit[href='/
#{
project
.
full_path
}
/-/tags/v1.1.0/release/edit']"
).
click
click_link
'Edit release notes'
end
fill_in
'release_description'
,
with:
'Awesome release notes'
fill_in
'release_description'
,
with:
'Awesome release notes'
click_button
'Save changes'
click_button
'Save changes'
...
...
spec/finders/tags_finder_spec.rb
View file @
2be136b6
...
@@ -95,24 +95,25 @@ describe TagsFinder do
...
@@ -95,24 +95,25 @@ describe TagsFinder do
end
end
context
'filter and sort'
do
context
'filter and sort'
do
it
'filters tags by name and sorts by recently_updated'
do
let
(
:tags_to_compare
)
{
%w[v1.0.0 v1.1.0]
}
params
=
{
sort:
'updated_desc'
,
search:
'v1'
}
subject
{
described_class
.
new
(
repository
,
params
).
execute
.
select
{
|
tag
|
tags_to_compare
.
include?
(
tag
.
name
)
}
}
tags_finder
=
described_class
.
new
(
repository
,
params
)
result
=
tags_finder
.
execute
context
'when sort by updated_desc'
do
let
(
:params
)
{
{
sort:
'updated_desc'
,
search:
'v1'
}
}
expect
(
result
.
first
.
name
).
to
eq
(
'v1.1.0'
)
it
'filters tags by name'
do
expect
(
result
.
count
).
to
eq
(
2
)
expect
(
subject
.
first
.
name
).
to
eq
(
'v1.1.0'
)
expect
(
subject
.
count
).
to
eq
(
2
)
end
end
end
it
'filters tags by name and sorts by last_updated'
do
context
'when sort by updated_asc'
do
params
=
{
sort:
'updated_asc'
,
search:
'v1'
}
let
(
:params
)
{
{
sort:
'updated_asc'
,
search:
'v1'
}
}
tags_finder
=
described_class
.
new
(
repository
,
params
)
result
=
tags_finder
.
execute
expect
(
result
.
first
.
name
).
to
eq
(
'v1.0.0'
)
it
'filters tags by name'
do
expect
(
result
.
count
).
to
eq
(
2
)
expect
(
subject
.
first
.
name
).
to
eq
(
'v1.0.0'
)
expect
(
subject
.
count
).
to
eq
(
2
)
end
end
end
end
end
end
end
...
...
spec/models/repository_spec.rb
View file @
2be136b6
...
@@ -66,14 +66,16 @@ describe Repository do
...
@@ -66,14 +66,16 @@ describe Repository do
end
end
describe
'tags_sorted_by'
do
describe
'tags_sorted_by'
do
let
(
:tags_to_compare
)
{
%w[v1.0.0 v1.1.0]
}
context
'name_desc'
do
context
'name_desc'
do
subject
{
repository
.
tags_sorted_by
(
'name_desc'
).
map
(
&
:name
)
}
subject
{
repository
.
tags_sorted_by
(
'name_desc'
).
map
(
&
:name
)
&
tags_to_compare
}
it
{
is_expected
.
to
eq
([
'v1.1.0'
,
'v1.0.0'
])
}
it
{
is_expected
.
to
eq
([
'v1.1.0'
,
'v1.0.0'
])
}
end
end
context
'name_asc'
do
context
'name_asc'
do
subject
{
repository
.
tags_sorted_by
(
'name_asc'
).
map
(
&
:name
)
}
subject
{
repository
.
tags_sorted_by
(
'name_asc'
).
map
(
&
:name
)
&
tags_to_compare
}
it
{
is_expected
.
to
eq
([
'v1.0.0'
,
'v1.1.0'
])
}
it
{
is_expected
.
to
eq
([
'v1.0.0'
,
'v1.1.0'
])
}
end
end
...
@@ -115,7 +117,7 @@ describe Repository do
...
@@ -115,7 +117,7 @@ describe Repository do
context
'annotated tag pointing to a blob'
do
context
'annotated tag pointing to a blob'
do
let
(
:annotated_tag_name
)
{
'annotated-tag'
}
let
(
:annotated_tag_name
)
{
'annotated-tag'
}
subject
{
repository
.
tags_sorted_by
(
'updated_asc'
).
map
(
&
:name
)
}
subject
{
repository
.
tags_sorted_by
(
'updated_asc'
).
map
(
&
:name
)
&
(
tags_to_compare
+
[
annotated_tag_name
])
}
before
do
before
do
options
=
{
message:
'test tag message\n'
,
options
=
{
message:
'test tag message\n'
,
...
...
spec/requests/api/tags_spec.rb
View file @
2be136b6
...
@@ -7,6 +7,7 @@ describe API::Tags do
...
@@ -7,6 +7,7 @@ describe API::Tags do
let
(
:guest
)
{
create
(
:user
).
tap
{
|
u
|
project
.
add_guest
(
u
)
}
}
let
(
:guest
)
{
create
(
:user
).
tap
{
|
u
|
project
.
add_guest
(
u
)
}
}
let
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
,
path:
'my.project'
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
,
path:
'my.project'
)
}
let
(
:tag_name
)
{
project
.
repository
.
find_tag
(
'v1.1.0'
).
name
}
let
(
:tag_name
)
{
project
.
repository
.
find_tag
(
'v1.1.0'
).
name
}
let
(
:tag_message
)
{
project
.
repository
.
find_tag
(
'v1.1.0'
).
message
}
let
(
:project_id
)
{
project
.
id
}
let
(
:project_id
)
{
project
.
id
}
let
(
:current_user
)
{
nil
}
let
(
:current_user
)
{
nil
}
...
@@ -75,7 +76,7 @@ describe API::Tags do
...
@@ -75,7 +76,7 @@ describe API::Tags do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/tags'
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/tags'
)
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
tag_name
)
expect
(
json_response
.
map
{
|
r
|
r
[
'name'
]
}).
to
include
(
tag_name
)
end
end
context
'when repository is disabled'
do
context
'when repository is disabled'
do
...
@@ -135,9 +136,10 @@ describe API::Tags do
...
@@ -135,9 +136,10 @@ describe API::Tags do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/tags'
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/tags'
)
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
tag_name
)
expect
(
json_response
.
first
[
'message'
]).
to
eq
(
'Version 1.1.0'
)
expected_tag
=
json_response
.
find
{
|
r
|
r
[
'name'
]
==
tag_name
}
expect
(
json_response
.
first
[
'release'
][
'description'
]).
to
eq
(
description
)
expect
(
expected_tag
[
'message'
]).
to
eq
(
tag_message
)
expect
(
expected_tag
[
'release'
][
'description'
]).
to
eq
(
description
)
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