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
0
Merge Requests
0
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
iv
gitlab-ce
Commits
2770de96
Commit
2770de96
authored
Feb 17, 2016
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reopened MRs should also be considered as open.
parent
ff28ac9c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
app/models/merge_request.rb
app/models/merge_request.rb
+1
-1
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+34
-0
No files found.
app/models/merge_request.rb
View file @
2770de96
...
...
@@ -137,7 +137,7 @@ class MergeRequest < ActiveRecord::Base
scope
:by_milestone
,
->
(
milestone
)
{
where
(
milestone_id:
milestone
)
}
scope
:in_projects
,
->
(
project_ids
)
{
where
(
"source_project_id in (:project_ids) OR target_project_id in (:project_ids)"
,
project_ids:
project_ids
)
}
scope
:of_projects
,
->
(
ids
)
{
where
(
target_project_id:
ids
)
}
scope
:opened
,
->
{
with_state
(
:
opened
)
}
scope
:opened
,
->
{
with_state
s
(
:opened
,
:re
opened
)
}
scope
:merged
,
->
{
with_state
(
:merged
)
}
scope
:closed
,
->
{
with_state
(
:closed
)
}
scope
:closed_and_merged
,
->
{
with_states
(
:closed
,
:merged
)
}
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
2770de96
...
...
@@ -123,6 +123,40 @@ describe Projects::MergeRequestsController do
end
end
describe
'GET #index'
do
def
get_merge_requests
get
:index
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
state:
'opened'
end
context
'when filtering by opened state'
do
context
'with opened merge requests'
do
it
'should list those merge requests'
do
get_merge_requests
expect
(
assigns
(
:merge_requests
)).
to
include
(
merge_request
)
end
end
context
'with reopened merge requests'
do
before
do
merge_request
.
close!
merge_request
.
reopen!
end
it
'should list those merge requests'
do
get_merge_requests
expect
(
assigns
(
:merge_requests
)).
to
include
(
merge_request
)
end
end
end
end
describe
'GET diffs'
do
def
go
(
format:
'html'
)
get
:diffs
,
...
...
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