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
Tatuya Kamada
gitlab-ce
Commits
5c7f9d69
Commit
5c7f9d69
authored
Feb 22, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix code for cops
parent
02494f7c
Changes
44
Hide whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
245 additions
and
213 deletions
+245
-213
app/controllers/concerns/creates_commit.rb
app/controllers/concerns/creates_commit.rb
+8
-7
app/controllers/projects/git_http_client_controller.rb
app/controllers/projects/git_http_client_controller.rb
+6
-5
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+9
-8
app/controllers/sessions_controller.rb
app/controllers/sessions_controller.rb
+6
-5
app/finders/notes_finder.rb
app/finders/notes_finder.rb
+6
-5
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+6
-5
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+11
-10
app/helpers/submodule_helper.rb
app/helpers/submodule_helper.rb
+1
-1
app/mailers/repository_check_mailer.rb
app/mailers/repository_check_mailer.rb
+6
-5
app/models/commit.rb
app/models/commit.rb
+6
-5
app/models/concerns/case_sensitivity.rb
app/models/concerns/case_sensitivity.rb
+6
-5
app/models/concerns/sortable.rb
app/models/concerns/sortable.rb
+6
-5
app/models/network/graph.rb
app/models/network/graph.rb
+6
-5
app/models/project.rb
app/models/project.rb
+8
-7
app/models/project_services/pushover_service.rb
app/models/project_services/pushover_service.rb
+8
-7
app/services/system_note_service.rb
app/services/system_note_service.rb
+7
-6
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+23
-21
lib/api/api_guard.rb
lib/api/api_guard.rb
+1
-1
lib/api/award_emoji.rb
lib/api/award_emoji.rb
+1
-1
lib/banzai/filter/abstract_reference_filter.rb
lib/banzai/filter/abstract_reference_filter.rb
+6
-5
lib/banzai/filter/gollum_tags_filter.rb
lib/banzai/filter/gollum_tags_filter.rb
+6
-5
lib/banzai/filter/issue_reference_filter.rb
lib/banzai/filter/issue_reference_filter.rb
+6
-5
lib/gitlab/award_emoji.rb
lib/gitlab/award_emoji.rb
+6
-5
lib/gitlab/ci/config/entry/global.rb
lib/gitlab/ci/config/entry/global.rb
+1
-1
lib/gitlab/ci/config/entry/jobs.rb
lib/gitlab/ci/config/entry/jobs.rb
+1
-1
lib/gitlab/conflict/file.rb
lib/gitlab/conflict/file.rb
+6
-5
lib/gitlab/diff/position.rb
lib/gitlab/diff/position.rb
+10
-9
lib/gitlab/email/reply_parser.rb
lib/gitlab/email/reply_parser.rb
+6
-5
lib/gitlab/metrics/instrumentation.rb
lib/gitlab/metrics/instrumentation.rb
+6
-5
lib/gitlab/saml/user.rb
lib/gitlab/saml/user.rb
+6
-5
lib/gitlab/search_results.rb
lib/gitlab/search_results.rb
+12
-10
lib/gitlab/shell.rb
lib/gitlab/shell.rb
+1
-1
lib/gitlab/sherlock/query.rb
lib/gitlab/sherlock/query.rb
+6
-5
spec/features/issuables/issuable_list_spec.rb
spec/features/issuables/issuable_list_spec.rb
+6
-5
spec/helpers/issues_helper_spec.rb
spec/helpers/issues_helper_spec.rb
+1
-1
spec/lib/gitlab/ci/config/entry/global_spec.rb
spec/lib/gitlab/ci/config/entry/global_spec.rb
+2
-2
spec/lib/gitlab/ci/config/entry/job_spec.rb
spec/lib/gitlab/ci/config/entry/job_spec.rb
+5
-5
spec/lib/gitlab/ci/status/build/factory_spec.rb
spec/lib/gitlab/ci/status/build/factory_spec.rb
+1
-1
spec/lib/gitlab/incoming_email_spec.rb
spec/lib/gitlab/incoming_email_spec.rb
+2
-2
spec/lib/gitlab/o_auth/user_spec.rb
spec/lib/gitlab/o_auth/user_spec.rb
+2
-2
spec/lib/gitlab/saml/user_spec.rb
spec/lib/gitlab/saml/user_spec.rb
+3
-3
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+1
-1
spec/support/issuables_list_metadata_shared_examples.rb
spec/support/issuables_list_metadata_shared_examples.rb
+6
-5
spec/support/login_helpers.rb
spec/support/login_helpers.rb
+6
-5
No files found.
app/controllers/concerns/creates_commit.rb
View file @
5c7f9d69
...
@@ -101,13 +101,14 @@ module CreatesCommit
...
@@ -101,13 +101,14 @@ module CreatesCommit
# TODO: We should really clean this up
# TODO: We should really clean this up
def
set_commit_variables
def
set_commit_variables
@mr_source_project
=
if
can?
(
current_user
,
:push_code
,
@project
)
@mr_source_project
=
# Edit file in this project
if
can?
(
current_user
,
:push_code
,
@project
)
@project
# Edit file in this project
else
@project
# Merge request from fork to this project
else
current_user
.
fork_of
(
@project
)
# Merge request from fork to this project
end
current_user
.
fork_of
(
@project
)
end
# Merge request to this project
# Merge request to this project
@mr_target_project
=
@project
@mr_target_project
=
@project
...
...
app/controllers/projects/git_http_client_controller.rb
View file @
5c7f9d69
...
@@ -76,11 +76,12 @@ class Projects::GitHttpClientController < Projects::ApplicationController
...
@@ -76,11 +76,12 @@ class Projects::GitHttpClientController < Projects::ApplicationController
return
@project
if
defined?
(
@project
)
return
@project
if
defined?
(
@project
)
project_id
,
_
=
project_id_with_suffix
project_id
,
_
=
project_id_with_suffix
@project
=
if
project_id
.
blank?
@project
=
nil
if
project_id
.
blank?
else
nil
Project
.
find_by_full_path
(
"
#{
params
[
:namespace_id
]
}
/
#{
project_id
}
"
)
else
end
Project
.
find_by_full_path
(
"
#{
params
[
:namespace_id
]
}
/
#{
project_id
}
"
)
end
end
end
# This method returns two values so that we can parse
# This method returns two values so that we can parse
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
5c7f9d69
...
@@ -381,14 +381,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -381,14 +381,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
end
def
merge_widget_refresh
def
merge_widget_refresh
@status
=
if
merge_request
.
merge_when_build_succeeds
@status
=
:merge_when_build_succeeds
if
merge_request
.
merge_when_build_succeeds
else
:merge_when_build_succeeds
# Only MRs that can be merged end in this action
else
# MR can be already picked up for merge / merged already or can be waiting for worker to be picked up
# Only MRs that can be merged end in this action
# in last case it does not have any special status. Possible error is handled inside widget js function
# MR can be already picked up for merge / merged already or can be waiting for worker to be picked up
:success
# in last case it does not have any special status. Possible error is handled inside widget js function
end
:success
end
render
'merge'
render
'merge'
end
end
...
...
app/controllers/sessions_controller.rb
View file @
5c7f9d69
...
@@ -15,11 +15,12 @@ class SessionsController < Devise::SessionsController
...
@@ -15,11 +15,12 @@ class SessionsController < Devise::SessionsController
def
new
def
new
set_minimum_password_length
set_minimum_password_length
@ldap_servers
=
if
Gitlab
.
config
.
ldap
.
enabled
@ldap_servers
=
Gitlab
::
LDAP
::
Config
.
servers
if
Gitlab
.
config
.
ldap
.
enabled
else
Gitlab
::
LDAP
::
Config
.
servers
[]
else
end
[]
end
super
super
end
end
...
...
app/finders/notes_finder.rb
View file @
5c7f9d69
...
@@ -28,11 +28,12 @@ class NotesFinder
...
@@ -28,11 +28,12 @@ class NotesFinder
private
private
def
init_collection
def
init_collection
@notes
=
if
@params
[
:target_id
]
@notes
=
on_target
(
@params
[
:target_type
],
@params
[
:target_id
])
if
@params
[
:target_id
]
else
on_target
(
@params
[
:target_type
],
@params
[
:target_id
])
notes_of_any_type
else
end
notes_of_any_type
end
end
end
def
notes_of_any_type
def
notes_of_any_type
...
...
app/helpers/application_helper.rb
View file @
5c7f9d69
...
@@ -69,11 +69,12 @@ module ApplicationHelper
...
@@ -69,11 +69,12 @@ module ApplicationHelper
end
end
def
avatar_icon
(
user_or_email
=
nil
,
size
=
nil
,
scale
=
2
)
def
avatar_icon
(
user_or_email
=
nil
,
size
=
nil
,
scale
=
2
)
user
=
if
user_or_email
.
is_a?
(
User
)
user
=
user_or_email
if
user_or_email
.
is_a?
(
User
)
else
user_or_email
User
.
find_by_any_email
(
user_or_email
.
try
(
:downcase
))
else
end
User
.
find_by_any_email
(
user_or_email
.
try
(
:downcase
))
end
if
user
if
user
user
.
avatar_url
(
size
)
||
default_avatar
user
.
avatar_url
(
size
)
||
default_avatar
...
...
app/helpers/blob_helper.rb
View file @
5c7f9d69
...
@@ -153,16 +153,17 @@ module BlobHelper
...
@@ -153,16 +153,17 @@ module BlobHelper
# Because we are opionated we set the cache headers ourselves.
# Because we are opionated we set the cache headers ourselves.
response
.
cache_control
[
:public
]
=
@project
.
public?
response
.
cache_control
[
:public
]
=
@project
.
public?
response
.
cache_control
[
:max_age
]
=
if
@ref
&&
@commit
&&
@ref
==
@commit
.
id
response
.
cache_control
[
:max_age
]
=
# This is a link to a commit by its commit SHA. That means that the blob
if
@ref
&&
@commit
&&
@ref
==
@commit
.
id
# is immutable. The only reason to invalidate the cache is if the commit
# This is a link to a commit by its commit SHA. That means that the blob
# was deleted or if the user lost access to the repository.
# is immutable. The only reason to invalidate the cache is if the commit
Blob
::
CACHE_TIME_IMMUTABLE
# was deleted or if the user lost access to the repository.
else
Blob
::
CACHE_TIME_IMMUTABLE
# A branch or tag points at this blob. That means that the expected blob
else
# value may change over time.
# A branch or tag points at this blob. That means that the expected blob
Blob
::
CACHE_TIME
# value may change over time.
end
Blob
::
CACHE_TIME
end
response
.
etag
=
@blob
.
id
response
.
etag
=
@blob
.
id
!
stale
!
stale
...
...
app/helpers/submodule_helper.rb
View file @
5c7f9d69
...
@@ -38,7 +38,7 @@ module SubmoduleHelper
...
@@ -38,7 +38,7 @@ module SubmoduleHelper
def
self_url?
(
url
,
namespace
,
project
)
def
self_url?
(
url
,
namespace
,
project
)
return
true
if
url
==
[
Gitlab
.
config
.
gitlab
.
url
,
'/'
,
namespace
,
'/'
,
return
true
if
url
==
[
Gitlab
.
config
.
gitlab
.
url
,
'/'
,
namespace
,
'/'
,
project
,
'.git'
].
join
(
''
)
project
,
'.git'
].
join
(
''
)
url
==
gitlab_shell
.
url_to_repo
([
namespace
,
'/'
,
project
].
join
(
''
))
url
==
gitlab_shell
.
url_to_repo
([
namespace
,
'/'
,
project
].
join
(
''
))
end
end
...
...
app/mailers/repository_check_mailer.rb
View file @
5c7f9d69
class
RepositoryCheckMailer
<
BaseMailer
class
RepositoryCheckMailer
<
BaseMailer
def
notify
(
failed_count
)
def
notify
(
failed_count
)
@message
=
if
failed_count
==
1
@message
=
"One project failed its last repository check"
if
failed_count
==
1
else
"One project failed its last repository check"
"
#{
failed_count
}
projects failed their last repository check"
else
end
"
#{
failed_count
}
projects failed their last repository check"
end
mail
(
mail
(
to:
User
.
admins
.
pluck
(
:email
),
to:
User
.
admins
.
pluck
(
:email
),
...
...
app/models/commit.rb
View file @
5c7f9d69
...
@@ -122,11 +122,12 @@ class Commit
...
@@ -122,11 +122,12 @@ class Commit
def
full_title
def
full_title
return
@full_title
if
@full_title
return
@full_title
if
@full_title
@full_title
=
if
safe_message
.
blank?
@full_title
=
no_commit_message
if
safe_message
.
blank?
else
no_commit_message
safe_message
.
split
(
"
\n
"
,
2
).
first
else
end
safe_message
.
split
(
"
\n
"
,
2
).
first
end
end
end
# Returns the commits description
# Returns the commits description
...
...
app/models/concerns/case_sensitivity.rb
View file @
5c7f9d69
...
@@ -13,11 +13,12 @@ module CaseSensitivity
...
@@ -13,11 +13,12 @@ module CaseSensitivity
params
.
each
do
|
key
,
value
|
params
.
each
do
|
key
,
value
|
column
=
ActiveRecord
::
Base
.
connection
.
quote_table_name
(
key
)
column
=
ActiveRecord
::
Base
.
connection
.
quote_table_name
(
key
)
condition
=
if
cast_lower
condition
=
"LOWER(
#{
column
}
) = LOWER(:value)"
if
cast_lower
else
"LOWER(
#{
column
}
) = LOWER(:value)"
"
#{
column
}
= :value"
else
end
"
#{
column
}
= :value"
end
criteria
=
criteria
.
where
(
condition
,
value:
value
)
criteria
=
criteria
.
where
(
condition
,
value:
value
)
end
end
...
...
app/models/concerns/sortable.rb
View file @
5c7f9d69
...
@@ -46,11 +46,12 @@ module Sortable
...
@@ -46,11 +46,12 @@ module Sortable
where
(
"label_links.target_id =
#{
target_column
}
"
).
where
(
"label_links.target_id =
#{
target_column
}
"
).
reorder
(
nil
)
reorder
(
nil
)
query
=
if
target_type_column
query
=
query
.
where
(
"label_links.target_type =
#{
target_type_column
}
"
)
if
target_type_column
else
query
.
where
(
"label_links.target_type =
#{
target_type_column
}
"
)
query
.
where
(
label_links:
{
target_type:
target_type
})
else
end
query
.
where
(
label_links:
{
target_type:
target_type
})
end
query
=
query
.
where
.
not
(
title:
excluded_labels
)
if
excluded_labels
.
present?
query
=
query
.
where
.
not
(
title:
excluded_labels
)
if
excluded_labels
.
present?
...
...
app/models/network/graph.rb
View file @
5c7f9d69
...
@@ -188,11 +188,12 @@ module Network
...
@@ -188,11 +188,12 @@ module Network
end
end
# and mark it as reserved
# and mark it as reserved
min_time
=
if
parent_time
.
nil?
min_time
=
leaves
.
first
.
time
if
parent_time
.
nil?
else
leaves
.
first
.
time
parent_time
+
1
else
end
parent_time
+
1
end
max_time
=
leaves
.
last
.
time
max_time
=
leaves
.
last
.
time
leaves
.
last
.
parents
(
@map
).
each
do
|
parent
|
leaves
.
last
.
parents
(
@map
).
each
do
|
parent
|
...
...
app/models/project.rb
View file @
5c7f9d69
...
@@ -453,13 +453,14 @@ class Project < ActiveRecord::Base
...
@@ -453,13 +453,14 @@ class Project < ActiveRecord::Base
end
end
def
add_import_job
def
add_import_job
job_id
=
if
forked?
job_id
=
RepositoryForkWorker
.
perform_async
(
id
,
forked_from_project
.
repository_storage_path
,
if
forked?
forked_from_project
.
path_with_namespace
,
RepositoryForkWorker
.
perform_async
(
id
,
forked_from_project
.
repository_storage_path
,
self
.
namespace
.
full_path
)
forked_from_project
.
path_with_namespace
,
else
self
.
namespace
.
full_path
)
RepositoryImportWorker
.
perform_async
(
self
.
id
)
else
end
RepositoryImportWorker
.
perform_async
(
self
.
id
)
end
if
job_id
if
job_id
Rails
.
logger
.
info
"Import job started for
#{
path_with_namespace
}
with job ID
#{
job_id
}
"
Rails
.
logger
.
info
"Import job started for
#{
path_with_namespace
}
with job ID
#{
job_id
}
"
...
...
app/models/project_services/pushover_service.rb
View file @
5c7f9d69
...
@@ -72,13 +72,14 @@ class PushoverService < Service
...
@@ -72,13 +72,14 @@ class PushoverService < Service
before
=
data
[
:before
]
before
=
data
[
:before
]
after
=
data
[
:after
]
after
=
data
[
:after
]
message
=
if
Gitlab
::
Git
.
blank_ref?
(
before
)
message
=
"
#{
data
[
:user_name
]
}
pushed new branch
\"
#{
ref
}
\"
."
if
Gitlab
::
Git
.
blank_ref?
(
before
)
elsif
Gitlab
::
Git
.
blank_ref?
(
after
)
"
#{
data
[
:user_name
]
}
pushed new branch
\"
#{
ref
}
\"
."
"
#{
data
[
:user_name
]
}
deleted branch
\"
#{
ref
}
\"
."
elsif
Gitlab
::
Git
.
blank_ref?
(
after
)
else
"
#{
data
[
:user_name
]
}
deleted branch
\"
#{
ref
}
\"
."
"
#{
data
[
:user_name
]
}
push to branch
\"
#{
ref
}
\"
."
else
end
"
#{
data
[
:user_name
]
}
push to branch
\"
#{
ref
}
\"
."
end
if
data
[
:total_commits_count
]
>
0
if
data
[
:total_commits_count
]
>
0
message
<<
"
\n
Total commits count:
#{
data
[
:total_commits_count
]
}
"
message
<<
"
\n
Total commits count:
#{
data
[
:total_commits_count
]
}
"
...
...
app/services/system_note_service.rb
View file @
5c7f9d69
...
@@ -408,12 +408,13 @@ module SystemNoteService
...
@@ -408,12 +408,13 @@ module SystemNoteService
# Initial scope should be system notes of this noteable type
# Initial scope should be system notes of this noteable type
notes
=
Note
.
system
.
where
(
noteable_type:
noteable
.
class
)
notes
=
Note
.
system
.
where
(
noteable_type:
noteable
.
class
)
notes
=
if
noteable
.
is_a?
(
Commit
)
notes
=
# Commits have non-integer IDs, so they're stored in `commit_id`
if
noteable
.
is_a?
(
Commit
)
notes
.
where
(
commit_id:
noteable
.
id
)
# Commits have non-integer IDs, so they're stored in `commit_id`
else
notes
.
where
(
commit_id:
noteable
.
id
)
notes
.
where
(
noteable_id:
noteable
.
id
)
else
end
notes
.
where
(
noteable_id:
noteable
.
id
)
end
notes_for_mentioner
(
mentioner
,
noteable
,
notes
).
exists?
notes_for_mentioner
(
mentioner
,
noteable
,
notes
).
exists?
end
end
...
...
config/initializers/1_settings.rb
View file @
5c7f9d69
...
@@ -14,16 +14,17 @@ class Settings < Settingslogic
...
@@ -14,16 +14,17 @@ class Settings < Settingslogic
end
end
def
build_gitlab_ci_url
def
build_gitlab_ci_url
custom_port
=
if
on_standard_port?
(
gitlab
)
custom_port
=
nil
if
on_standard_port?
(
gitlab
)
else
nil
":
#{
gitlab
.
port
}
"
else
end
":
#{
gitlab
.
port
}
"
end
[
gitlab
.
protocol
,
[
gitlab
.
protocol
,
"://"
,
"://"
,
gitlab
.
host
,
gitlab
.
host
,
custom_port
,
custom_port
,
gitlab
.
relative_url_root
gitlab
.
relative_url_root
].
join
(
''
)
].
join
(
''
)
end
end
...
@@ -81,9 +82,9 @@ class Settings < Settingslogic
...
@@ -81,9 +82,9 @@ class Settings < Settingslogic
def
base_url
(
config
)
def
base_url
(
config
)
custom_port
=
on_standard_port?
(
config
)
?
nil
:
":
#{
config
.
port
}
"
custom_port
=
on_standard_port?
(
config
)
?
nil
:
":
#{
config
.
port
}
"
[
config
.
protocol
,
[
config
.
protocol
,
"://"
,
"://"
,
config
.
host
,
config
.
host
,
custom_port
custom_port
]
]
end
end
...
@@ -160,15 +161,16 @@ if github_settings
...
@@ -160,15 +161,16 @@ if github_settings
github_settings
[
"args"
]
||=
Settingslogic
.
new
({})
github_settings
[
"args"
]
||=
Settingslogic
.
new
({})
github_settings
[
"args"
][
"client_options"
]
=
if
github_settings
[
"url"
].
include?
(
github_default_url
)
github_settings
[
"args"
][
"client_options"
]
=
OmniAuth
::
Strategies
::
GitHub
.
default_options
[
:client_options
]
if
github_settings
[
"url"
].
include?
(
github_default_url
)
else
OmniAuth
::
Strategies
::
GitHub
.
default_options
[
:client_options
]
{
else
"site"
=>
File
.
join
(
github_settings
[
"url"
],
"api/v3"
),
{
"authorize_url"
=>
File
.
join
(
github_settings
[
"url"
],
"login/oauth/authorize"
),
"site"
=>
File
.
join
(
github_settings
[
"url"
],
"api/v3"
),
"token_url"
=>
File
.
join
(
github_settings
[
"url"
],
"login/oauth/access_token"
)
"authorize_url"
=>
File
.
join
(
github_settings
[
"url"
],
"login/oauth/authorize"
),
}
"token_url"
=>
File
.
join
(
github_settings
[
"url"
],
"login/oauth/access_token"
)
end
}
end
end
end
Settings
[
'shared'
]
||=
Settingslogic
.
new
({})
Settings
[
'shared'
]
||=
Settingslogic
.
new
({})
...
...
lib/api/api_guard.rb
View file @
5c7f9d69
...
@@ -115,7 +115,7 @@ module API
...
@@ -115,7 +115,7 @@ module API
def
install_error_responders
(
base
)
def
install_error_responders
(
base
)
error_classes
=
[
MissingTokenError
,
TokenNotFoundError
,
error_classes
=
[
MissingTokenError
,
TokenNotFoundError
,
ExpiredError
,
RevokedError
,
InsufficientScopeError
]
ExpiredError
,
RevokedError
,
InsufficientScopeError
]
base
.
send
:rescue_from
,
*
error_classes
,
oauth2_bearer_token_error_handler
base
.
send
:rescue_from
,
*
error_classes
,
oauth2_bearer_token_error_handler
end
end
...
...
lib/api/award_emoji.rb
View file @
5c7f9d69
...
@@ -16,7 +16,7 @@ module API
...
@@ -16,7 +16,7 @@ module API
end
end
[
":id/
#{
awardable_string
}
/:
#{
awardable_id_string
}
/award_emoji"
,
[
":id/
#{
awardable_string
}
/:
#{
awardable_id_string
}
/award_emoji"
,
":id/
#{
awardable_string
}
/:
#{
awardable_id_string
}
/notes/:note_id/award_emoji"
":id/
#{
awardable_string
}
/:
#{
awardable_id_string
}
/notes/:note_id/award_emoji"
].
each
do
|
endpoint
|
].
each
do
|
endpoint
|
desc
'Get a list of project +awardable+ award emoji'
do
desc
'Get a list of project +awardable+ award emoji'
do
...
...
lib/banzai/filter/abstract_reference_filter.rb
View file @
5c7f9d69
...
@@ -160,11 +160,12 @@ module Banzai
...
@@ -160,11 +160,12 @@ module Banzai
data
=
data_attributes_for
(
link_content
||
match
,
project
,
object
,
link:
!!
link_content
)
data
=
data_attributes_for
(
link_content
||
match
,
project
,
object
,
link:
!!
link_content
)
url
=
if
matches
.
names
.
include?
(
"url"
)
&&
matches
[
:url
]
url
=
matches
[
:url
]
if
matches
.
names
.
include?
(
"url"
)
&&
matches
[
:url
]
else
matches
[
:url
]
url_for_object_cached
(
object
,
project
)
else
end
url_for_object_cached
(
object
,
project
)
end
content
=
link_content
||
object_link_text
(
object
,
matches
)
content
=
link_content
||
object_link_text
(
object
,
matches
)
...
...
lib/banzai/filter/gollum_tags_filter.rb
View file @
5c7f9d69
...
@@ -149,11 +149,12 @@ module Banzai
...
@@ -149,11 +149,12 @@ module Banzai
name
,
reference
=
*
parts
.
compact
.
map
(
&
:strip
)
name
,
reference
=
*
parts
.
compact
.
map
(
&
:strip
)
end
end
href
=
if
url?
(
reference
)
href
=
reference
if
url?
(
reference
)
else
reference
::
File
.
join
(
project_wiki_base_path
,
reference
)
else
end
::
File
.
join
(
project_wiki_base_path
,
reference
)
end
content_tag
(
:a
,
name
||
reference
,
href:
href
,
class:
'gfm'
)
content_tag
(
:a
,
name
||
reference
,
href:
href
,
class:
'gfm'
)
end
end
...
...
lib/banzai/filter/issue_reference_filter.rb
View file @
5c7f9d69
...
@@ -39,11 +39,12 @@ module Banzai
...
@@ -39,11 +39,12 @@ module Banzai
projects_per_reference
.
each
do
|
path
,
project
|
projects_per_reference
.
each
do
|
path
,
project
|
issue_ids
=
references_per_project
[
path
]
issue_ids
=
references_per_project
[
path
]
issues
=
if
project
.
default_issues_tracker?
issues
=
project
.
issues
.
where
(
iid:
issue_ids
.
to_a
)
if
project
.
default_issues_tracker?
else
project
.
issues
.
where
(
iid:
issue_ids
.
to_a
)
issue_ids
.
map
{
|
id
|
ExternalIssue
.
new
(
id
,
project
)
}
else
end
issue_ids
.
map
{
|
id
|
ExternalIssue
.
new
(
id
,
project
)
}
end
issues
.
each
do
|
issue
|
issues
.
each
do
|
issue
|
hash
[
project
][
issue
.
iid
.
to_i
]
=
issue
hash
[
project
][
issue
.
iid
.
to_i
]
=
issue
...
...
lib/gitlab/award_emoji.rb
View file @
5c7f9d69
...
@@ -69,11 +69,12 @@ module Gitlab
...
@@ -69,11 +69,12 @@ module Gitlab
end
end
JSON
.
parse
(
File
.
read
(
path
)).
map
do
|
hash
|
JSON
.
parse
(
File
.
read
(
path
)).
map
do
|
hash
|
fname
=
if
digest
fname
=
"
#{
hash
[
'unicode'
]
}
-
#{
hash
[
'digest'
]
}
"
if
digest
else
"
#{
hash
[
'unicode'
]
}
-
#{
hash
[
'digest'
]
}
"
hash
[
'unicode'
]
else
end
hash
[
'unicode'
]
end
{
name:
hash
[
'name'
],
path:
File
.
join
(
base
,
prefix
,
"
#{
fname
}
.png"
)
}
{
name:
hash
[
'name'
],
path:
File
.
join
(
base
,
prefix
,
"
#{
fname
}
.png"
)
}
end
end
...
...
lib/gitlab/ci/config/entry/global.rb
View file @
5c7f9d69
...
@@ -49,7 +49,7 @@ module Gitlab
...
@@ -49,7 +49,7 @@ module Gitlab
factory
=
Entry
::
Factory
.
new
(
Entry
::
Jobs
).
factory
=
Entry
::
Factory
.
new
(
Entry
::
Jobs
).
value
(
@config
.
except
(
*
self
.
class
.
nodes
.
keys
)).
value
(
@config
.
except
(
*
self
.
class
.
nodes
.
keys
)).
with
(
key: :jobs
,
parent:
self
,
with
(
key: :jobs
,
parent:
self
,
description:
'Jobs definition for this pipeline'
)
description:
'Jobs definition for this pipeline'
)
@entries
[
:jobs
]
=
factory
.
create!
@entries
[
:jobs
]
=
factory
.
create!
end
end
...
...
lib/gitlab/ci/config/entry/jobs.rb
View file @
5c7f9d69
...
@@ -35,7 +35,7 @@ module Gitlab
...
@@ -35,7 +35,7 @@ module Gitlab
value
(
config
||
{}).
value
(
config
||
{}).
metadata
(
name:
name
).
metadata
(
name:
name
).
with
(
key:
name
,
parent:
self
,
with
(
key:
name
,
parent:
self
,
description:
"
#{
name
}
job definition."
)
description:
"
#{
name
}
job definition."
)
@entries
[
name
]
=
factory
.
create!
@entries
[
name
]
=
factory
.
create!
end
end
...
...
lib/gitlab/conflict/file.rb
View file @
5c7f9d69
...
@@ -91,11 +91,12 @@ module Gitlab
...
@@ -91,11 +91,12 @@ module Gitlab
our_highlight
=
Gitlab
::
Highlight
.
highlight
(
our_path
,
our_file
,
repository:
repository
).
lines
our_highlight
=
Gitlab
::
Highlight
.
highlight
(
our_path
,
our_file
,
repository:
repository
).
lines
lines
.
each
do
|
line
|
lines
.
each
do
|
line
|
line
.
rich_text
=
if
line
.
type
==
'old'
line
.
rich_text
=
their_highlight
[
line
.
old_line
-
1
].
try
(
:html_safe
)
if
line
.
type
==
'old'
else
their_highlight
[
line
.
old_line
-
1
].
try
(
:html_safe
)
our_highlight
[
line
.
new_line
-
1
].
try
(
:html_safe
)
else
end
our_highlight
[
line
.
new_line
-
1
].
try
(
:html_safe
)
end
end
end
end
end
...
...
lib/gitlab/diff/position.rb
View file @
5c7f9d69
...
@@ -140,15 +140,16 @@ module Gitlab
...
@@ -140,15 +140,16 @@ module Gitlab
def
find_diff_file
(
repository
)
def
find_diff_file
(
repository
)
# We're at the initial commit, so just get that as we can't compare to anything.
# We're at the initial commit, so just get that as we can't compare to anything.
compare
=
if
Gitlab
::
Git
.
blank_ref?
(
start_sha
)
compare
=
Gitlab
::
Git
::
Commit
.
find
(
repository
.
raw_repository
,
head_sha
)
if
Gitlab
::
Git
.
blank_ref?
(
start_sha
)
else
Gitlab
::
Git
::
Commit
.
find
(
repository
.
raw_repository
,
head_sha
)
Gitlab
::
Git
::
Compare
.
new
(
else
repository
.
raw_repository
,
Gitlab
::
Git
::
Compare
.
new
(
start_sha
,
repository
.
raw_repository
,
head_sha
start_sha
,
)
head_sha
end
)
end
diff
=
compare
.
diffs
(
paths:
paths
).
first
diff
=
compare
.
diffs
(
paths:
paths
).
first
...
...
lib/gitlab/email/reply_parser.rb
View file @
5c7f9d69
...
@@ -31,11 +31,12 @@ module Gitlab
...
@@ -31,11 +31,12 @@ module Gitlab
private
private
def
select_body
(
message
)
def
select_body
(
message
)
part
=
if
message
.
multipart?
part
=
message
.
text_part
||
message
.
html_part
||
message
if
message
.
multipart?
else
message
.
text_part
||
message
.
html_part
||
message
message
else
end
message
end
decoded
=
fix_charset
(
part
)
decoded
=
fix_charset
(
part
)
...
...
lib/gitlab/metrics/instrumentation.rb
View file @
5c7f9d69
...
@@ -143,11 +143,12 @@ module Gitlab
...
@@ -143,11 +143,12 @@ module Gitlab
# signature this would break things. As a result we'll make sure the
# signature this would break things. As a result we'll make sure the
# generated method _only_ accepts regular arguments if the underlying
# generated method _only_ accepts regular arguments if the underlying
# method also accepts them.
# method also accepts them.
args_signature
=
if
method
.
arity
==
0
args_signature
=
''
if
method
.
arity
==
0
else
''
'*args'
else
end
'*args'
end
proxy_module
.
class_eval
<<-
EOF
,
__FILE__
,
__LINE__
+
1
proxy_module
.
class_eval
<<-
EOF
,
__FILE__
,
__LINE__
+
1
def
#{
name
}
(
#{
args_signature
}
)
def
#{
name
}
(
#{
args_signature
}
)
...
...
lib/gitlab/saml/user.rb
View file @
5c7f9d69
...
@@ -28,11 +28,12 @@ module Gitlab
...
@@ -28,11 +28,12 @@ module Gitlab
if
external_users_enabled?
&&
@user
if
external_users_enabled?
&&
@user
# Check if there is overlap between the user's groups and the external groups
# Check if there is overlap between the user's groups and the external groups
# setting then set user as external or internal.
# setting then set user as external or internal.
@user
.
external
=
if
(
auth_hash
.
groups
&
Gitlab
::
Saml
::
Config
.
external_groups
).
empty?
@user
.
external
=
false
if
(
auth_hash
.
groups
&
Gitlab
::
Saml
::
Config
.
external_groups
).
empty?
else
false
true
else
end
true
end
end
end
@user
@user
...
...
lib/gitlab/search_results.rb
View file @
5c7f9d69
...
@@ -56,11 +56,12 @@ module Gitlab
...
@@ -56,11 +56,12 @@ module Gitlab
def
issues
def
issues
issues
=
IssuesFinder
.
new
(
current_user
).
execute
.
where
(
project_id:
project_ids_relation
)
issues
=
IssuesFinder
.
new
(
current_user
).
execute
.
where
(
project_id:
project_ids_relation
)
issues
=
if
query
=~
/#(\d+)\z/
issues
=
issues
.
where
(
iid:
$1
)
if
query
=~
/#(\d+)\z/
else
issues
.
where
(
iid:
$1
)
issues
.
full_search
(
query
)
else
end
issues
.
full_search
(
query
)
end
issues
.
order
(
'updated_at DESC'
)
issues
.
order
(
'updated_at DESC'
)
end
end
...
@@ -73,11 +74,12 @@ module Gitlab
...
@@ -73,11 +74,12 @@ module Gitlab
def
merge_requests
def
merge_requests
merge_requests
=
MergeRequestsFinder
.
new
(
current_user
).
execute
.
in_projects
(
project_ids_relation
)
merge_requests
=
MergeRequestsFinder
.
new
(
current_user
).
execute
.
in_projects
(
project_ids_relation
)
merge_requests
=
if
query
=~
/[#!](\d+)\z/
merge_requests
=
merge_requests
.
where
(
iid:
$1
)
if
query
=~
/[#!](\d+)\z/
else
merge_requests
.
where
(
iid:
$1
)
merge_requests
.
full_search
(
query
)
else
end
merge_requests
.
full_search
(
query
)
end
merge_requests
.
order
(
'updated_at DESC'
)
merge_requests
.
order
(
'updated_at DESC'
)
end
end
...
...
lib/gitlab/shell.rb
View file @
5c7f9d69
...
@@ -83,7 +83,7 @@ module Gitlab
...
@@ -83,7 +83,7 @@ module Gitlab
# Timeout should be less than 900 ideally, to prevent the memory killer
# Timeout should be less than 900 ideally, to prevent the memory killer
# to silently kill the process without knowing we are timing out here.
# to silently kill the process without knowing we are timing out here.
output
,
status
=
Popen
.
popen
([
gitlab_shell_projects_path
,
'import-project'
,
output
,
status
=
Popen
.
popen
([
gitlab_shell_projects_path
,
'import-project'
,
storage
,
"
#{
name
}
.git"
,
url
,
'800'
])
storage
,
"
#{
name
}
.git"
,
url
,
'800'
])
raise
Error
,
output
unless
status
.
zero?
raise
Error
,
output
unless
status
.
zero?
true
true
end
end
...
...
lib/gitlab/sherlock/query.rb
View file @
5c7f9d69
...
@@ -94,11 +94,12 @@ module Gitlab
...
@@ -94,11 +94,12 @@ module Gitlab
private
private
def
raw_explain
(
query
)
def
raw_explain
(
query
)
explain
=
if
Gitlab
::
Database
.
postgresql?
explain
=
"EXPLAIN ANALYZE
#{
query
}
;"
if
Gitlab
::
Database
.
postgresql?
else
"EXPLAIN ANALYZE
#{
query
}
;"
"EXPLAIN
#{
query
}
;"
else
end
"EXPLAIN
#{
query
}
;"
end
ActiveRecord
::
Base
.
connection
.
execute
(
explain
)
ActiveRecord
::
Base
.
connection
.
execute
(
explain
)
end
end
...
...
spec/features/issuables/issuable_list_spec.rb
View file @
5c7f9d69
...
@@ -47,11 +47,12 @@ describe 'issuable list', feature: true do
...
@@ -47,11 +47,12 @@ describe 'issuable list', feature: true do
def
create_issuables
(
issuable_type
)
def
create_issuables
(
issuable_type
)
3
.
times
do
3
.
times
do
issuable
=
if
issuable_type
==
:issue
issuable
=
create
(
:issue
,
project:
project
,
author:
user
)
if
issuable_type
==
:issue
else
create
(
:issue
,
project:
project
,
author:
user
)
create
(
:merge_request
,
title:
FFaker
::
Lorem
.
sentence
,
source_project:
project
,
source_branch:
FFaker
::
Name
.
name
)
else
end
create
(
:merge_request
,
title:
FFaker
::
Lorem
.
sentence
,
source_project:
project
,
source_branch:
FFaker
::
Name
.
name
)
end
2
.
times
do
2
.
times
do
create
(
:note_on_issue
,
noteable:
issuable
,
project:
project
,
note:
'Test note'
)
create
(
:note_on_issue
,
noteable:
issuable
,
project:
project
,
note:
'Test note'
)
...
...
spec/helpers/issues_helper_spec.rb
View file @
5c7f9d69
...
@@ -56,7 +56,7 @@ describe IssuesHelper do
...
@@ -56,7 +56,7 @@ describe IssuesHelper do
subject
{
merge_requests_sentence
(
merge_requests
)}
subject
{
merge_requests_sentence
(
merge_requests
)}
let
(
:merge_requests
)
do
let
(
:merge_requests
)
do
[
build
(
:merge_request
,
iid:
1
),
build
(
:merge_request
,
iid:
2
),
[
build
(
:merge_request
,
iid:
1
),
build
(
:merge_request
,
iid:
2
),
build
(
:merge_request
,
iid:
3
)]
build
(
:merge_request
,
iid:
3
)]
end
end
it
{
is_expected
.
to
eq
(
"!1, !2, or !3"
)
}
it
{
is_expected
.
to
eq
(
"!1, !2, or !3"
)
}
...
...
spec/lib/gitlab/ci/config/entry/global_spec.rb
View file @
5c7f9d69
...
@@ -12,8 +12,8 @@ describe Gitlab::Ci::Config::Entry::Global do
...
@@ -12,8 +12,8 @@ describe Gitlab::Ci::Config::Entry::Global do
it
'contains the expected node names'
do
it
'contains the expected node names'
do
expect
(
described_class
.
nodes
.
keys
).
expect
(
described_class
.
nodes
.
keys
).
to
match_array
(
%i[before_script image services
to
match_array
(
%i[before_script image services
after_script variables stages
after_script variables stages
types cache]
)
types cache]
)
end
end
end
end
end
end
...
...
spec/lib/gitlab/ci/config/entry/job_spec.rb
View file @
5c7f9d69
...
@@ -140,11 +140,11 @@ describe Gitlab::Ci::Config::Entry::Job do
...
@@ -140,11 +140,11 @@ describe Gitlab::Ci::Config::Entry::Job do
it
'returns correct value'
do
it
'returns correct value'
do
expect
(
entry
.
value
).
expect
(
entry
.
value
).
to
eq
(
name: :rspec
,
to
eq
(
name: :rspec
,
before_script:
%w[ls pwd]
,
before_script:
%w[ls pwd]
,
script:
%w[rspec]
,
script:
%w[rspec]
,
commands:
"ls
\n
pwd
\n
rspec"
,
commands:
"ls
\n
pwd
\n
rspec"
,
stage:
'test'
,
stage:
'test'
,
after_script:
%w[cleanup]
)
after_script:
%w[cleanup]
)
end
end
end
end
end
end
...
...
spec/lib/gitlab/ci/status/build/factory_spec.rb
View file @
5c7f9d69
...
@@ -69,7 +69,7 @@ describe Gitlab::Ci::Status::Build::Factory do
...
@@ -69,7 +69,7 @@ describe Gitlab::Ci::Status::Build::Factory do
it
'matches correct extended statuses'
do
it
'matches correct extended statuses'
do
expect
(
factory
.
extended_statuses
).
expect
(
factory
.
extended_statuses
).
to
eq
[
Gitlab
::
Ci
::
Status
::
Build
::
Retryable
,
to
eq
[
Gitlab
::
Ci
::
Status
::
Build
::
Retryable
,
Gitlab
::
Ci
::
Status
::
Build
::
FailedAllowed
]
Gitlab
::
Ci
::
Status
::
Build
::
FailedAllowed
]
end
end
it
'fabricates a failed but allowed build status'
do
it
'fabricates a failed but allowed build status'
do
...
...
spec/lib/gitlab/incoming_email_spec.rb
View file @
5c7f9d69
...
@@ -101,8 +101,8 @@ describe Gitlab::IncomingEmail, lib: true do
...
@@ -101,8 +101,8 @@ describe Gitlab::IncomingEmail, lib: true do
it
'returns reply key'
do
it
'returns reply key'
do
expect
(
described_class
.
scan_fallback_references
(
references
)).
expect
(
described_class
.
scan_fallback_references
(
references
)).
to
eq
(
%w[issue_1@localhost
to
eq
(
%w[issue_1@localhost
reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost
reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost
exchange@microsoft.com]
)
exchange@microsoft.com]
)
end
end
end
end
end
end
spec/lib/gitlab/o_auth/user_spec.rb
View file @
5c7f9d69
...
@@ -152,7 +152,7 @@ describe Gitlab::OAuth::User, lib: true do
...
@@ -152,7 +152,7 @@ describe Gitlab::OAuth::User, lib: true do
identities_as_hash
=
gl_user
.
identities
.
map
{
|
id
|
{
provider:
id
.
provider
,
extern_uid:
id
.
extern_uid
}
}
identities_as_hash
=
gl_user
.
identities
.
map
{
|
id
|
{
provider:
id
.
provider
,
extern_uid:
id
.
extern_uid
}
}
expect
(
identities_as_hash
).
to
match_array
(
expect
(
identities_as_hash
).
to
match_array
(
[{
provider:
'ldapmain'
,
extern_uid:
'uid=user1,ou=People,dc=example'
},
[{
provider:
'ldapmain'
,
extern_uid:
'uid=user1,ou=People,dc=example'
},
{
provider:
'twitter'
,
extern_uid:
uid
}
{
provider:
'twitter'
,
extern_uid:
uid
}
])
])
end
end
end
end
...
@@ -171,7 +171,7 @@ describe Gitlab::OAuth::User, lib: true do
...
@@ -171,7 +171,7 @@ describe Gitlab::OAuth::User, lib: true do
identities_as_hash
=
gl_user
.
identities
.
map
{
|
id
|
{
provider:
id
.
provider
,
extern_uid:
id
.
extern_uid
}
}
identities_as_hash
=
gl_user
.
identities
.
map
{
|
id
|
{
provider:
id
.
provider
,
extern_uid:
id
.
extern_uid
}
}
expect
(
identities_as_hash
).
to
match_array
(
expect
(
identities_as_hash
).
to
match_array
(
[{
provider:
'ldapmain'
,
extern_uid:
'uid=user1,ou=People,dc=example'
},
[{
provider:
'ldapmain'
,
extern_uid:
'uid=user1,ou=People,dc=example'
},
{
provider:
'twitter'
,
extern_uid:
uid
}
{
provider:
'twitter'
,
extern_uid:
uid
}
])
])
end
end
end
end
...
...
spec/lib/gitlab/saml/user_spec.rb
View file @
5c7f9d69
...
@@ -158,7 +158,7 @@ describe Gitlab::Saml::User, lib: true do
...
@@ -158,7 +158,7 @@ describe Gitlab::Saml::User, lib: true do
expect
(
gl_user
.
identities
.
length
).
to
eql
2
expect
(
gl_user
.
identities
.
length
).
to
eql
2
identities_as_hash
=
gl_user
.
identities
.
map
{
|
id
|
{
provider:
id
.
provider
,
extern_uid:
id
.
extern_uid
}
}
identities_as_hash
=
gl_user
.
identities
.
map
{
|
id
|
{
provider:
id
.
provider
,
extern_uid:
id
.
extern_uid
}
}
expect
(
identities_as_hash
).
to
match_array
([{
provider:
'ldapmain'
,
extern_uid:
'uid=user1,ou=People,dc=example'
},
expect
(
identities_as_hash
).
to
match_array
([{
provider:
'ldapmain'
,
extern_uid:
'uid=user1,ou=People,dc=example'
},
{
provider:
'saml'
,
extern_uid:
uid
}
{
provider:
'saml'
,
extern_uid:
uid
}
])
])
end
end
end
end
...
@@ -181,7 +181,7 @@ describe Gitlab::Saml::User, lib: true do
...
@@ -181,7 +181,7 @@ describe Gitlab::Saml::User, lib: true do
expect
(
gl_user
.
identities
.
length
).
to
eql
2
expect
(
gl_user
.
identities
.
length
).
to
eql
2
identities_as_hash
=
gl_user
.
identities
.
map
{
|
id
|
{
provider:
id
.
provider
,
extern_uid:
id
.
extern_uid
}
}
identities_as_hash
=
gl_user
.
identities
.
map
{
|
id
|
{
provider:
id
.
provider
,
extern_uid:
id
.
extern_uid
}
}
expect
(
identities_as_hash
).
to
match_array
([{
provider:
'ldapmain'
,
extern_uid:
'uid=user1,ou=People,dc=example'
},
expect
(
identities_as_hash
).
to
match_array
([{
provider:
'ldapmain'
,
extern_uid:
'uid=user1,ou=People,dc=example'
},
{
provider:
'saml'
,
extern_uid:
uid
}
{
provider:
'saml'
,
extern_uid:
uid
}
])
])
end
end
...
@@ -207,7 +207,7 @@ describe Gitlab::Saml::User, lib: true do
...
@@ -207,7 +207,7 @@ describe Gitlab::Saml::User, lib: true do
expect
(
local_gl_user
.
identities
.
length
).
to
eql
2
expect
(
local_gl_user
.
identities
.
length
).
to
eql
2
identities_as_hash
=
local_gl_user
.
identities
.
map
{
|
id
|
{
provider:
id
.
provider
,
extern_uid:
id
.
extern_uid
}
}
identities_as_hash
=
local_gl_user
.
identities
.
map
{
|
id
|
{
provider:
id
.
provider
,
extern_uid:
id
.
extern_uid
}
}
expect
(
identities_as_hash
).
to
match_array
([{
provider:
'ldapmain'
,
extern_uid:
'uid=user1,ou=People,dc=example'
},
expect
(
identities_as_hash
).
to
match_array
([{
provider:
'ldapmain'
,
extern_uid:
'uid=user1,ou=People,dc=example'
},
{
provider:
'saml'
,
extern_uid:
'uid=user1,ou=People,dc=example'
}
{
provider:
'saml'
,
extern_uid:
'uid=user1,ou=People,dc=example'
}
])
])
end
end
end
end
...
...
spec/models/ci/build_spec.rb
View file @
5c7f9d69
...
@@ -1263,7 +1263,7 @@ describe Ci::Build, :models do
...
@@ -1263,7 +1263,7 @@ describe Ci::Build, :models do
context
'when build has user'
do
context
'when build has user'
do
let
(
:user_variables
)
do
let
(
:user_variables
)
do
[{
key:
'GITLAB_USER_ID'
,
value:
user
.
id
.
to_s
,
public:
true
},
[{
key:
'GITLAB_USER_ID'
,
value:
user
.
id
.
to_s
,
public:
true
},
{
key:
'GITLAB_USER_EMAIL'
,
value:
user
.
email
,
public:
true
}]
{
key:
'GITLAB_USER_EMAIL'
,
value:
user
.
email
,
public:
true
}]
end
end
before
do
before
do
...
...
spec/support/issuables_list_metadata_shared_examples.rb
View file @
5c7f9d69
...
@@ -3,11 +3,12 @@ shared_examples 'issuables list meta-data' do |issuable_type, action = nil|
...
@@ -3,11 +3,12 @@ shared_examples 'issuables list meta-data' do |issuable_type, action = nil|
@issuable_ids
=
[]
@issuable_ids
=
[]
2
.
times
do
2
.
times
do
issuable
=
if
issuable_type
==
:issue
issuable
=
create
(
issuable_type
,
project:
project
)
if
issuable_type
==
:issue
else
create
(
issuable_type
,
project:
project
)
create
(
issuable_type
,
title:
FFaker
::
Lorem
.
sentence
,
source_project:
project
,
source_branch:
FFaker
::
Name
.
name
)
else
end
create
(
issuable_type
,
title:
FFaker
::
Lorem
.
sentence
,
source_project:
project
,
source_branch:
FFaker
::
Name
.
name
)
end
@issuable_ids
<<
issuable
.
id
@issuable_ids
<<
issuable
.
id
...
...
spec/support/login_helpers.rb
View file @
5c7f9d69
...
@@ -15,11 +15,12 @@ module LoginHelpers
...
@@ -15,11 +15,12 @@ module LoginHelpers
# user = create(:user)
# user = create(:user)
# login_as(user)
# login_as(user)
def
login_as
(
user_or_role
)
def
login_as
(
user_or_role
)
@user
=
if
user_or_role
.
kind_of?
(
User
)
@user
=
user_or_role
if
user_or_role
.
kind_of?
(
User
)
else
user_or_role
create
(
user_or_role
)
else
end
create
(
user_or_role
)
end
login_with
(
@user
)
login_with
(
@user
)
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