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
Jérome Perrin
gitlab-ce
Commits
ffadefb3
Commit
ffadefb3
authored
Oct 04, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9690 from ggarnier/master
Fix "useless assignment" Rubocop warnings
parents
662f8af4
963e6366
Changes
41
Show whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
85 additions
and
113 deletions
+85
-113
.rubocop.yml
.rubocop.yml
+1
-1
app/controllers/ci/lints_controller.rb
app/controllers/ci/lints_controller.rb
+1
-1
app/controllers/omniauth_callbacks_controller.rb
app/controllers/omniauth_callbacks_controller.rb
+2
-2
app/controllers/projects/wikis_controller.rb
app/controllers/projects/wikis_controller.rb
+1
-1
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+1
-1
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+1
-1
app/models/ci/build.rb
app/models/ci/build.rb
+3
-3
app/models/ci/project.rb
app/models/ci/project.rb
+1
-1
app/models/merge_request_diff.rb
app/models/merge_request_diff.rb
+3
-5
app/models/project.rb
app/models/project.rb
+2
-2
app/models/project_services/hipchat_service.rb
app/models/project_services/hipchat_service.rb
+10
-15
app/models/repository.rb
app/models/repository.rb
+1
-1
app/models/user.rb
app/models/user.rb
+1
-7
app/services/files/base_service.rb
app/services/files/base_service.rb
+1
-1
app/services/projects/create_service.rb
app/services/projects/create_service.rb
+1
-1
features/steps/groups.rb
features/steps/groups.rb
+25
-25
features/steps/project/graph.rb
features/steps/project/graph.rb
+1
-1
features/steps/project/issues/issues.rb
features/steps/project/issues/issues.rb
+2
-2
features/steps/project/redirects.rb
features/steps/project/redirects.rb
+0
-2
features/steps/shared/group.rb
features/steps/shared/group.rb
+1
-1
lib/api/helpers.rb
lib/api/helpers.rb
+2
-3
lib/event_filter.rb
lib/event_filter.rb
+1
-1
lib/gitlab/contributions_calendar.rb
lib/gitlab/contributions_calendar.rb
+0
-1
lib/gitlab/diff/parser.rb
lib/gitlab/diff/parser.rb
+0
-2
lib/gitlab/fogbugz_import/project_creator.rb
lib/gitlab/fogbugz_import/project_creator.rb
+1
-1
lib/gitlab/google_code_import/project_creator.rb
lib/gitlab/google_code_import/project_creator.rb
+1
-1
spec/features/ci/admin/builds_spec.rb
spec/features/ci/admin/builds_spec.rb
+4
-4
spec/lib/gitlab/backend/grack_auth_spec.rb
spec/lib/gitlab/backend/grack_auth_spec.rb
+2
-2
spec/lib/gitlab/o_auth/user_spec.rb
spec/lib/gitlab/o_auth/user_spec.rb
+0
-4
spec/models/broadcast_message_spec.rb
spec/models/broadcast_message_spec.rb
+2
-2
spec/models/ci/commit_spec.rb
spec/models/ci/commit_spec.rb
+2
-2
spec/models/hooks/project_hook_spec.rb
spec/models/hooks/project_hook_spec.rb
+2
-2
spec/models/hooks/service_hook_spec.rb
spec/models/hooks/service_hook_spec.rb
+0
-2
spec/models/hooks/web_hook_spec.rb
spec/models/hooks/web_hook_spec.rb
+0
-2
spec/models/milestone_spec.rb
spec/models/milestone_spec.rb
+3
-3
spec/models/project_services/gitlab_ci_service_spec.rb
spec/models/project_services/gitlab_ci_service_spec.rb
+0
-1
spec/models/project_services/hipchat_service_spec.rb
spec/models/project_services/hipchat_service_spec.rb
+2
-2
spec/models/project_spec.rb
spec/models/project_spec.rb
+1
-1
spec/models/project_wiki_spec.rb
spec/models/project_wiki_spec.rb
+1
-1
spec/models/wiki_page_spec.rb
spec/models/wiki_page_spec.rb
+1
-1
spec/tasks/gitlab/backup_rake_spec.rb
spec/tasks/gitlab/backup_rake_spec.rb
+1
-1
No files found.
.rubocop.yml
View file @
ffadefb3
...
@@ -932,7 +932,7 @@ Lint/UselessAccessModifier:
...
@@ -932,7 +932,7 @@ Lint/UselessAccessModifier:
Lint/UselessAssignment
:
Lint/UselessAssignment
:
Description
:
'
Checks
for
useless
assignment
to
a
local
variable.'
Description
:
'
Checks
for
useless
assignment
to
a
local
variable.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
Enabled
:
fals
e
Enabled
:
tru
e
Lint/UselessComparison
:
Lint/UselessComparison
:
Description
:
'
Checks
for
comparison
of
something
with
itself.'
Description
:
'
Checks
for
comparison
of
something
with
itself.'
...
...
app/controllers/ci/lints_controller.rb
View file @
ffadefb3
...
@@ -18,7 +18,7 @@ module Ci
...
@@ -18,7 +18,7 @@ module Ci
rescue
Ci
::
GitlabCiYamlProcessor
::
ValidationError
=>
e
rescue
Ci
::
GitlabCiYamlProcessor
::
ValidationError
=>
e
@error
=
e
.
message
@error
=
e
.
message
@status
=
false
@status
=
false
rescue
Exception
=>
e
rescue
Exception
@error
=
"Undefined error"
@error
=
"Undefined error"
@status
=
false
@status
=
false
end
end
...
...
app/controllers/omniauth_callbacks_controller.rb
View file @
ffadefb3
...
@@ -71,7 +71,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
...
@@ -71,7 +71,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
redirect_to
omniauth_error_path
(
oauth
[
'provider'
],
error:
error_message
)
and
return
redirect_to
omniauth_error_path
(
oauth
[
'provider'
],
error:
error_message
)
and
return
end
end
end
end
rescue
Gitlab
::
OAuth
::
SignupDisabledError
=>
e
rescue
Gitlab
::
OAuth
::
SignupDisabledError
label
=
Gitlab
::
OAuth
::
Provider
.
label_for
(
oauth
[
'provider'
])
label
=
Gitlab
::
OAuth
::
Provider
.
label_for
(
oauth
[
'provider'
])
message
=
"Signing in using your
#{
label
}
account without a pre-existing GitLab account is not allowed."
message
=
"Signing in using your
#{
label
}
account without a pre-existing GitLab account is not allowed."
...
...
app/controllers/projects/wikis_controller.rb
View file @
ffadefb3
...
@@ -98,7 +98,7 @@ class Projects::WikisController < Projects::ApplicationController
...
@@ -98,7 +98,7 @@ class Projects::WikisController < Projects::ApplicationController
# Call #wiki to make sure the Wiki Repo is initialized
# Call #wiki to make sure the Wiki Repo is initialized
@project_wiki
.
wiki
@project_wiki
.
wiki
rescue
ProjectWiki
::
CouldNotCreateWikiError
=>
ex
rescue
ProjectWiki
::
CouldNotCreateWikiError
flash
[
:notice
]
=
"Could not create Wiki Repository at this time. Please try again later."
flash
[
:notice
]
=
"Could not create Wiki Repository at this time. Please try again later."
redirect_to
project_path
(
@project
)
redirect_to
project_path
(
@project
)
return
false
return
false
...
...
app/finders/issuable_finder.rb
View file @
ffadefb3
...
@@ -39,7 +39,7 @@ class IssuableFinder
...
@@ -39,7 +39,7 @@ class IssuableFinder
items
=
by_assignee
(
items
)
items
=
by_assignee
(
items
)
items
=
by_author
(
items
)
items
=
by_author
(
items
)
items
=
by_label
(
items
)
items
=
by_label
(
items
)
items
=
sort
(
items
)
sort
(
items
)
end
end
def
group
def
group
...
...
app/helpers/application_helper.rb
View file @
ffadefb3
...
@@ -35,7 +35,7 @@ module ApplicationHelper
...
@@ -35,7 +35,7 @@ module ApplicationHelper
def
project_icon
(
project_id
,
options
=
{})
def
project_icon
(
project_id
,
options
=
{})
project
=
project
=
if
project_id
.
is_a?
(
Project
)
if
project_id
.
is_a?
(
Project
)
project
=
project
_id
project_id
else
else
Project
.
find_with_namespace
(
project_id
)
Project
.
find_with_namespace
(
project_id
)
end
end
...
...
app/models/ci/build.rb
View file @
ffadefb3
...
@@ -140,7 +140,7 @@ module Ci
...
@@ -140,7 +140,7 @@ module Ci
def
trace_html
def
trace_html
html
=
Ci
::
Ansi2html
::
convert
(
trace
)
if
trace
.
present?
html
=
Ci
::
Ansi2html
::
convert
(
trace
)
if
trace
.
present?
html
||
=
''
html
||
''
end
end
def
started?
def
started?
...
@@ -211,7 +211,7 @@ module Ci
...
@@ -211,7 +211,7 @@ module Ci
if
coverage
.
present?
if
coverage
.
present?
coverage
.
to_f
coverage
.
to_f
end
end
rescue
=>
ex
rescue
# if bad regex or something goes wrong we dont want to interrupt transition
# if bad regex or something goes wrong we dont want to interrupt transition
# so we just silentrly ignore error for now
# so we just silentrly ignore error for now
end
end
...
...
app/models/ci/project.rb
View file @
ffadefb3
...
@@ -184,7 +184,7 @@ module Ci
...
@@ -184,7 +184,7 @@ module Ci
# If service is available but missing in db
# If service is available but missing in db
# we should create an instance. Ex `create_gitlab_ci_service`
# we should create an instance. Ex `create_gitlab_ci_service`
se
rvice
=
se
lf
.
send
:"create_
#{
service_name
}
_service"
if
service
.
nil?
self
.
send
:"create_
#{
service_name
}
_service"
if
service
.
nil?
end
end
end
end
...
...
app/models/merge_request_diff.rb
View file @
ffadefb3
...
@@ -144,12 +144,10 @@ class MergeRequestDiff < ActiveRecord::Base
...
@@ -144,12 +144,10 @@ class MergeRequestDiff < ActiveRecord::Base
# Collect array of Git::Diff objects
# Collect array of Git::Diff objects
# between target and source branches
# between target and source branches
def
unmerged_diffs
def
unmerged_diffs
diffs
=
compare_result
.
diffs
compare_result
.
diffs
||
[]
diffs
||=
[]
rescue
Gitlab
::
Git
::
Diff
::
TimeoutError
diffs
rescue
Gitlab
::
Git
::
Diff
::
TimeoutError
=>
ex
self
.
state
=
:timeout
self
.
state
=
:timeout
diffs
=
[]
[]
end
end
def
repository
def
repository
...
...
app/models/project.rb
View file @
ffadefb3
...
@@ -413,7 +413,7 @@ class Project < ActiveRecord::Base
...
@@ -413,7 +413,7 @@ class Project < ActiveRecord::Base
if
template
.
nil?
if
template
.
nil?
# If no template, we should create an instance. Ex `create_gitlab_ci_service`
# If no template, we should create an instance. Ex `create_gitlab_ci_service`
se
rvice
=
se
lf
.
send
:"create_
#{
service_name
}
_service"
self
.
send
:"create_
#{
service_name
}
_service"
else
else
Service
.
create_from_template
(
self
.
id
,
template
)
Service
.
create_from_template
(
self
.
id
,
template
)
end
end
...
@@ -738,7 +738,7 @@ class Project < ActiveRecord::Base
...
@@ -738,7 +738,7 @@ class Project < ActiveRecord::Base
def
create_wiki
def
create_wiki
ProjectWiki
.
new
(
self
,
self
.
owner
).
wiki
ProjectWiki
.
new
(
self
,
self
.
owner
).
wiki
true
true
rescue
ProjectWiki
::
CouldNotCreateWikiError
=>
ex
rescue
ProjectWiki
::
CouldNotCreateWikiError
errors
.
add
(
:base
,
'Failed create wiki'
)
errors
.
add
(
:base
,
'Failed create wiki'
)
false
false
end
end
...
...
app/models/project_services/hipchat_service.rb
View file @
ffadefb3
...
@@ -85,7 +85,6 @@ class HipchatService < Service
...
@@ -85,7 +85,6 @@ class HipchatService < Service
def
create_message
(
data
)
def
create_message
(
data
)
object_kind
=
data
[
:object_kind
]
object_kind
=
data
[
:object_kind
]
message
=
\
case
object_kind
case
object_kind
when
"push"
,
"tag_push"
when
"push"
,
"tag_push"
create_push_message
(
data
)
create_push_message
(
data
)
...
@@ -167,8 +166,6 @@ class HipchatService < Service
...
@@ -167,8 +166,6 @@ class HipchatService < Service
obj_attr
=
data
[
:object_attributes
]
obj_attr
=
data
[
:object_attributes
]
obj_attr
=
HashWithIndifferentAccess
.
new
(
obj_attr
)
obj_attr
=
HashWithIndifferentAccess
.
new
(
obj_attr
)
merge_request_id
=
obj_attr
[
:iid
]
merge_request_id
=
obj_attr
[
:iid
]
source_branch
=
obj_attr
[
:source_branch
]
target_branch
=
obj_attr
[
:target_branch
]
state
=
obj_attr
[
:state
]
state
=
obj_attr
[
:state
]
description
=
obj_attr
[
:description
]
description
=
obj_attr
[
:description
]
title
=
obj_attr
[
:title
]
title
=
obj_attr
[
:title
]
...
@@ -194,8 +191,6 @@ class HipchatService < Service
...
@@ -194,8 +191,6 @@ class HipchatService < Service
data
=
HashWithIndifferentAccess
.
new
(
data
)
data
=
HashWithIndifferentAccess
.
new
(
data
)
user_name
=
data
[
:user
][
:name
]
user_name
=
data
[
:user
][
:name
]
repo_attr
=
HashWithIndifferentAccess
.
new
(
data
[
:repository
])
obj_attr
=
HashWithIndifferentAccess
.
new
(
data
[
:object_attributes
])
obj_attr
=
HashWithIndifferentAccess
.
new
(
data
[
:object_attributes
])
note
=
obj_attr
[
:note
]
note
=
obj_attr
[
:note
]
note_url
=
obj_attr
[
:url
]
note_url
=
obj_attr
[
:url
]
...
...
app/models/repository.rb
View file @
ffadefb3
...
@@ -549,7 +549,7 @@ class Repository
...
@@ -549,7 +549,7 @@ class Repository
# Run GitLab post receive hook
# Run GitLab post receive hook
post_receive_hook
=
Gitlab
::
Git
::
Hook
.
new
(
'post-receive'
,
path_to_repo
)
post_receive_hook
=
Gitlab
::
Git
::
Hook
.
new
(
'post-receive'
,
path_to_repo
)
status
=
post_receive_hook
.
trigger
(
gl_id
,
oldrev
,
newrev
,
ref
)
post_receive_hook
.
trigger
(
gl_id
,
oldrev
,
newrev
,
ref
)
else
else
# Remove tmp ref and return error to user
# Remove tmp ref and return error to user
rugged
.
references
.
delete
(
tmp_ref
)
rugged
.
references
.
delete
(
tmp_ref
)
...
...
app/models/user.rb
View file @
ffadefb3
...
@@ -705,13 +705,7 @@ class User < ActiveRecord::Base
...
@@ -705,13 +705,7 @@ class User < ActiveRecord::Base
end
end
def
manageable_namespaces
def
manageable_namespaces
@manageable_namespaces
||=
@manageable_namespaces
||=
[
namespace
]
+
owned_groups
+
masters_groups
begin
namespaces
=
[]
namespaces
<<
namespace
namespaces
+=
owned_groups
namespaces
+=
masters_groups
end
end
end
def
namespaces
def
namespaces
...
...
app/services/files/base_service.rb
View file @
ffadefb3
...
@@ -21,7 +21,7 @@ module Files
...
@@ -21,7 +21,7 @@ module Files
create_target_branch
create_target_branch
end
end
if
sha
=
commit
if
commit
success
success
else
else
error
(
"Something went wrong. Your changes were not committed"
)
error
(
"Something went wrong. Your changes were not committed"
)
...
...
app/services/projects/create_service.rb
View file @
ffadefb3
...
@@ -62,7 +62,7 @@ module Projects
...
@@ -62,7 +62,7 @@ module Projects
after_create_actions
if
@project
.
persisted?
after_create_actions
if
@project
.
persisted?
@project
@project
rescue
=>
ex
rescue
@project
.
errors
.
add
(
:base
,
"Can't save project. Please try again later"
)
@project
.
errors
.
add
(
:base
,
"Can't save project. Please try again later"
)
@project
@project
end
end
...
...
features/steps/groups.rb
View file @
ffadefb3
...
@@ -282,7 +282,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
...
@@ -282,7 +282,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
milestone1_project2
=
create
:milestone
,
milestone1_project2
=
create
:milestone
,
title:
"Version 7.2"
,
title:
"Version 7.2"
,
project:
project2
project:
project2
milestone1_project3
=
create
:milestone
,
create
:milestone
,
title:
"Version 7.2"
,
title:
"Version 7.2"
,
project:
@project3
project:
@project3
milestone2_project1
=
create
:milestone
,
milestone2_project1
=
create
:milestone
,
...
@@ -301,23 +301,23 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
...
@@ -301,23 +301,23 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
assignee:
current_user
,
assignee:
current_user
,
author:
current_user
,
author:
current_user
,
milestone:
milestone2_project1
milestone:
milestone2_project1
issue2
=
create
:issue
,
create
:issue
,
project:
project2
,
project:
project2
,
assignee:
current_user
,
assignee:
current_user
,
author:
current_user
,
author:
current_user
,
milestone:
milestone1_project2
milestone:
milestone1_project2
issue3
=
create
:issue
,
create
:issue
,
project:
@project3
,
project:
@project3
,
assignee:
current_user
,
assignee:
current_user
,
author:
current_user
,
author:
current_user
,
milestone:
milestone1_project1
milestone:
milestone1_project1
mr1
=
create
:merge_request
,
create
:merge_request
,
source_project:
@project1
,
source_project:
@project1
,
target_project:
@project1
,
target_project:
@project1
,
assignee:
current_user
,
assignee:
current_user
,
author:
current_user
,
author:
current_user
,
milestone:
milestone2_project1
milestone:
milestone2_project1
mr2
=
create
:merge_request
,
create
:merge_request
,
source_project:
project2
,
source_project:
project2
,
target_project:
project2
,
target_project:
project2
,
assignee:
current_user
,
assignee:
current_user
,
...
...
features/steps/project/graph.rb
View file @
ffadefb3
...
@@ -32,6 +32,6 @@ class Spinach::Features::ProjectGraph < Spinach::FeatureSteps
...
@@ -32,6 +32,6 @@ class Spinach::Features::ProjectGraph < Spinach::FeatureSteps
end
end
def
project
def
project
project
||=
Project
.
find_by
(
name:
"Shop"
)
@
project
||=
Project
.
find_by
(
name:
"Shop"
)
end
end
end
end
features/steps/project/issues/issues.rb
View file @
ffadefb3
...
@@ -223,11 +223,11 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
...
@@ -223,11 +223,11 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
end
step
'project \'Shop\' has issue \'Bugfix1\' with description: \'Description for issue1\''
do
step
'project \'Shop\' has issue \'Bugfix1\' with description: \'Description for issue1\''
do
issue
=
create
(
:issue
,
title:
'Bugfix1'
,
description:
'Description for issue1'
,
project:
project
)
create
(
:issue
,
title:
'Bugfix1'
,
description:
'Description for issue1'
,
project:
project
)
end
end
step
'project \'Shop\' has issue \'Feature1\' with description: \'Feature submitted for issue1\''
do
step
'project \'Shop\' has issue \'Feature1\' with description: \'Feature submitted for issue1\''
do
issue
=
create
(
:issue
,
title:
'Feature1'
,
description:
'Feature submitted for issue1'
,
project:
project
)
create
(
:issue
,
title:
'Feature1'
,
description:
'Feature submitted for issue1'
,
project:
project
)
end
end
step
'I fill in issue search with \'Description for issue1\''
do
step
'I fill in issue search with \'Description for issue1\''
do
...
...
features/steps/project/redirects.rb
View file @
ffadefb3
...
@@ -39,7 +39,6 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
...
@@ -39,7 +39,6 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
step
'Authenticate'
do
step
'Authenticate'
do
admin
=
create
(
:admin
)
admin
=
create
(
:admin
)
project
=
Project
.
find_by
(
name:
'Community'
)
fill_in
"user_login"
,
with:
admin
.
email
fill_in
"user_login"
,
with:
admin
.
email
fill_in
"user_password"
,
with:
admin
.
password
fill_in
"user_password"
,
with:
admin
.
password
click_button
"Sign in"
click_button
"Sign in"
...
@@ -54,7 +53,6 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
...
@@ -54,7 +53,6 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
step
'I get redirected to signin page where I sign in'
do
step
'I get redirected to signin page where I sign in'
do
admin
=
create
(
:admin
)
admin
=
create
(
:admin
)
project
=
Project
.
find_by
(
name:
'Enterprise'
)
fill_in
"user_login"
,
with:
admin
.
email
fill_in
"user_login"
,
with:
admin
.
email
fill_in
"user_password"
,
with:
admin
.
password
fill_in
"user_password"
,
with:
admin
.
password
click_button
"Sign in"
click_button
"Sign in"
...
...
features/steps/shared/group.rb
View file @
ffadefb3
...
@@ -37,7 +37,7 @@ module SharedGroup
...
@@ -37,7 +37,7 @@ module SharedGroup
group
=
Group
.
find_by
(
name:
groupname
)
||
create
(
:group
,
name:
groupname
)
group
=
Group
.
find_by
(
name:
groupname
)
||
create
(
:group
,
name:
groupname
)
group
.
add_user
(
user
,
role
)
group
.
add_user
(
user
,
role
)
project
||=
create
(
:project
,
namespace:
group
,
path:
"project
#{
@project_count
}
"
)
project
||=
create
(
:project
,
namespace:
group
,
path:
"project
#{
@project_count
}
"
)
event
||=
create
(
:closed_issue_event
,
project:
project
)
create
(
:closed_issue_event
,
project:
project
)
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
@project_count
+=
1
@project_count
+=
1
end
end
...
...
lib/api/helpers.rb
View file @
ffadefb3
...
@@ -149,7 +149,6 @@ module API
...
@@ -149,7 +149,6 @@ module API
end
end
def
attributes_for_keys
(
keys
,
custom_params
=
nil
)
def
attributes_for_keys
(
keys
,
custom_params
=
nil
)
params_hash
=
custom_params
||
params
attrs
=
{}
attrs
=
{}
keys
.
each
do
|
key
|
keys
.
each
do
|
key
|
if
params
[
key
].
present?
or
(
params
.
has_key?
(
key
)
and
params
[
key
]
==
false
)
if
params
[
key
].
present?
or
(
params
.
has_key?
(
key
)
and
params
[
key
]
==
false
)
...
...
lib/event_filter.rb
View file @
ffadefb3
...
@@ -47,7 +47,7 @@ class EventFilter
...
@@ -47,7 +47,7 @@ class EventFilter
actions
<<
Event
::
COMMENTED
if
filter
.
include?
'comments'
actions
<<
Event
::
COMMENTED
if
filter
.
include?
'comments'
events
=
events
.
where
(
action:
actions
)
events
.
where
(
action:
actions
)
end
end
def
options
(
key
)
def
options
(
key
)
...
...
lib/gitlab/contributions_calendar.rb
View file @
ffadefb3
...
@@ -12,7 +12,6 @@ module Gitlab
...
@@ -12,7 +12,6 @@ module Gitlab
@timestamps
=
{}
@timestamps
=
{}
date_from
=
1
.
year
.
ago
date_from
=
1
.
year
.
ago
date_to
=
Date
.
today
events
=
Event
.
reorder
(
nil
).
contributions
.
where
(
author_id:
user
.
id
).
events
=
Event
.
reorder
(
nil
).
contributions
.
where
(
author_id:
user
.
id
).
where
(
"created_at > ?"
,
date_from
).
where
(
project_id:
projects
).
where
(
"created_at > ?"
,
date_from
).
where
(
project_id:
projects
).
...
...
lib/gitlab/diff/parser.rb
View file @
ffadefb3
...
@@ -14,8 +14,6 @@ module Gitlab
...
@@ -14,8 +14,6 @@ module Gitlab
lines_arr
=
::
Gitlab
::
InlineDiff
.
processing
lines
lines_arr
=
::
Gitlab
::
InlineDiff
.
processing
lines
lines_arr
.
each
do
|
line
|
lines_arr
.
each
do
|
line
|
raw_line
=
line
.
dup
next
if
filename?
(
line
)
next
if
filename?
(
line
)
full_line
=
html_escape
(
line
.
gsub
(
/\n/
,
''
))
full_line
=
html_escape
(
line
.
gsub
(
/\n/
,
''
))
...
...
lib/gitlab/fogbugz_import/project_creator.rb
View file @
ffadefb3
...
@@ -23,7 +23,7 @@ module Gitlab
...
@@ -23,7 +23,7 @@ module Gitlab
import_url:
Project
::
UNKNOWN_IMPORT_URL
import_url:
Project
::
UNKNOWN_IMPORT_URL
).
execute
).
execute
import_data
=
project
.
create_import_data
(
project
.
create_import_data
(
data:
{
data:
{
'repo'
=>
repo
.
raw_data
,
'repo'
=>
repo
.
raw_data
,
'user_map'
=>
user_map
,
'user_map'
=>
user_map
,
...
...
lib/gitlab/google_code_import/project_creator.rb
View file @
ffadefb3
...
@@ -23,7 +23,7 @@ module Gitlab
...
@@ -23,7 +23,7 @@ module Gitlab
import_url:
repo
.
import_url
import_url:
repo
.
import_url
).
execute
).
execute
import_data
=
project
.
create_import_data
(
project
.
create_import_data
(
data:
{
data:
{
"repo"
=>
repo
.
raw_data
,
"repo"
=>
repo
.
raw_data
,
"user_map"
=>
user_map
"user_map"
=>
user_map
...
...
spec/features/ci/admin/builds_spec.rb
View file @
ffadefb3
...
@@ -21,10 +21,10 @@ describe "Admin Builds" do
...
@@ -21,10 +21,10 @@ describe "Admin Builds" do
describe
"Tabs"
do
describe
"Tabs"
do
it
"shows all builds"
do
it
"shows all builds"
do
build
=
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
status:
"pending"
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
status:
"pending"
build1
=
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
status:
"running"
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
status:
"running"
build2
=
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
status:
"success"
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
status:
"success"
build3
=
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
status:
"failed"
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
status:
"failed"
visit
ci_admin_builds_path
visit
ci_admin_builds_path
...
...
spec/lib/gitlab/backend/grack_auth_spec.rb
View file @
ffadefb3
...
@@ -151,14 +151,14 @@ describe Grack::Auth do
...
@@ -151,14 +151,14 @@ describe Grack::Auth do
end
end
it
"repeated attempts followed by successful attempt"
do
it
"repeated attempts followed by successful attempt"
do
for
n
in
0
..
maxretry
do
maxretry
.
times
.
each
do
expect
(
attempt_login
(
false
)).
to
eq
(
401
)
expect
(
attempt_login
(
false
)).
to
eq
(
401
)
end
end
expect
(
attempt_login
(
true
)).
to
eq
(
200
)
expect
(
attempt_login
(
true
)).
to
eq
(
200
)
expect
(
Rack
::
Attack
::
Allow2Ban
.
banned?
(
ip
)).
to
be_falsey
expect
(
Rack
::
Attack
::
Allow2Ban
.
banned?
(
ip
)).
to
be_falsey
for
n
in
0
..
maxretry
do
maxretry
.
times
.
each
do
expect
(
attempt_login
(
false
)).
to
eq
(
401
)
expect
(
attempt_login
(
false
)).
to
eq
(
401
)
end
end
end
end
...
...
spec/lib/gitlab/o_auth/user_spec.rb
View file @
ffadefb3
...
@@ -19,10 +19,6 @@ describe Gitlab::OAuth::User do
...
@@ -19,10 +19,6 @@ describe Gitlab::OAuth::User do
let!
(
:existing_user
)
{
create
(
:omniauth_user
,
extern_uid:
'my-uid'
,
provider:
'my-provider'
)
}
let!
(
:existing_user
)
{
create
(
:omniauth_user
,
extern_uid:
'my-uid'
,
provider:
'my-provider'
)
}
it
"finds an existing user based on uid and provider (facebook)"
do
it
"finds an existing user based on uid and provider (facebook)"
do
# FIXME (rspeicher): It's unlikely that this test is actually doing anything
# `auth` is never used and removing it entirely doesn't break the test, so
# what's it doing?
auth
=
double
(
info:
double
(
name:
'John'
),
uid:
'my-uid'
,
provider:
'my-provider'
)
expect
(
oauth_user
.
persisted?
).
to
be_truthy
expect
(
oauth_user
.
persisted?
).
to
be_truthy
end
end
...
...
spec/models/broadcast_message_spec.rb
View file @
ffadefb3
...
@@ -27,12 +27,12 @@ describe BroadcastMessage do
...
@@ -27,12 +27,12 @@ describe BroadcastMessage do
end
end
it
"should return nil if time not come"
do
it
"should return nil if time not come"
do
broadcast_message
=
create
(
:broadcast_message
,
starts_at:
Time
.
now
.
tomorrow
,
ends_at:
Time
.
now
+
2
.
days
)
create
(
:broadcast_message
,
starts_at:
Time
.
now
.
tomorrow
,
ends_at:
Time
.
now
+
2
.
days
)
expect
(
BroadcastMessage
.
current
).
to
be_nil
expect
(
BroadcastMessage
.
current
).
to
be_nil
end
end
it
"should return nil if time has passed"
do
it
"should return nil if time has passed"
do
broadcast_message
=
create
(
:broadcast_message
,
starts_at:
Time
.
now
-
2
.
days
,
ends_at:
Time
.
now
.
yesterday
)
create
(
:broadcast_message
,
starts_at:
Time
.
now
-
2
.
days
,
ends_at:
Time
.
now
.
yesterday
)
expect
(
BroadcastMessage
.
current
).
to
be_nil
expect
(
BroadcastMessage
.
current
).
to
be_nil
end
end
end
end
...
...
spec/models/ci/commit_spec.rb
View file @
ffadefb3
...
@@ -228,13 +228,13 @@ describe Ci::Commit do
...
@@ -228,13 +228,13 @@ describe Ci::Commit do
it
"returns finished_at of latest build"
do
it
"returns finished_at of latest build"
do
build
=
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
finished_at:
Time
.
now
-
60
build
=
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
finished_at:
Time
.
now
-
60
build1
=
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
finished_at:
Time
.
now
-
120
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
finished_at:
Time
.
now
-
120
expect
(
commit
.
finished_at
.
to_i
).
to
eq
(
build
.
finished_at
.
to_i
)
expect
(
commit
.
finished_at
.
to_i
).
to
eq
(
build
.
finished_at
.
to_i
)
end
end
it
"returns nil if there is no finished build"
do
it
"returns nil if there is no finished build"
do
build
=
FactoryGirl
.
create
:ci_not_started_build
,
commit:
commit
FactoryGirl
.
create
:ci_not_started_build
,
commit:
commit
expect
(
commit
.
finished_at
).
to
be_nil
expect
(
commit
.
finished_at
).
to
be_nil
end
end
...
...
spec/models/hooks/project_hook_spec.rb
View file @
ffadefb3
...
@@ -22,7 +22,7 @@ describe ProjectHook do
...
@@ -22,7 +22,7 @@ describe ProjectHook do
describe
'.push_hooks'
do
describe
'.push_hooks'
do
it
'should return hooks for push events only'
do
it
'should return hooks for push events only'
do
hook
=
create
(
:project_hook
,
push_events:
true
)
hook
=
create
(
:project_hook
,
push_events:
true
)
hook2
=
create
(
:project_hook
,
push_events:
false
)
create
(
:project_hook
,
push_events:
false
)
expect
(
ProjectHook
.
push_hooks
).
to
eq
([
hook
])
expect
(
ProjectHook
.
push_hooks
).
to
eq
([
hook
])
end
end
end
end
...
@@ -30,7 +30,7 @@ describe ProjectHook do
...
@@ -30,7 +30,7 @@ describe ProjectHook do
describe
'.tag_push_hooks'
do
describe
'.tag_push_hooks'
do
it
'should return hooks for tag push events only'
do
it
'should return hooks for tag push events only'
do
hook
=
create
(
:project_hook
,
tag_push_events:
true
)
hook
=
create
(
:project_hook
,
tag_push_events:
true
)
hook2
=
create
(
:project_hook
,
tag_push_events:
false
)
create
(
:project_hook
,
tag_push_events:
false
)
expect
(
ProjectHook
.
tag_push_hooks
).
to
eq
([
hook
])
expect
(
ProjectHook
.
tag_push_hooks
).
to
eq
([
hook
])
end
end
end
end
...
...
spec/models/hooks/service_hook_spec.rb
View file @
ffadefb3
...
@@ -39,8 +39,6 @@ describe ServiceHook do
...
@@ -39,8 +39,6 @@ describe ServiceHook do
end
end
it
"POSTs the data as JSON"
do
it
"POSTs the data as JSON"
do
json
=
@data
.
to_json
@service_hook
.
execute
(
@data
)
@service_hook
.
execute
(
@data
)
expect
(
WebMock
).
to
have_requested
(
:post
,
@service_hook
.
url
).
with
(
expect
(
WebMock
).
to
have_requested
(
:post
,
@service_hook
.
url
).
with
(
headers:
{
'Content-Type'
=>
'application/json'
,
'X-Gitlab-Event'
=>
'Service Hook'
}
headers:
{
'Content-Type'
=>
'application/json'
,
'X-Gitlab-Event'
=>
'Service Hook'
}
...
...
spec/models/hooks/web_hook_spec.rb
View file @
ffadefb3
...
@@ -60,8 +60,6 @@ describe ProjectHook do
...
@@ -60,8 +60,6 @@ describe ProjectHook do
end
end
it
"POSTs the data as JSON"
do
it
"POSTs the data as JSON"
do
json
=
@data
.
to_json
@project_hook
.
execute
(
@data
,
'push_hooks'
)
@project_hook
.
execute
(
@data
,
'push_hooks'
)
expect
(
WebMock
).
to
have_requested
(
:post
,
@project_hook
.
url
).
with
(
expect
(
WebMock
).
to
have_requested
(
:post
,
@project_hook
.
url
).
with
(
headers:
{
'Content-Type'
=>
'application/json'
,
'X-Gitlab-Event'
=>
'Push Hook'
}
headers:
{
'Content-Type'
=>
'application/json'
,
'X-Gitlab-Event'
=>
'Push Hook'
}
...
...
spec/models/milestone_spec.rb
View file @
ffadefb3
...
@@ -111,8 +111,8 @@ describe Milestone do
...
@@ -111,8 +111,8 @@ describe Milestone do
describe
:is_empty?
do
describe
:is_empty?
do
before
do
before
do
issue
=
create
:closed_issue
,
milestone:
milestone
create
:closed_issue
,
milestone:
milestone
merge_request
=
create
:merge_request
,
milestone:
milestone
create
:merge_request
,
milestone:
milestone
end
end
it
'Should return total count of issues and merge requests assigned to milestone'
do
it
'Should return total count of issues and merge requests assigned to milestone'
do
...
@@ -125,7 +125,7 @@ describe Milestone do
...
@@ -125,7 +125,7 @@ describe Milestone do
milestone
=
create
:milestone
milestone
=
create
:milestone
create
:closed_issue
,
milestone:
milestone
create
:closed_issue
,
milestone:
milestone
issue
=
create
:issue
create
:issue
end
end
it
'should be true if milestone active and all nested issues closed'
do
it
'should be true if milestone active and all nested issues closed'
do
...
...
spec/models/project_services/gitlab_ci_service_spec.rb
View file @
ffadefb3
...
@@ -49,7 +49,6 @@ describe GitlabCiService do
...
@@ -49,7 +49,6 @@ describe GitlabCiService do
let
(
:push_sample_data
)
{
Gitlab
::
PushDataBuilder
.
build_sample
(
project
,
user
)
}
let
(
:push_sample_data
)
{
Gitlab
::
PushDataBuilder
.
build_sample
(
project
,
user
)
}
it
"calls ci_yaml_file"
do
it
"calls ci_yaml_file"
do
service_hook
=
double
expect
(
@service
).
to
receive
(
:ci_yaml_file
).
with
(
push_sample_data
[
:checkout_sha
])
expect
(
@service
).
to
receive
(
:ci_yaml_file
).
with
(
push_sample_data
[
:checkout_sha
])
@service
.
execute
(
push_sample_data
)
@service
.
execute
(
push_sample_data
)
...
...
spec/models/project_services/hipchat_service_spec.rb
View file @
ffadefb3
...
@@ -87,7 +87,7 @@ describe HipchatService do
...
@@ -87,7 +87,7 @@ describe HipchatService do
it
"should create a push message"
do
it
"should create a push message"
do
message
=
hipchat
.
send
(
:create_push_message
,
push_sample_data
)
message
=
hipchat
.
send
(
:create_push_message
,
push_sample_data
)
obj_attr
=
push_sample_data
[
:object_attributes
]
push_sample_data
[
:object_attributes
]
branch
=
push_sample_data
[
:ref
].
gsub
(
'refs/heads/'
,
''
)
branch
=
push_sample_data
[
:ref
].
gsub
(
'refs/heads/'
,
''
)
expect
(
message
).
to
include
(
"
#{
user
.
name
}
pushed to branch "
\
expect
(
message
).
to
include
(
"
#{
user
.
name
}
pushed to branch "
\
"<a href=
\"
#{
project
.
web_url
}
/commits/
#{
branch
}
\"
>
#{
branch
}
</a> of "
\
"<a href=
\"
#{
project
.
web_url
}
/commits/
#{
branch
}
\"
>
#{
branch
}
</a> of "
\
...
@@ -107,7 +107,7 @@ describe HipchatService do
...
@@ -107,7 +107,7 @@ describe HipchatService do
it
"should create a tag push message"
do
it
"should create a tag push message"
do
message
=
hipchat
.
send
(
:create_push_message
,
push_sample_data
)
message
=
hipchat
.
send
(
:create_push_message
,
push_sample_data
)
obj_attr
=
push_sample_data
[
:object_attributes
]
push_sample_data
[
:object_attributes
]
expect
(
message
).
to
eq
(
"
#{
user
.
name
}
pushed new tag "
\
expect
(
message
).
to
eq
(
"
#{
user
.
name
}
pushed new tag "
\
"<a href=
\"
#{
project
.
web_url
}
/commits/test
\"
>test</a> to "
\
"<a href=
\"
#{
project
.
web_url
}
/commits/test
\"
>test</a> to "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>
\n
"
)
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>
\n
"
)
...
...
spec/models/project_spec.rb
View file @
ffadefb3
...
@@ -140,7 +140,7 @@ describe Project do
...
@@ -140,7 +140,7 @@ describe Project do
describe
'last_activity_date'
do
describe
'last_activity_date'
do
it
'returns the creation date of the project\'s last event if present'
do
it
'returns the creation date of the project\'s last event if present'
do
last_activity_event
=
create
(
:event
,
project:
project
)
create
(
:event
,
project:
project
)
expect
(
project
.
last_activity_at
.
to_i
).
to
eq
(
last_event
.
created_at
.
to_i
)
expect
(
project
.
last_activity_at
.
to_i
).
to
eq
(
last_event
.
created_at
.
to_i
)
end
end
...
...
spec/models/project_wiki_spec.rb
View file @
ffadefb3
...
@@ -231,7 +231,7 @@ describe ProjectWiki do
...
@@ -231,7 +231,7 @@ describe ProjectWiki do
end
end
def
commit_details
def
commit_details
commit
=
{
name:
user
.
name
,
email:
user
.
email
,
message:
"test commit"
}
{
name:
user
.
name
,
email:
user
.
email
,
message:
"test commit"
}
end
end
def
create_page
(
name
,
content
)
def
create_page
(
name
,
content
)
...
...
spec/models/wiki_page_spec.rb
View file @
ffadefb3
...
@@ -196,7 +196,7 @@ describe WikiPage do
...
@@ -196,7 +196,7 @@ describe WikiPage do
end
end
def
commit_details
def
commit_details
commit
=
{
name:
user
.
name
,
email:
user
.
email
,
message:
"test commit"
}
{
name:
user
.
name
,
email:
user
.
email
,
message:
"test commit"
}
end
end
def
create_page
(
name
,
content
)
def
create_page
(
name
,
content
)
...
...
spec/tasks/gitlab/backup_rake_spec.rb
View file @
ffadefb3
...
@@ -159,7 +159,7 @@ describe 'gitlab:app namespace rake task' do
...
@@ -159,7 +159,7 @@ describe 'gitlab:app namespace rake task' do
end
end
it
"does not contain skipped item"
do
it
"does not contain skipped item"
do
tar_contents
,
exit_status
=
Gitlab
::
Popen
.
popen
(
tar_contents
,
_
exit_status
=
Gitlab
::
Popen
.
popen
(
%W{tar -tvf
#{
@backup_tar
}
db uploads repositories builds}
%W{tar -tvf
#{
@backup_tar
}
db uploads repositories builds}
)
)
...
...
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