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
6d15f23e
Commit
6d15f23e
authored
Dec 05, 2019
by
Etienne Baqué
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed merge request search page
Fixed query in issuable concern file. Added tests accordingly.
parent
5cc4a92b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
16 deletions
+32
-16
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+1
-1
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+31
-15
No files found.
app/models/concerns/issuable.rb
View file @
6d15f23e
...
...
@@ -128,7 +128,7 @@ module Issuable
end
scope
:joins_milestone_releases
,
->
do
joins
(
"JOIN milestone_releases ON
issues
.milestone_id = milestone_releases.milestone_id
joins
(
"JOIN milestone_releases ON
#{
table_name
}
.milestone_id = milestone_releases.milestone_id
JOIN releases ON milestone_releases.release_id = releases.id"
).
distinct
end
...
...
spec/models/concerns/issuable_spec.rb
View file @
6d15f23e
...
...
@@ -3,6 +3,8 @@
require
'spec_helper'
describe
Issuable
do
include
ProjectForksHelper
let
(
:issuable_class
)
{
Issue
}
let
(
:issue
)
{
create
(
:issue
,
title:
'An issue'
,
description:
'A description'
)
}
let
(
:user
)
{
create
(
:user
)
}
...
...
@@ -855,6 +857,7 @@ describe Issuable do
describe
'release scopes'
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let
(
:forked_project
)
{
fork_project
(
project
)
}
let_it_be
(
:release_1
)
{
create
(
:release
,
tag:
'v1.0'
,
project:
project
)
}
let_it_be
(
:release_2
)
{
create
(
:release
,
tag:
'v2.0'
,
project:
project
)
}
...
...
@@ -875,52 +878,65 @@ describe Issuable do
let_it_be
(
:issue_5
)
{
create
(
:issue
,
milestone:
milestone_6
,
project:
project
)
}
let_it_be
(
:issue_6
)
{
create
(
:issue
,
project:
project
)
}
let_it_be
(
:items
)
{
Issue
.
all
}
let
(
:mr_1
)
{
create
(
:merge_request
,
milestone:
milestone_1
,
target_project:
project
,
source_project:
project
)
}
let
(
:mr_2
)
{
create
(
:merge_request
,
milestone:
milestone_3
,
target_project:
project
,
source_project:
forked_project
)
}
let
(
:mr_3
)
{
create
(
:merge_request
,
target_project:
project
,
source_project:
project
)
}
let_it_be
(
:issue_items
)
{
Issue
.
all
}
let
(
:mr_items
)
{
MergeRequest
.
all
}
describe
'#without_release'
do
it
'returns the issues not tied to any milestone and the ones tied to milestone with no release'
do
expect
(
items
.
without_release
).
to
contain_exactly
(
issue_5
,
issue_6
)
it
'returns the issues or mrs not tied to any milestone and the ones tied to milestone with no release'
do
expect
(
issue_items
.
without_release
).
to
contain_exactly
(
issue_5
,
issue_6
)
expect
(
mr_items
.
without_release
).
to
contain_exactly
(
mr_3
)
end
end
describe
'#any_release'
do
it
'returns all issues tied to a release'
do
expect
(
items
.
any_release
).
to
contain_exactly
(
issue_1
,
issue_2
,
issue_3
,
issue_4
)
it
'returns all issues or all mrs tied to a release'
do
expect
(
issue_items
.
any_release
).
to
contain_exactly
(
issue_1
,
issue_2
,
issue_3
,
issue_4
)
expect
(
mr_items
.
any_release
).
to
contain_exactly
(
mr_1
,
mr_2
)
end
end
describe
'#with_release'
do
it
'returns the issues tied a specfic release'
do
expect
(
items
.
with_release
(
'v1.0'
,
project
.
id
)).
to
contain_exactly
(
issue_1
,
issue_2
,
issue_3
)
it
'returns the issues tied to a specfic release'
do
expect
(
issue_items
.
with_release
(
'v1.0'
,
project
.
id
)).
to
contain_exactly
(
issue_1
,
issue_2
,
issue_3
)
end
it
'returns the mrs tied to a specific release'
do
expect
(
mr_items
.
with_release
(
'v1.0'
,
project
.
id
)).
to
contain_exactly
(
mr_1
)
end
context
'when a release has a milestone with one issue and another one with no issue'
do
it
'returns that one issue'
do
expect
(
items
.
with_release
(
'v2.0'
,
project
.
id
)).
to
contain_exactly
(
issue_3
)
expect
(
i
ssue_i
tems
.
with_release
(
'v2.0'
,
project
.
id
)).
to
contain_exactly
(
issue_3
)
end
context
'when the milestone with no issue is added as a filter'
do
it
'returns an empty list'
do
expect
(
items
.
with_release
(
'v2.0'
,
project
.
id
).
with_milestone
(
'm3'
)).
to
be_empty
expect
(
i
ssue_i
tems
.
with_release
(
'v2.0'
,
project
.
id
).
with_milestone
(
'm3'
)).
to
be_empty
end
end
context
'when the milestone with the issue is added as a filter'
do
it
'returns this issue'
do
expect
(
items
.
with_release
(
'v2.0'
,
project
.
id
).
with_milestone
(
'm2'
)).
to
contain_exactly
(
issue_3
)
expect
(
i
ssue_i
tems
.
with_release
(
'v2.0'
,
project
.
id
).
with_milestone
(
'm2'
)).
to
contain_exactly
(
issue_3
)
end
end
end
context
'when there is no issue under a specific release'
do
it
'returns no issue'
do
expect
(
items
.
with_release
(
'v4.0'
,
project
.
id
)).
to
be_empty
context
'when there is no issue or mr under a specific release'
do
it
'returns no issue or no mr'
do
expect
(
issue_items
.
with_release
(
'v4.0'
,
project
.
id
)).
to
be_empty
expect
(
mr_items
.
with_release
(
'v4.0'
,
project
.
id
)).
to
be_empty
end
end
context
'when a non-existent release tag is passed in'
do
it
'returns no issue'
do
expect
(
items
.
with_release
(
'v999.0'
,
project
.
id
)).
to
be_empty
it
'returns no issue or no mr'
do
expect
(
issue_items
.
with_release
(
'v999.0'
,
project
.
id
)).
to
be_empty
expect
(
mr_items
.
with_release
(
'v999.0'
,
project
.
id
)).
to
be_empty
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