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
cfd475a4
Commit
cfd475a4
authored
Aug 15, 2017
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes default scope from sortable
parent
d1b60cbc
Changes
38
Hide whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
67 additions
and
53 deletions
+67
-53
app/controllers/admin/broadcast_messages_controller.rb
app/controllers/admin/broadcast_messages_controller.rb
+1
-1
app/controllers/admin/dashboard_controller.rb
app/controllers/admin/dashboard_controller.rb
+3
-3
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+1
-1
app/controllers/dashboard/groups_controller.rb
app/controllers/dashboard/groups_controller.rb
+3
-1
app/controllers/profiles/emails_controller.rb
app/controllers/profiles/emails_controller.rb
+1
-1
app/controllers/profiles/keys_controller.rb
app/controllers/profiles/keys_controller.rb
+1
-1
app/controllers/projects/merge_requests/diffs_controller.rb
app/controllers/projects/merge_requests/diffs_controller.rb
+1
-1
app/controllers/projects/project_members_controller.rb
app/controllers/projects/project_members_controller.rb
+4
-0
app/finders/move_to_project_finder.rb
app/finders/move_to_project_finder.rb
+1
-0
app/finders/projects_finder.rb
app/finders/projects_finder.rb
+1
-1
app/finders/todos_finder.rb
app/finders/todos_finder.rb
+1
-1
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+1
-1
app/helpers/search_helper.rb
app/helpers/search_helper.rb
+2
-2
app/models/broadcast_message.rb
app/models/broadcast_message.rb
+1
-1
app/models/concerns/sortable.rb
app/models/concerns/sortable.rb
+0
-4
app/models/user.rb
app/models/user.rb
+6
-4
app/services/quick_actions/interpret_service.rb
app/services/quick_actions/interpret_service.rb
+1
-1
app/views/projects/project_members/import.html.haml
app/views/projects/project_members/import.html.haml
+1
-1
changelogs/unreleased/23079-remove-default-scope-in-sortable.yml
...ogs/unreleased/23079-remove-default-scope-in-sortable.yml
+5
-0
features/steps/project/fork.rb
features/steps/project/fork.rb
+1
-1
lib/api/broadcast_messages.rb
lib/api/broadcast_messages.rb
+1
-1
lib/api/merge_request_diffs.rb
lib/api/merge_request_diffs.rb
+1
-1
lib/api/milestone_responses.rb
lib/api/milestone_responses.rb
+1
-1
lib/api/v3/merge_request_diffs.rb
lib/api/v3/merge_request_diffs.rb
+1
-1
lib/api/v3/milestones.rb
lib/api/v3/milestones.rb
+1
-0
lib/api/v3/projects.rb
lib/api/v3/projects.rb
+1
-1
spec/features/projects/import_export/import_file_spec.rb
spec/features/projects/import_export/import_file_spec.rb
+3
-4
spec/finders/group_members_finder_spec.rb
spec/finders/group_members_finder_spec.rb
+2
-2
spec/finders/members_finder_spec.rb
spec/finders/members_finder_spec.rb
+1
-1
spec/models/namespace_spec.rb
spec/models/namespace_spec.rb
+1
-1
spec/models/user_spec.rb
spec/models/user_spec.rb
+1
-1
spec/requests/api/merge_request_diffs_spec.rb
spec/requests/api/merge_request_diffs_spec.rb
+1
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+2
-2
spec/requests/api/v3/merge_request_diffs_spec.rb
spec/requests/api/v3/merge_request_diffs_spec.rb
+1
-1
spec/requests/projects/cycle_analytics_events_spec.rb
spec/requests/projects/cycle_analytics_events_spec.rb
+1
-1
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+2
-2
spec/support/controllers/githubish_import_controller_shared_examples.rb
...ontrollers/githubish_import_controller_shared_examples.rb
+8
-6
spec/workers/post_receive_spec.rb
spec/workers/post_receive_spec.rb
+2
-0
No files found.
app/controllers/admin/broadcast_messages_controller.rb
View file @
cfd475a4
...
...
@@ -2,7 +2,7 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController
before_action
:finder
,
only:
[
:edit
,
:update
,
:destroy
]
def
index
@broadcast_messages
=
BroadcastMessage
.
reorder
(
"ends_at DESC"
).
page
(
params
[
:page
])
@broadcast_messages
=
BroadcastMessage
.
order
(
ends_at: :desc
).
page
(
params
[
:page
])
@broadcast_message
=
BroadcastMessage
.
new
end
...
...
app/controllers/admin/dashboard_controller.rb
View file @
cfd475a4
class
Admin::DashboardController
<
Admin
::
ApplicationController
def
index
@projects
=
Project
.
without_deleted
.
with_route
.
limit
(
10
)
@users
=
User
.
limit
(
10
)
@groups
=
Group
.
with_route
.
limit
(
10
)
@projects
=
Project
.
order_id_desc
.
without_deleted
.
with_route
.
limit
(
10
)
@users
=
User
.
order_id_desc
.
limit
(
10
)
@groups
=
Group
.
order_id_desc
.
with_route
.
limit
(
10
)
end
end
app/controllers/admin/users_controller.rb
View file @
cfd475a4
...
...
@@ -17,7 +17,7 @@ class Admin::UsersController < Admin::ApplicationController
end
def
keys
@keys
=
user
.
keys
@keys
=
user
.
keys
.
order_id_desc
end
def
new
...
...
app/controllers/dashboard/groups_controller.rb
View file @
cfd475a4
class
Dashboard::GroupsController
<
Dashboard
::
ApplicationController
def
index
@sort
=
params
[
:sort
]
||
'id_desc'
@groups
=
if
params
[
:parent_id
]
&&
Group
.
supports_nested_groups?
parent
=
Group
.
find_by
(
id:
params
[
:parent_id
])
...
...
@@ -15,7 +17,7 @@ class Dashboard::GroupsController < Dashboard::ApplicationController
@groups
=
@groups
.
search
(
params
[
:filter_groups
])
if
params
[
:filter_groups
].
present?
@groups
=
@groups
.
includes
(
:route
)
@groups
=
@groups
.
sort
(
@sort
=
params
[
:sort
]
)
@groups
=
@groups
.
sort
(
@sort
)
@groups
=
@groups
.
page
(
params
[
:page
])
respond_to
do
|
format
|
...
...
app/controllers/profiles/emails_controller.rb
View file @
cfd475a4
class
Profiles::EmailsController
<
Profiles
::
ApplicationController
def
index
@primary
=
current_user
.
email
@emails
=
current_user
.
emails
@emails
=
current_user
.
emails
.
order_id_desc
end
def
create
...
...
app/controllers/profiles/keys_controller.rb
View file @
cfd475a4
...
...
@@ -2,7 +2,7 @@ class Profiles::KeysController < Profiles::ApplicationController
skip_before_action
:authenticate_user!
,
only:
[
:get_keys
]
def
index
@keys
=
current_user
.
keys
@keys
=
current_user
.
keys
.
order_id_desc
@key
=
Key
.
new
end
...
...
app/controllers/projects/merge_requests/diffs_controller.rb
View file @
cfd475a4
...
...
@@ -27,7 +27,7 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
@merge_request
.
merge_request_diff
end
@merge_request_diffs
=
@merge_request
.
merge_request_diffs
.
viewable
.
select_without_diff
@merge_request_diffs
=
@merge_request
.
merge_request_diffs
.
viewable
.
select_without_diff
.
order_id_desc
@comparable_diffs
=
@merge_request_diffs
.
select
{
|
diff
|
diff
.
id
<
@merge_request_diff
.
id
}
if
params
[
:start_sha
].
present?
...
...
app/controllers/projects/project_members_controller.rb
View file @
cfd475a4
...
...
@@ -47,6 +47,10 @@ class Projects::ProjectMembersController < Projects::ApplicationController
end
end
def
import
@projects
=
current_user
.
authorized_projects
.
order_id_desc
end
def
apply_import
source_project
=
Project
.
find
(
params
[
:source_project_id
])
...
...
app/finders/move_to_project_finder.rb
View file @
cfd475a4
...
...
@@ -9,6 +9,7 @@ class MoveToProjectFinder
projects
=
@user
.
projects_where_can_admin_issues
projects
=
projects
.
search
(
search
)
if
search
.
present?
projects
=
projects
.
excluding_project
(
from_project
)
projects
=
projects
.
order_id_desc
# infinite scroll using offset
projects
=
projects
.
where
(
'projects.id < ?'
,
offset_id
)
if
offset_id
.
present?
...
...
app/finders/projects_finder.rb
View file @
cfd475a4
...
...
@@ -121,7 +121,7 @@ class ProjectsFinder < UnionFinder
end
def
sort
(
items
)
params
[
:sort
].
present?
?
items
.
sort
(
params
[
:sort
])
:
items
params
[
:sort
].
present?
?
items
.
sort
(
params
[
:sort
])
:
items
.
order_id_desc
end
def
by_archived
(
projects
)
...
...
app/finders/todos_finder.rb
View file @
cfd475a4
...
...
@@ -118,7 +118,7 @@ class TodosFinder
end
def
sort
(
items
)
params
[
:sort
]
?
items
.
sort
(
params
[
:sort
])
:
items
.
reorder
(
id: :desc
)
params
[
:sort
]
?
items
.
sort
(
params
[
:sort
])
:
items
.
order_id_desc
end
def
by_action
(
items
)
...
...
app/helpers/issues_helper.rb
View file @
cfd475a4
...
...
@@ -56,7 +56,7 @@ module IssuesHelper
end
def
project_options
(
issuable
,
current_user
,
ability: :read_project
)
projects
=
current_user
.
authorized_projects
projects
=
current_user
.
authorized_projects
.
order_id_desc
projects
=
projects
.
select
do
|
project
|
current_user
.
can?
(
ability
,
project
)
end
...
...
app/helpers/search_helper.rb
View file @
cfd475a4
...
...
@@ -85,7 +85,7 @@ module SearchHelper
# Autocomplete results for the current user's groups
def
groups_autocomplete
(
term
,
limit
=
5
)
current_user
.
authorized_groups
.
search
(
term
).
limit
(
limit
).
map
do
|
group
|
current_user
.
authorized_groups
.
order_id_desc
.
search
(
term
).
limit
(
limit
).
map
do
|
group
|
{
category:
"Groups"
,
id:
group
.
id
,
...
...
@@ -97,7 +97,7 @@ module SearchHelper
# Autocomplete results for the current user's projects
def
projects_autocomplete
(
term
,
limit
=
5
)
current_user
.
authorized_projects
.
search_by_title
(
term
)
current_user
.
authorized_projects
.
order_id_desc
.
search_by_title
(
term
)
.
sorted_by_stars
.
non_archived
.
limit
(
limit
).
map
do
|
p
|
{
category:
"Projects"
,
...
...
app/models/broadcast_message.rb
View file @
cfd475a4
...
...
@@ -33,7 +33,7 @@ class BroadcastMessage < ActiveRecord::Base
end
def
self
.
current_and_future_messages
where
(
'ends_at > :now'
,
now:
Time
.
zone
.
now
).
reorder
(
id: :asc
)
where
(
'ends_at > :now'
,
now:
Time
.
zone
.
now
).
order_id_asc
end
def
active?
...
...
app/models/concerns/sortable.rb
View file @
cfd475a4
...
...
@@ -6,10 +6,6 @@ module Sortable
extend
ActiveSupport
::
Concern
included
do
# By default all models should be ordered
# by created_at field starting from newest
default_scope
{
order_id_desc
}
scope
:order_id_desc
,
->
{
reorder
(
id: :desc
)
}
scope
:order_id_asc
,
->
{
reorder
(
id: :asc
)
}
scope
:order_created_desc
,
->
{
reorder
(
created_at: :desc
)
}
...
...
app/models/user.rb
View file @
cfd475a4
...
...
@@ -70,7 +70,7 @@ class User < ActiveRecord::Base
#
# Namespace for personal projects
has_one
:namespace
,
->
{
where
type:
nil
},
dependent: :destroy
,
foreign_key: :owner_id
,
autosave:
true
# rubocop:disable Cop/ActiveRecordDependent
has_one
:namespace
,
->
{
where
(
type:
nil
)
},
dependent: :destroy
,
foreign_key: :owner_id
,
autosave:
true
# rubocop:disable Cop/ActiveRecordDependent
# Profile
has_many
:keys
,
->
do
...
...
@@ -255,11 +255,13 @@ class User < ActiveRecord::Base
end
def
sort
(
method
)
case
method
.
to_s
order_method
=
method
||
'id_desc'
case
order_method
.
to_s
when
'recent_sign_in'
then
order_recent_sign_in
when
'oldest_sign_in'
then
order_oldest_sign_in
else
order_by
(
method
)
order_by
(
order_
method
)
end
end
...
...
@@ -367,7 +369,7 @@ class User < ActiveRecord::Base
# Returns a user for the given SSH key.
def
find_by_ssh_key_id
(
key_id
)
find_by
(
id:
Key
.
unscoped
.
select
(
:user_id
).
where
(
id:
key_id
))
Key
.
find_by
(
id:
key_id
)
&
.
user
end
def
find_by_full_path
(
path
,
follow_redirects:
false
)
...
...
app/services/quick_actions/interpret_service.rb
View file @
cfd475a4
...
...
@@ -115,7 +115,7 @@ module QuickActions
if
issuable
.
allows_multiple_assignees?
issuable
.
assignees
.
pluck
(
:id
)
+
users
.
map
(
&
:id
)
else
[
users
.
la
st
.
id
]
[
users
.
fir
st
.
id
]
end
end
...
...
app/views/projects/project_members/import.html.haml
View file @
cfd475a4
...
...
@@ -8,7 +8,7 @@
=
form_tag
apply_import_project_project_members_path
(
@project
),
method:
'post'
,
class:
'form-horizontal'
do
.form-group
=
label_tag
:source_project_id
,
"Project"
,
class:
'control-label'
.col-sm-10
=
select_tag
(
:source_project_id
,
options_from_collection_for_select
(
current_user
.
authorized_
projects
,
:id
,
:name_with_namespace
),
prompt:
"Select project"
,
class:
"select2 lg"
,
required:
true
)
.col-sm-10
=
select_tag
(
:source_project_id
,
options_from_collection_for_select
(
@
projects
,
:id
,
:name_with_namespace
),
prompt:
"Select project"
,
class:
"select2 lg"
,
required:
true
)
.form-actions
=
button_tag
'Import project members'
,
class:
"btn btn-create"
...
...
changelogs/unreleased/23079-remove-default-scope-in-sortable.yml
0 → 100644
View file @
cfd475a4
---
title
:
Removes Sortable default scope.
merge_request
:
13558
author
:
type
:
fixed
features/steps/project/fork.rb
View file @
cfd475a4
...
...
@@ -52,7 +52,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps
end
step
'I visit the forks page of the "Shop" project'
do
@project
=
Project
.
where
(
name:
'Shop'
).
la
st
@project
=
Project
.
where
(
name:
'Shop'
).
fir
st
visit
project_forks_path
(
@project
)
end
...
...
lib/api/broadcast_messages.rb
View file @
cfd475a4
...
...
@@ -20,7 +20,7 @@ module API
use
:pagination
end
get
do
messages
=
BroadcastMessage
.
all
messages
=
BroadcastMessage
.
all
.
order_id_desc
present
paginate
(
messages
),
with:
Entities
::
BroadcastMessage
end
...
...
lib/api/merge_request_diffs.rb
View file @
cfd475a4
...
...
@@ -21,7 +21,7 @@ module API
get
":id/merge_requests/:merge_request_iid/versions"
do
merge_request
=
find_merge_request_with_access
(
params
[
:merge_request_iid
])
present
paginate
(
merge_request
.
merge_request_diffs
),
with:
Entities
::
MergeRequestDiff
present
paginate
(
merge_request
.
merge_request_diffs
.
order_id_desc
),
with:
Entities
::
MergeRequestDiff
end
desc
'Get a single merge request diff version'
do
...
...
lib/api/milestone_responses.rb
View file @
cfd475a4
...
...
@@ -28,7 +28,7 @@ module API
end
def
list_milestones_for
(
parent
)
milestones
=
parent
.
milestones
milestones
=
parent
.
milestones
.
order_id_desc
milestones
=
Milestone
.
filter_by_state
(
milestones
,
params
[
:state
])
milestones
=
filter_by_iid
(
milestones
,
params
[
:iids
])
if
params
[
:iids
].
present?
milestones
=
filter_by_search
(
milestones
,
params
[
:search
])
if
params
[
:search
]
...
...
lib/api/v3/merge_request_diffs.rb
View file @
cfd475a4
...
...
@@ -20,7 +20,7 @@ module API
get
":id/merge_requests/:merge_request_id/versions"
do
merge_request
=
find_merge_request_with_access
(
params
[
:merge_request_id
])
present
merge_request
.
merge_request_diffs
,
with:
::
API
::
Entities
::
MergeRequestDiff
present
merge_request
.
merge_request_diffs
.
order_id_desc
,
with:
::
API
::
Entities
::
MergeRequestDiff
end
desc
'Get a single merge request diff version'
do
...
...
lib/api/v3/milestones.rb
View file @
cfd475a4
...
...
@@ -34,6 +34,7 @@ module API
milestones
=
user_project
.
milestones
milestones
=
filter_milestones_state
(
milestones
,
params
[
:state
])
milestones
=
filter_by_iid
(
milestones
,
params
[
:iid
])
if
params
[
:iid
].
present?
milestones
=
milestones
.
order_id_desc
present
paginate
(
milestones
),
with:
::
API
::
Entities
::
Milestone
end
...
...
lib/api/v3/projects.rb
View file @
cfd475a4
...
...
@@ -119,7 +119,7 @@ module API
get
do
authenticate!
present_projects
current_user
.
authorized_projects
,
present_projects
current_user
.
authorized_projects
.
order_id_desc
,
with:
::
API
::
V3
::
Entities
::
ProjectWithAccess
end
...
...
spec/features/projects/import_export/import_file_spec.rb
View file @
cfd475a4
...
...
@@ -18,7 +18,7 @@ feature 'Import/Export - project import integration test', js: true do
context
'when selecting the namespace'
do
let
(
:user
)
{
create
(
:admin
)
}
let!
(
:namespace
)
{
create
(
:namespace
,
name:
'asd'
,
owner:
user
)
}
let!
(
:namespace
)
{
user
.
namespace
}
let
(
:project_path
)
{
'test-project-path'
+
SecureRandom
.
hex
}
context
'prefilled the path'
do
...
...
@@ -66,12 +66,11 @@ feature 'Import/Export - project import integration test', js: true do
end
scenario
'invalid project'
do
namespace
=
create
(
:namespace
,
name:
'asdf'
,
owner:
user
)
project
=
create
(
:project
,
namespace:
namespace
)
project
=
create
(
:project
,
namespace:
user
.
namespace
)
visit
new_project_path
select2
(
namespace
.
id
,
from:
'#project_namespace_id'
)
select2
(
user
.
namespace
.
id
,
from:
'#project_namespace_id'
)
fill_in
:project_path
,
with:
project
.
name
,
visible:
true
click_link
'GitLab export'
attach_file
(
'file'
,
file
)
...
...
spec/finders/group_members_finder_spec.rb
View file @
cfd475a4
...
...
@@ -15,7 +15,7 @@ describe GroupMembersFinder, '#execute' do
result
=
described_class
.
new
(
group
).
execute
expect
(
result
.
to_a
).
to
eq
([
member3
,
member2
,
member1
])
expect
(
result
.
to_a
).
to
match_array
([
member3
,
member2
,
member1
])
end
it
'returns members for nested group'
,
:nested_groups
do
...
...
@@ -27,6 +27,6 @@ describe GroupMembersFinder, '#execute' do
result
=
described_class
.
new
(
nested_group
).
execute
expect
(
result
.
to_a
).
to
eq
([
member4
,
member3
,
member1
])
expect
(
result
.
to_a
).
to
match_array
([
member1
,
member3
,
member4
])
end
end
spec/finders/members_finder_spec.rb
View file @
cfd475a4
...
...
@@ -17,6 +17,6 @@ describe MembersFinder, '#execute' do
result
=
described_class
.
new
(
project
,
user2
).
execute
expect
(
result
.
to_a
).
to
eq
([
member3
,
member2
,
member1
])
expect
(
result
.
to_a
).
to
match_array
([
member1
,
member2
,
member3
])
end
end
spec/models/namespace_spec.rb
View file @
cfd475a4
...
...
@@ -404,6 +404,6 @@ describe Namespace do
let!
(
:project1
)
{
create
(
:project_empty_repo
,
namespace:
group
)
}
let!
(
:project2
)
{
create
(
:project_empty_repo
,
namespace:
child
)
}
it
{
expect
(
group
.
all_projects
.
to_a
).
to
eq
([
project2
,
project1
])
}
it
{
expect
(
group
.
all_projects
.
to_a
).
to
match_array
([
project2
,
project1
])
}
end
end
spec/models/user_spec.rb
View file @
cfd475a4
...
...
@@ -1517,7 +1517,7 @@ describe User do
developer_project
=
create
(
:project
)
{
|
p
|
p
.
add_developer
(
user
)
}
master_project
=
create
(
:project
)
{
|
p
|
p
.
add_master
(
user
)
}
expect
(
user
.
projects_where_can_admin_issues
.
to_a
).
to
eq
([
master_project
,
developer_project
,
reporter_project
])
expect
(
user
.
projects_where_can_admin_issues
.
to_a
).
to
match_array
([
master_project
,
developer_project
,
reporter_project
])
expect
(
user
.
can?
(
:admin_issue
,
master_project
)).
to
eq
(
true
)
expect
(
user
.
can?
(
:admin_issue
,
developer_project
)).
to
eq
(
true
)
expect
(
user
.
can?
(
:admin_issue
,
reporter_project
)).
to
eq
(
true
)
...
...
spec/requests/api/merge_request_diffs_spec.rb
View file @
cfd475a4
...
...
@@ -14,7 +14,7 @@ describe API::MergeRequestDiffs, 'MergeRequestDiffs' do
describe
'GET /projects/:id/merge_requests/:merge_request_iid/versions'
do
it
'returns 200 for a valid merge request'
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/versions"
,
user
)
merge_request_diff
=
merge_request
.
merge_request_diffs
.
fir
st
merge_request_diff
=
merge_request
.
merge_request_diffs
.
la
st
expect
(
response
.
status
).
to
eq
200
expect
(
response
).
to
include_pagination_headers
...
...
spec/requests/api/projects_spec.rb
View file @
cfd475a4
...
...
@@ -574,7 +574,7 @@ describe API::Projects do
expect
{
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
name:
'Foo Project'
}.
to
change
{
Project
.
count
}.
by
(
1
)
expect
(
response
).
to
have_http_status
(
201
)
project
=
Project
.
fir
st
project
=
Project
.
la
st
expect
(
project
.
name
).
to
eq
(
'Foo Project'
)
expect
(
project
.
path
).
to
eq
(
'foo-project'
)
...
...
@@ -585,7 +585,7 @@ describe API::Projects do
.
to
change
{
Project
.
count
}.
by
(
1
)
expect
(
response
).
to
have_http_status
(
201
)
project
=
Project
.
fir
st
project
=
Project
.
la
st
expect
(
project
.
name
).
to
eq
(
'Foo Project'
)
expect
(
project
.
path
).
to
eq
(
'path-project-Foo'
)
...
...
spec/requests/api/v3/merge_request_diffs_spec.rb
View file @
cfd475a4
...
...
@@ -14,7 +14,7 @@ describe API::V3::MergeRequestDiffs, 'MergeRequestDiffs' do
describe
'GET /projects/:id/merge_requests/:merge_request_id/versions'
do
it
'returns 200 for a valid merge request'
do
get
v3_api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/versions"
,
user
)
merge_request_diff
=
merge_request
.
merge_request_diffs
.
fir
st
merge_request_diff
=
merge_request
.
merge_request_diffs
.
la
st
expect
(
response
.
status
).
to
eq
200
expect
(
json_response
.
size
).
to
eq
(
merge_request
.
merge_request_diffs
.
size
)
...
...
spec/requests/projects/cycle_analytics_events_spec.rb
View file @
cfd475a4
...
...
@@ -93,7 +93,7 @@ describe 'cycle analytics events' do
context
'with private project and builds'
do
before
do
project
.
members
.
fir
st
.
update
(
access_level:
Gitlab
::
Access
::
GUEST
)
project
.
members
.
la
st
.
update
(
access_level:
Gitlab
::
Access
::
GUEST
)
end
it
'does not list the test events'
do
...
...
spec/services/notification_service_spec.rb
View file @
cfd475a4
...
...
@@ -1237,7 +1237,7 @@ describe NotificationService, :mailer do
end
it
do
group_member
=
group
.
members
.
fir
st
group_member
=
group
.
members
.
la
st
expect
do
notification
.
decline_group_invite
(
group_member
)
...
...
@@ -1285,7 +1285,7 @@ describe NotificationService, :mailer do
end
it
do
project_member
=
project
.
members
.
fir
st
project_member
=
project
.
members
.
la
st
expect
do
notification
.
decline_project_invite
(
project_member
)
...
...
spec/support/controllers/githubish_import_controller_shared_examples.rb
View file @
cfd475a4
...
...
@@ -140,9 +140,14 @@ shared_examples 'a GitHub-ish import controller: POST create' do
end
context
"when a namespace with the provider user's username already exists"
do
let!
(
:existing_namespace
)
{
create
(
:namespace
,
name:
other_username
,
owner:
user
)
}
let!
(
:existing_namespace
)
{
user
.
namespace
}
context
"when the namespace is owned by the GitLab user"
do
before
do
user
.
username
=
other_username
user
.
save
end
it
"takes the existing namespace"
do
expect
(
Gitlab
::
GithubImport
::
ProjectCreator
)
.
to
receive
(
:new
).
with
(
provider_repo
,
provider_repo
.
name
,
existing_namespace
,
user
,
access_params
,
type:
provider
)
...
...
@@ -153,12 +158,9 @@ shared_examples 'a GitHub-ish import controller: POST create' do
end
context
"when the namespace is not owned by the GitLab user"
do
before
do
existing_namespace
.
owner
=
create
(
:user
)
existing_namespace
.
save
end
it
"creates a project using user's namespace"
do
create
(
:user
,
username:
other_username
)
expect
(
Gitlab
::
GithubImport
::
ProjectCreator
)
.
to
receive
(
:new
).
with
(
provider_repo
,
provider_repo
.
name
,
user
.
namespace
,
user
,
access_params
,
type:
provider
)
.
and_return
(
double
(
execute:
true
))
...
...
spec/workers/post_receive_spec.rb
View file @
cfd475a4
...
...
@@ -127,6 +127,7 @@ describe PostReceive do
it
"asks the project to trigger all hooks"
do
allow
(
Project
).
to
receive
(
:find_by
).
and_return
(
project
)
expect
(
project
).
to
receive
(
:execute_hooks
).
twice
expect
(
project
).
to
receive
(
:execute_services
).
twice
...
...
@@ -135,6 +136,7 @@ describe PostReceive do
it
"enqueues a UpdateMergeRequestsWorker job"
do
allow
(
Project
).
to
receive
(
:find_by
).
and_return
(
project
)
expect
(
UpdateMergeRequestsWorker
).
to
receive
(
:perform_async
).
with
(
project
.
id
,
project
.
owner
.
id
,
any_args
)
described_class
.
new
.
perform
(
gl_repository
,
key_id
,
base64_changes
)
...
...
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