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
Léo-Paul Géneau
gitlab-ce
Commits
b5291f95
Commit
b5291f95
authored
Dec 15, 2015
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Rubocop offenses
parent
d1f1c5c6
Changes
58
Show whitespace changes
Inline
Side-by-side
Showing
58 changed files
with
155 additions
and
154 deletions
+155
-154
app/controllers/dashboard/snippets_controller.rb
app/controllers/dashboard/snippets_controller.rb
+2
-1
app/controllers/projects/notes_controller.rb
app/controllers/projects/notes_controller.rb
+1
-1
app/controllers/projects/protected_branches_controller.rb
app/controllers/projects/protected_branches_controller.rb
+1
-1
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+1
-1
app/helpers/external_wiki_helper.rb
app/helpers/external_wiki_helper.rb
+1
-1
app/helpers/gitlab_markdown_helper.rb
app/helpers/gitlab_markdown_helper.rb
+2
-1
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+3
-4
app/helpers/tree_helper.rb
app/helpers/tree_helper.rb
+1
-1
app/mailers/notify.rb
app/mailers/notify.rb
+1
-1
app/models/application_setting.rb
app/models/application_setting.rb
+6
-6
app/models/concerns/token_authenticatable.rb
app/models/concerns/token_authenticatable.rb
+2
-2
app/models/merge_request.rb
app/models/merge_request.rb
+1
-3
app/models/namespace.rb
app/models/namespace.rb
+2
-2
app/models/project.rb
app/models/project.rb
+5
-5
app/models/project_services/bamboo_service.rb
app/models/project_services/bamboo_service.rb
+2
-4
app/models/project_services/flowdock_service.rb
app/models/project_services/flowdock_service.rb
+1
-1
app/models/project_services/gemnasium_service.rb
app/models/project_services/gemnasium_service.rb
+1
-1
app/models/project_services/teamcity_service.rb
app/models/project_services/teamcity_service.rb
+3
-5
app/models/user.rb
app/models/user.rb
+3
-3
app/services/merge_requests/refresh_service.rb
app/services/merge_requests/refresh_service.rb
+1
-1
config/initializers/carrierwave.rb
config/initializers/carrierwave.rb
+5
-5
config/routes.rb
config/routes.rb
+1
-1
features/steps/explore/groups.rb
features/steps/explore/groups.rb
+4
-4
features/steps/explore/projects.rb
features/steps/explore/projects.rb
+6
-6
features/steps/groups.rb
features/steps/groups.rb
+1
-1
features/steps/profile/profile.rb
features/steps/profile/profile.rb
+1
-1
features/steps/project/project.rb
features/steps/project/project.rb
+1
-1
features/steps/project/source/browse_files.rb
features/steps/project/source/browse_files.rb
+6
-6
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+4
-4
lib/api/entities.rb
lib/api/entities.rb
+1
-1
lib/gitlab/backend/shell.rb
lib/gitlab/backend/shell.rb
+1
-1
lib/gitlab/bitbucket_import/project_creator.rb
lib/gitlab/bitbucket_import/project_creator.rb
+2
-1
lib/gitlab/diff/file.rb
lib/gitlab/diff/file.rb
+2
-2
lib/gitlab/fogbugz_import/importer.rb
lib/gitlab/fogbugz_import/importer.rb
+1
-1
lib/gitlab/fogbugz_import/project_creator.rb
lib/gitlab/fogbugz_import/project_creator.rb
+2
-1
lib/gitlab/gitlab_import/project_creator.rb
lib/gitlab/gitlab_import/project_creator.rb
+2
-1
lib/gitlab/gitorious_import/project_creator.rb
lib/gitlab/gitorious_import/project_creator.rb
+2
-1
lib/gitlab/google_code_import/importer.rb
lib/gitlab/google_code_import/importer.rb
+3
-3
lib/gitlab/google_code_import/project_creator.rb
lib/gitlab/google_code_import/project_creator.rb
+2
-1
lib/gitlab/markdown/filter/markdown_filter.rb
lib/gitlab/markdown/filter/markdown_filter.rb
+1
-1
lib/gitlab/markdown/filter/table_of_contents_filter.rb
lib/gitlab/markdown/filter/table_of_contents_filter.rb
+1
-1
lib/rouge/formatters/html_gitlab.rb
lib/rouge/formatters/html_gitlab.rb
+1
-1
spec/factories.rb
spec/factories.rb
+2
-1
spec/features/security/group_access_spec.rb
spec/features/security/group_access_spec.rb
+2
-2
spec/helpers/groups_helper.rb
spec/helpers/groups_helper.rb
+1
-1
spec/models/ci/commit_spec.rb
spec/models/ci/commit_spec.rb
+2
-2
spec/models/key_spec.rb
spec/models/key_spec.rb
+1
-1
spec/models/project_services/hipchat_service_spec.rb
spec/models/project_services/hipchat_service_spec.rb
+10
-12
spec/models/project_services/slack_service/note_message_spec.rb
...odels/project_services/slack_service/note_message_spec.rb
+4
-4
spec/models/user_spec.rb
spec/models/user_spec.rb
+2
-2
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+1
-1
spec/requests/api/services_spec.rb
spec/requests/api/services_spec.rb
+1
-1
spec/services/create_commit_builds_service_spec.rb
spec/services/create_commit_builds_service_spec.rb
+11
-11
spec/services/git_tag_push_service_spec.rb
spec/services/git_tag_push_service_spec.rb
+8
-8
spec/services/update_snippet_service_spec.rb
spec/services/update_snippet_service_spec.rb
+1
-1
spec/support/repo_helpers.rb
spec/support/repo_helpers.rb
+6
-6
spec/workers/repository_fork_worker_spec.rb
spec/workers/repository_fork_worker_spec.rb
+11
-9
spec/workers/stuck_ci_builds_worker_spec.rb
spec/workers/stuck_ci_builds_worker_spec.rb
+2
-2
No files found.
app/controllers/dashboard/snippets_controller.rb
View file @
b5291f95
class
Dashboard::SnippetsController
<
Dashboard
::
ApplicationController
class
Dashboard::SnippetsController
<
Dashboard
::
ApplicationController
def
index
def
index
@snippets
=
SnippetsFinder
.
new
.
execute
(
current_user
,
@snippets
=
SnippetsFinder
.
new
.
execute
(
current_user
,
filter: :by_user
,
filter: :by_user
,
user:
current_user
,
user:
current_user
,
scope:
params
[
:scope
]
scope:
params
[
:scope
]
...
...
app/controllers/projects/notes_controller.rb
View file @
b5291f95
...
@@ -68,7 +68,7 @@ class Projects::NotesController < Projects::ApplicationController
...
@@ -68,7 +68,7 @@ class Projects::NotesController < Projects::ApplicationController
data
=
{
data
=
{
author:
current_user
,
author:
current_user
,
is_award:
true
,
is_award:
true
,
note:
note_params
[
:note
].
gsub
(
":"
,
''
)
note:
note_params
[
:note
].
delete
(
":"
)
}
}
note
=
noteable
.
notes
.
find_by
(
data
)
note
=
noteable
.
notes
.
find_by
(
data
)
...
...
app/controllers/projects/protected_branches_controller.rb
View file @
b5291f95
app/helpers/application_helper.rb
View file @
b5291f95
...
@@ -61,7 +61,7 @@ module ApplicationHelper
...
@@ -61,7 +61,7 @@ module ApplicationHelper
options
[
:class
]
||=
''
options
[
:class
]
||=
''
options
[
:class
]
<<
' identicon'
options
[
:class
]
<<
' identicon'
bg_key
=
project
.
id
%
7
bg_key
=
project
.
id
%
7
style
=
"background-color: #
#{
allowed_colors
.
values
[
bg_key
]
}
; color: #555"
style
=
"background-color: #
#{
allowed_colors
.
values
[
bg_key
]
}
; color: #555"
content_tag
(
:div
,
class:
options
[
:class
],
style:
style
)
do
content_tag
(
:div
,
class:
options
[
:class
],
style:
style
)
do
project
.
name
[
0
,
1
].
upcase
project
.
name
[
0
,
1
].
upcase
...
...
app/helpers/external_wiki_helper.rb
View file @
b5291f95
module
ExternalWikiHelper
module
ExternalWikiHelper
def
get_project_wiki_path
(
project
)
def
get_project_wiki_path
(
project
)
external_wiki_service
=
project
.
services
.
external_wiki_service
=
project
.
services
.
select
{
|
service
|
service
.
to_param
==
'external_wiki'
}.
first
find
{
|
service
|
service
.
to_param
==
'external_wiki'
}
if
external_wiki_service
.
present?
&&
external_wiki_service
.
active?
if
external_wiki_service
.
present?
&&
external_wiki_service
.
active?
external_wiki_service
.
properties
[
'external_wiki_url'
]
external_wiki_service
.
properties
[
'external_wiki_url'
]
else
else
...
...
app/helpers/gitlab_markdown_helper.rb
View file @
b5291f95
...
@@ -65,7 +65,8 @@ module GitlabMarkdownHelper
...
@@ -65,7 +65,8 @@ module GitlabMarkdownHelper
end
end
def
asciidoc
(
text
)
def
asciidoc
(
text
)
Gitlab
::
Asciidoc
.
render
(
text
,
Gitlab
::
Asciidoc
.
render
(
text
,
project:
@project
,
project:
@project
,
current_user:
(
current_user
if
defined?
(
current_user
)),
current_user:
(
current_user
if
defined?
(
current_user
)),
...
...
app/helpers/projects_helper.rb
View file @
b5291f95
...
@@ -332,8 +332,7 @@ module ProjectsHelper
...
@@ -332,8 +332,7 @@ module ProjectsHelper
namespace_project_blob_path
(
namespace_project_blob_path
(
project
.
namespace
,
project
.
namespace
,
project
,
project
,
tree_join
(
project
.
default_branch
,
tree_join
(
project
.
default_branch
,
blob
.
name
)
blob
.
name
)
)
)
end
end
end
end
...
...
app/helpers/tree_helper.rb
View file @
b5291f95
...
@@ -79,7 +79,7 @@ module TreeHelper
...
@@ -79,7 +79,7 @@ module TreeHelper
part_path
=
File
.
join
(
part_path
,
part
)
unless
part_path
.
empty?
part_path
=
File
.
join
(
part_path
,
part
)
unless
part_path
.
empty?
part_path
=
part
if
part_path
.
empty?
part_path
=
part
if
part_path
.
empty?
next
unless
parts
.
last
(
2
).
include?
(
part
)
if
parts
.
count
>
max_links
next
if
parts
.
count
>
max_links
&&
!
parts
.
last
(
2
).
include?
(
part
)
yield
(
part
,
tree_join
(
@ref
,
part_path
))
yield
(
part
,
tree_join
(
@ref
,
part_path
))
end
end
end
end
...
...
app/mailers/notify.rb
View file @
b5291f95
app/models/application_setting.rb
View file @
b5291f95
app/models/concerns/token_authenticatable.rb
View file @
b5291f95
...
@@ -13,7 +13,7 @@ module TokenAuthenticatable
...
@@ -13,7 +13,7 @@ module TokenAuthenticatable
@token_fields
<<
token_field
@token_fields
<<
token_field
define_singleton_method
(
"find_by_
#{
token_field
}
"
)
do
|
token
|
define_singleton_method
(
"find_by_
#{
token_field
}
"
)
do
|
token
|
where
(
token_field
=>
token
).
first
if
token
find_by
(
token_field
=>
token
)
if
token
end
end
define_method
(
"ensure_
#{
token_field
}
"
)
do
define_method
(
"ensure_
#{
token_field
}
"
)
do
...
@@ -37,7 +37,7 @@ module TokenAuthenticatable
...
@@ -37,7 +37,7 @@ module TokenAuthenticatable
def
generate_token_for
(
token_field
)
def
generate_token_for
(
token_field
)
loop
do
loop
do
token
=
Devise
.
friendly_token
token
=
Devise
.
friendly_token
break
token
unless
self
.
class
.
unscoped
.
where
(
token_field
=>
token
).
first
break
token
unless
self
.
class
.
unscoped
.
find_by
(
token_field
=>
token
)
end
end
end
end
end
end
app/models/merge_request.rb
View file @
b5291f95
...
@@ -194,9 +194,7 @@ class MergeRequest < ActiveRecord::Base
...
@@ -194,9 +194,7 @@ class MergeRequest < ActiveRecord::Base
similar_mrs
=
similar_mrs
.
where
(
'id not in (?)'
,
self
.
id
)
if
self
.
id
similar_mrs
=
similar_mrs
.
where
(
'id not in (?)'
,
self
.
id
)
if
self
.
id
if
similar_mrs
.
any?
if
similar_mrs
.
any?
errors
.
add
:validate_branches
,
errors
.
add
:validate_branches
,
"Cannot Create: This merge request already exists:
#{
"Cannot Create: This merge request already exists:
#{
similar_mrs
.
pluck
(
:title
)
}
"
similar_mrs
.
pluck
(
:title
)
}
"
end
end
end
end
end
end
...
...
app/models/namespace.rb
View file @
b5291f95
...
@@ -45,7 +45,7 @@ class Namespace < ActiveRecord::Base
...
@@ -45,7 +45,7 @@ class Namespace < ActiveRecord::Base
class
<<
self
class
<<
self
def
by_path
(
path
)
def
by_path
(
path
)
where
(
'lower(path) = :value'
,
value:
path
.
downcase
).
first
find_by
(
'lower(path) = :value'
,
value:
path
.
downcase
)
end
end
# Case insensetive search for namespace by path or name
# Case insensetive search for namespace by path or name
...
@@ -148,6 +148,6 @@ class Namespace < ActiveRecord::Base
...
@@ -148,6 +148,6 @@ class Namespace < ActiveRecord::Base
end
end
def
find_fork_of
(
project
)
def
find_fork_of
(
project
)
projects
.
joins
(
:forked_project_link
).
where
(
'forked_project_links.forked_from_project_id = ?'
,
project
.
id
).
first
projects
.
joins
(
:forked_project_link
).
find_by
(
'forked_project_links.forked_from_project_id = ?'
,
project
.
id
)
end
end
end
end
app/models/project.rb
View file @
b5291f95
...
@@ -265,7 +265,7 @@ class Project < ActiveRecord::Base
...
@@ -265,7 +265,7 @@ class Project < ActiveRecord::Base
joins
(
:namespace
).
joins
(
:namespace
).
iwhere
(
'namespaces.path'
=>
namespace_path
)
iwhere
(
'namespaces.path'
=>
namespace_path
)
projects
.
where
(
'projects.path'
=>
project_path
).
take
||
projects
.
find_by
(
'projects.path'
=>
project_path
)
||
projects
.
iwhere
(
'projects.path'
=>
project_path
).
take
projects
.
iwhere
(
'projects.path'
=>
project_path
).
take
end
end
...
@@ -450,7 +450,7 @@ class Project < ActiveRecord::Base
...
@@ -450,7 +450,7 @@ class Project < ActiveRecord::Base
end
end
def
external_issue_tracker
def
external_issue_tracker
@external_issues_tracker
||=
external_issues_trackers
.
select
(
&
:activated?
).
first
@external_issues_tracker
||=
external_issues_trackers
.
find
(
&
:activated?
)
end
end
def
can_have_issues_tracker_id?
def
can_have_issues_tracker_id?
...
@@ -496,7 +496,7 @@ class Project < ActiveRecord::Base
...
@@ -496,7 +496,7 @@ class Project < ActiveRecord::Base
end
end
def
ci_service
def
ci_service
@ci_service
||=
ci_services
.
select
(
&
:activated?
).
first
@ci_service
||=
ci_services
.
find
(
&
:activated?
)
end
end
def
avatar_type
def
avatar_type
...
@@ -547,7 +547,7 @@ class Project < ActiveRecord::Base
...
@@ -547,7 +547,7 @@ class Project < ActiveRecord::Base
end
end
def
project_member_by_name_or_email
(
name
=
nil
,
email
=
nil
)
def
project_member_by_name_or_email
(
name
=
nil
,
email
=
nil
)
user
=
users
.
where
(
'name like ? or email like ?'
,
name
,
email
).
first
user
=
users
.
find_by
(
'name like ? or email like ?'
,
name
,
email
)
project_members
.
where
(
user:
user
)
if
user
project_members
.
where
(
user:
user
)
if
user
end
end
...
@@ -722,7 +722,7 @@ class Project < ActiveRecord::Base
...
@@ -722,7 +722,7 @@ class Project < ActiveRecord::Base
end
end
def
project_member
(
user
)
def
project_member
(
user
)
project_members
.
where
(
user_id:
user
).
first
project_members
.
find_by
(
user_id:
user
)
end
end
def
default_branch
def
default_branch
...
...
app/models/project_services/bamboo_service.rb
View file @
b5291f95
...
@@ -27,12 +27,10 @@ class BambooService < CiService
...
@@ -27,12 +27,10 @@ class BambooService < CiService
validates
:build_key
,
presence:
true
,
if: :activated?
validates
:build_key
,
presence:
true
,
if: :activated?
validates
:username
,
validates
:username
,
presence:
true
,
presence:
true
,
if:
->
(
service
)
{
service
.
password?
},
if:
->
(
service
)
{
service
.
activated?
&&
service
.
password?
}
if: :activated?
validates
:password
,
validates
:password
,
presence:
true
,
presence:
true
,
if:
->
(
service
)
{
service
.
username?
},
if:
->
(
service
)
{
service
.
activated?
&&
service
.
username?
}
if: :activated?
attr_accessor
:response
attr_accessor
:response
...
...
app/models/project_services/flowdock_service.rb
View file @
b5291f95
app/models/project_services/gemnasium_service.rb
View file @
b5291f95
app/models/project_services/teamcity_service.rb
View file @
b5291f95
...
@@ -27,12 +27,10 @@ class TeamcityService < CiService
...
@@ -27,12 +27,10 @@ class TeamcityService < CiService
validates
:build_type
,
presence:
true
,
if: :activated?
validates
:build_type
,
presence:
true
,
if: :activated?
validates
:username
,
validates
:username
,
presence:
true
,
presence:
true
,
if:
->
(
service
)
{
service
.
password?
},
if:
->
(
service
)
{
service
.
activated?
&&
service
.
password?
}
if: :activated?
validates
:password
,
validates
:password
,
presence:
true
,
presence:
true
,
if:
->
(
service
)
{
service
.
username?
},
if:
->
(
service
)
{
service
.
activated?
&&
service
.
username?
}
if: :activated?
attr_accessor
:response
attr_accessor
:response
...
...
app/models/user.rb
View file @
b5291f95
...
@@ -220,9 +220,9 @@ class User < ActiveRecord::Base
...
@@ -220,9 +220,9 @@ class User < ActiveRecord::Base
def
find_for_database_authentication
(
warden_conditions
)
def
find_for_database_authentication
(
warden_conditions
)
conditions
=
warden_conditions
.
dup
conditions
=
warden_conditions
.
dup
if
login
=
conditions
.
delete
(
:login
)
if
login
=
conditions
.
delete
(
:login
)
where
(
conditions
).
where
([
"lower(username) = :value OR lower(email) = :value"
,
{
value:
login
.
downcase
}]).
first
where
(
conditions
).
find_by
(
"lower(username) = :value OR lower(email) = :value"
,
value:
login
.
downcase
)
else
else
where
(
conditions
).
first
find_by
(
conditions
)
end
end
end
end
...
@@ -285,7 +285,7 @@ class User < ActiveRecord::Base
...
@@ -285,7 +285,7 @@ class User < ActiveRecord::Base
end
end
def
by_username_or_id
(
name_or_id
)
def
by_username_or_id
(
name_or_id
)
where
(
'users.username = ? OR users.id = ?'
,
name_or_id
.
to_s
,
name_or_id
.
to_i
).
first
find_by
(
'users.username = ? OR users.id = ?'
,
name_or_id
.
to_s
,
name_or_id
.
to_i
)
end
end
def
build_user
(
attrs
=
{})
def
build_user
(
attrs
=
{})
...
...
app/services/merge_requests/refresh_service.rb
View file @
b5291f95
config/initializers/carrierwave.rb
View file @
b5291f95
config/routes.rb
View file @
b5291f95
features/steps/explore/groups.rb
View file @
b5291f95
features/steps/explore/projects.rb
View file @
b5291f95
features/steps/groups.rb
View file @
b5291f95
...
@@ -85,7 +85,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
...
@@ -85,7 +85,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
step
'I should see new group "Owned" avatar'
do
step
'I should see new group "Owned" avatar'
do
expect
(
owned_group
.
avatar
).
to
be_instance_of
AvatarUploader
expect
(
owned_group
.
avatar
).
to
be_instance_of
AvatarUploader
expect
(
owned_group
.
avatar
.
url
).
to
eq
"/uploads/group/avatar/
#{
Group
.
find_by
(
name
:"Owned"
).
id
}
/banana_sample.gif"
expect
(
owned_group
.
avatar
.
url
).
to
eq
"/uploads/group/avatar/
#{
Group
.
find_by
(
name
:"Owned"
).
id
}
/banana_sample.gif"
end
end
step
'I should see the "Remove avatar" button'
do
step
'I should see the "Remove avatar" button'
do
...
...
features/steps/profile/profile.rb
View file @
b5291f95
...
@@ -34,7 +34,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
...
@@ -34,7 +34,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
step
'I should see new avatar'
do
step
'I should see new avatar'
do
expect
(
@user
.
avatar
).
to
be_instance_of
AvatarUploader
expect
(
@user
.
avatar
).
to
be_instance_of
AvatarUploader
expect
(
@user
.
avatar
.
url
).
to
eq
"/uploads/user/avatar/
#{
@user
.
id
}
/banana_sample.gif"
expect
(
@user
.
avatar
.
url
).
to
eq
"/uploads/user/avatar/
#{
@user
.
id
}
/banana_sample.gif"
end
end
step
'I should see the "Remove avatar" button'
do
step
'I should see the "Remove avatar" button'
do
...
...
features/steps/project/project.rb
View file @
b5291f95
...
@@ -37,7 +37,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps
...
@@ -37,7 +37,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps
step
'I should see new project avatar'
do
step
'I should see new project avatar'
do
expect
(
@project
.
avatar
).
to
be_instance_of
AvatarUploader
expect
(
@project
.
avatar
).
to
be_instance_of
AvatarUploader
url
=
@project
.
avatar
.
url
url
=
@project
.
avatar
.
url
expect
(
url
).
to
eq
"/uploads/project/avatar/
#{
@project
.
id
}
/banana_sample.gif"
expect
(
url
).
to
eq
"/uploads/project/avatar/
#{
@project
.
id
}
/banana_sample.gif"
end
end
step
'I should see the "Remove avatar" button'
do
step
'I should see the "Remove avatar" button'
do
...
...
features/steps/project/source/browse_files.rb
View file @
b5291f95
...
@@ -230,13 +230,13 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
...
@@ -230,13 +230,13 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end
end
step
'I am redirected to the new file'
do
step
'I am redirected to the new file'
do
expect
(
current_path
).
to
eq
(
namespace_project_blob_path
(
expect
(
current_path
).
to
eq
(
@project
.
namespace
,
@project
,
'master/'
+
new_file_name
))
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
'master/'
+
new_file_name
))
end
end
step
'I am redirected to the new file with directory'
do
step
'I am redirected to the new file with directory'
do
expect
(
current_path
).
to
eq
(
namespace_project_blob_path
(
expect
(
current_path
).
to
eq
(
@project
.
namespace
,
@project
,
'master/'
+
new_file_name_with_directory
))
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
'master/'
+
new_file_name_with_directory
))
end
end
step
'I am redirected to the new merge request page'
do
step
'I am redirected to the new merge request page'
do
...
@@ -244,8 +244,8 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
...
@@ -244,8 +244,8 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end
end
step
'I am redirected to the root directory'
do
step
'I am redirected to the root directory'
do
expect
(
current_path
).
to
eq
(
namespace_project_tree_path
(
expect
(
current_path
).
to
eq
(
@project
.
namespace
,
@project
,
'master/'
))
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
'master/'
))
end
end
step
"I don't see the permalink link"
do
step
"I don't see the permalink link"
do
...
...
features/steps/shared/paths.rb
View file @
b5291f95
...
@@ -212,8 +212,8 @@ module SharedPaths
...
@@ -212,8 +212,8 @@ module SharedPaths
end
end
step
'I visit a binary file in the repo'
do
step
'I visit a binary file in the repo'
do
visit
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
File
.
join
(
visit
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
root_ref
,
'files/images/logo-black.png'
))
File
.
join
(
root_ref
,
'files/images/logo-black.png'
))
end
end
step
"I visit my project's commits page"
do
step
"I visit my project's commits page"
do
...
@@ -316,8 +316,8 @@ module SharedPaths
...
@@ -316,8 +316,8 @@ module SharedPaths
end
end
step
'I am on the ".gitignore" edit file page'
do
step
'I am on the ".gitignore" edit file page'
do
expect
(
current_path
).
to
eq
(
namespace_project_edit_blob_path
(
expect
(
current_path
).
to
eq
(
@project
.
namespace
,
@project
,
File
.
join
(
root_ref
,
'.gitignore'
)))
namespace_project_edit_blob_path
(
@project
.
namespace
,
@project
,
File
.
join
(
root_ref
,
'.gitignore'
)))
end
end
step
'I visit project source page for "6d39438"'
do
step
'I visit project source page for "6d39438"'
do
...
...
lib/api/entities.rb
View file @
b5291f95
...
@@ -67,7 +67,7 @@ module API
...
@@ -67,7 +67,7 @@ module API
expose
:shared_runners_enabled
expose
:shared_runners_enabled
expose
:creator_id
expose
:creator_id
expose
:namespace
expose
:namespace
expose
:forked_from_project
,
using:
Entities
::
ForkedFromProject
,
if:
lambda
{
|
project
,
options
|
project
.
forked?
}
expose
:forked_from_project
,
using:
Entities
::
ForkedFromProject
,
if:
lambda
{
|
project
,
options
|
project
.
forked?
}
expose
:avatar_url
expose
:avatar_url
expose
:star_count
,
:forks_count
expose
:star_count
,
:forks_count
end
end
...
...
lib/gitlab/backend/shell.rb
View file @
b5291f95
...
@@ -2,7 +2,7 @@ module Gitlab
...
@@ -2,7 +2,7 @@ module Gitlab
class
Shell
class
Shell
class
Error
<
StandardError
;
end
class
Error
<
StandardError
;
end
class
KeyAdder
<
Struct
.
new
(
:io
)
KeyAdder
=
Struct
.
new
(
:io
)
do
def
add_key
(
id
,
key
)
def
add_key
(
id
,
key
)
key
.
gsub!
(
/[[:space:]]+/
,
' '
).
strip!
key
.
gsub!
(
/[[:space:]]+/
,
' '
).
strip!
io
.
puts
(
"
#{
id
}
\t
#{
key
}
"
)
io
.
puts
(
"
#{
id
}
\t
#{
key
}
"
)
...
...
lib/gitlab/bitbucket_import/project_creator.rb
View file @
b5291f95
...
@@ -11,7 +11,8 @@ module Gitlab
...
@@ -11,7 +11,8 @@ module Gitlab
end
end
def
execute
def
execute
project
=
::
Projects
::
CreateService
.
new
(
current_user
,
project
=
::
Projects
::
CreateService
.
new
(
current_user
,
name:
repo
[
"name"
],
name:
repo
[
"name"
],
path:
repo
[
"slug"
],
path:
repo
[
"slug"
],
description:
repo
[
"description"
],
description:
repo
[
"description"
],
...
...
lib/gitlab/diff/file.rb
View file @
b5291f95
...
@@ -46,11 +46,11 @@ module Gitlab
...
@@ -46,11 +46,11 @@ module Gitlab
end
end
def
added_lines
def
added_lines
diff_lines
.
select
(
&
:added?
).
size
diff_lines
.
count
(
&
:added?
)
end
end
def
removed_lines
def
removed_lines
diff_lines
.
select
(
&
:removed?
).
size
diff_lines
.
count
(
&
:removed?
)
end
end
end
end
end
end
...
...
lib/gitlab/fogbugz_import/importer.rb
View file @
b5291f95
...
@@ -199,7 +199,7 @@ module Gitlab
...
@@ -199,7 +199,7 @@ module Gitlab
s
=
s
.
gsub
(
/^#/
,
"
\\
#"
)
s
=
s
.
gsub
(
/^#/
,
"
\\
#"
)
s
=
s
.
gsub
(
/^-/
,
"
\\
-"
)
s
=
s
.
gsub
(
/^-/
,
"
\\
-"
)
s
=
s
.
gsub
(
"`"
,
"
\\
~"
)
s
=
s
.
gsub
(
"`"
,
"
\\
~"
)
s
=
s
.
gsub
(
"
\r
"
,
"
"
)
s
=
s
.
delete
(
"
\r
"
)
s
=
s
.
gsub
(
"
\n
"
,
"
\n
"
)
s
=
s
.
gsub
(
"
\n
"
,
"
\n
"
)
s
s
end
end
...
...
lib/gitlab/fogbugz_import/project_creator.rb
View file @
b5291f95
...
@@ -12,7 +12,8 @@ module Gitlab
...
@@ -12,7 +12,8 @@ module Gitlab
end
end
def
execute
def
execute
project
=
::
Projects
::
CreateService
.
new
(
current_user
,
project
=
::
Projects
::
CreateService
.
new
(
current_user
,
name:
repo
.
safe_name
,
name:
repo
.
safe_name
,
path:
repo
.
path
,
path:
repo
.
path
,
namespace:
namespace
,
namespace:
namespace
,
...
...
lib/gitlab/gitlab_import/project_creator.rb
View file @
b5291f95
...
@@ -11,7 +11,8 @@ module Gitlab
...
@@ -11,7 +11,8 @@ module Gitlab
end
end
def
execute
def
execute
project
=
::
Projects
::
CreateService
.
new
(
current_user
,
project
=
::
Projects
::
CreateService
.
new
(
current_user
,
name:
repo
[
"name"
],
name:
repo
[
"name"
],
path:
repo
[
"path"
],
path:
repo
[
"path"
],
description:
repo
[
"description"
],
description:
repo
[
"description"
],
...
...
lib/gitlab/gitorious_import/project_creator.rb
View file @
b5291f95
...
@@ -10,7 +10,8 @@ module Gitlab
...
@@ -10,7 +10,8 @@ module Gitlab
end
end
def
execute
def
execute
::
Projects
::
CreateService
.
new
(
current_user
,
::
Projects
::
CreateService
.
new
(
current_user
,
name:
repo
.
name
,
name:
repo
.
name
,
path:
repo
.
path
,
path:
repo
.
path
,
description:
repo
.
description
,
description:
repo
.
description
,
...
...
lib/gitlab/google_code_import/importer.rb
View file @
b5291f95
...
@@ -171,8 +171,6 @@ module Gitlab
...
@@ -171,8 +171,6 @@ module Gitlab
when
/\AMilestone:/
when
/\AMilestone:/
"#fee3ff"
"#fee3ff"
when
*
@closed_statuses
.
map
{
|
s
|
nice_status_name
(
s
)
}
"#cfcfcf"
when
"Status: New"
when
"Status: New"
"#428bca"
"#428bca"
when
"Status: Accepted"
when
"Status: Accepted"
...
@@ -199,6 +197,8 @@ module Gitlab
...
@@ -199,6 +197,8 @@ module Gitlab
"#8e44ad"
"#8e44ad"
when
"Type: Other"
when
"Type: Other"
"#7f8c8d"
"#7f8c8d"
when
*
@closed_statuses
.
map
{
|
s
|
nice_status_name
(
s
)
}
"#cfcfcf"
else
else
"#e2e2e2"
"#e2e2e2"
end
end
...
@@ -227,7 +227,7 @@ module Gitlab
...
@@ -227,7 +227,7 @@ module Gitlab
s
=
s
.
gsub
(
"`"
,
"
\\
`"
)
s
=
s
.
gsub
(
"`"
,
"
\\
`"
)
# Carriage returns make me sad
# Carriage returns make me sad
s
=
s
.
gsub
(
"
\r
"
,
"
"
)
s
=
s
.
delete
(
"
\r
"
)
# Markdown ignores single newlines, but we need them as <br />.
# Markdown ignores single newlines, but we need them as <br />.
s
=
s
.
gsub
(
"
\n
"
,
"
\n
"
)
s
=
s
.
gsub
(
"
\n
"
,
"
\n
"
)
...
...
lib/gitlab/google_code_import/project_creator.rb
View file @
b5291f95
...
@@ -11,7 +11,8 @@ module Gitlab
...
@@ -11,7 +11,8 @@ module Gitlab
end
end
def
execute
def
execute
project
=
::
Projects
::
CreateService
.
new
(
current_user
,
project
=
::
Projects
::
CreateService
.
new
(
current_user
,
name:
repo
.
name
,
name:
repo
.
name
,
path:
repo
.
name
,
path:
repo
.
name
,
description:
repo
.
summary
,
description:
repo
.
summary
,
...
...
lib/gitlab/markdown/filter/markdown_filter.rb
View file @
b5291f95
...
@@ -3,7 +3,7 @@ module Gitlab
...
@@ -3,7 +3,7 @@ module Gitlab
class
MarkdownFilter
<
HTML
::
Pipeline
::
TextFilter
class
MarkdownFilter
<
HTML
::
Pipeline
::
TextFilter
def
initialize
(
text
,
context
=
nil
,
result
=
nil
)
def
initialize
(
text
,
context
=
nil
,
result
=
nil
)
super
text
,
context
,
result
super
text
,
context
,
result
@text
=
@text
.
gsub
"
\r
"
,
''
@text
=
@text
.
delete
"
\r
"
end
end
def
call
def
call
...
...
lib/gitlab/markdown/filter/table_of_contents_filter.rb
View file @
b5291f95
...
@@ -31,7 +31,7 @@ module Gitlab
...
@@ -31,7 +31,7 @@ module Gitlab
id
=
text
.
downcase
id
=
text
.
downcase
id
.
gsub!
(
PUNCTUATION_REGEXP
,
''
)
# remove punctuation
id
.
gsub!
(
PUNCTUATION_REGEXP
,
''
)
# remove punctuation
id
.
gsub
!
(
' '
,
'-'
)
# replace spaces with dash
id
.
tr
!
(
' '
,
'-'
)
# replace spaces with dash
id
.
squeeze!
(
'-'
)
# replace multiple dashes with one
id
.
squeeze!
(
'-'
)
# replace multiple dashes with one
uniq
=
(
headers
[
id
]
>
0
)
?
"-
#{
headers
[
id
]
}
"
:
''
uniq
=
(
headers
[
id
]
>
0
)
?
"-
#{
headers
[
id
]
}
"
:
''
...
...
lib/rouge/formatters/html_gitlab.rb
View file @
b5291f95
spec/factories.rb
View file @
b5291f95
...
@@ -43,7 +43,8 @@ FactoryGirl.define do
...
@@ -43,7 +43,8 @@ FactoryGirl.define do
end
end
after
(
:create
)
do
|
user
,
evaluator
|
after
(
:create
)
do
|
user
,
evaluator
|
user
.
identities
<<
create
(
:identity
,
user
.
identities
<<
create
(
:identity
,
provider:
evaluator
.
provider
,
provider:
evaluator
.
provider
,
extern_uid:
evaluator
.
extern_uid
extern_uid:
evaluator
.
extern_uid
)
)
...
...
spec/features/security/group_access_spec.rb
View file @
b5291f95
...
@@ -16,11 +16,11 @@ describe 'Group access', feature: true do
...
@@ -16,11 +16,11 @@ describe 'Group access', feature: true do
end
end
end
end
def
group_member
(
access_level
,
gr
oup
=
group
)
def
group_member
(
access_level
,
gr
p
=
group
()
)
level
=
Object
.
const_get
(
"Gitlab::Access::
#{
access_level
.
upcase
}
"
)
level
=
Object
.
const_get
(
"Gitlab::Access::
#{
access_level
.
upcase
}
"
)
create
(
:user
).
tap
do
|
user
|
create
(
:user
).
tap
do
|
user
|
gr
ou
p
.
add_user
(
user
,
level
)
grp
.
add_user
(
user
,
level
)
end
end
end
end
...
...
spec/helpers/groups_helper.rb
View file @
b5291f95
...
@@ -9,7 +9,7 @@ describe GroupsHelper do
...
@@ -9,7 +9,7 @@ describe GroupsHelper do
group
.
avatar
=
File
.
open
(
avatar_file_path
)
group
.
avatar
=
File
.
open
(
avatar_file_path
)
group
.
save!
group
.
save!
expect
(
group_icon
(
group
.
path
).
to_s
).
expect
(
group_icon
(
group
.
path
).
to_s
).
to
match
(
"/uploads/group/avatar/
#{
group
.
id
}
/banana_sample.gif"
)
to
match
(
"/uploads/group/avatar/
#{
group
.
id
}
/banana_sample.gif"
)
end
end
it
'should give default avatar_icon when no avatar is present'
do
it
'should give default avatar_icon when no avatar is present'
do
...
...
spec/models/ci/commit_spec.rb
View file @
b5291f95
...
@@ -37,14 +37,14 @@ describe Ci::Commit, models: true do
...
@@ -37,14 +37,14 @@ describe Ci::Commit, models: true do
it
'returns ordered list of commits'
do
it
'returns ordered list of commits'
do
commit1
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
1
.
hour
.
ago
,
project:
project
commit1
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
1
.
hour
.
ago
,
project:
project
commit2
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
2
.
hour
.
ago
,
project:
project
commit2
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
2
.
hour
s
.
ago
,
project:
project
expect
(
project
.
ci_commits
.
ordered
).
to
eq
([
commit2
,
commit1
])
expect
(
project
.
ci_commits
.
ordered
).
to
eq
([
commit2
,
commit1
])
end
end
it
'returns commits ordered by committed_at and id, with nulls last'
do
it
'returns commits ordered by committed_at and id, with nulls last'
do
commit1
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
1
.
hour
.
ago
,
project:
project
commit1
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
1
.
hour
.
ago
,
project:
project
commit2
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
nil
,
project:
project
commit2
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
nil
,
project:
project
commit3
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
2
.
hour
.
ago
,
project:
project
commit3
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
2
.
hour
s
.
ago
,
project:
project
commit4
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
nil
,
project:
project
commit4
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
nil
,
project:
project
expect
(
project
.
ci_commits
.
ordered
).
to
eq
([
commit2
,
commit4
,
commit3
,
commit1
])
expect
(
project
.
ci_commits
.
ordered
).
to
eq
([
commit2
,
commit4
,
commit3
,
commit1
])
end
end
...
...
spec/models/key_spec.rb
View file @
b5291f95
...
@@ -81,7 +81,7 @@ describe Key, models: true do
...
@@ -81,7 +81,7 @@ describe Key, models: true do
it
'rejects the multiple line key'
do
it
'rejects the multiple line key'
do
key
=
build
(
:key
)
key
=
build
(
:key
)
key
.
key
.
gsub
!
(
' '
,
"
\n
"
)
key
.
key
.
tr
!
(
' '
,
"
\n
"
)
expect
(
key
).
not_to
be_valid
expect
(
key
).
not_to
be_valid
end
end
end
end
...
...
spec/models/project_services/hipchat_service_spec.rb
View file @
b5291f95
...
@@ -57,23 +57,21 @@ describe HipchatService, models: true do
...
@@ -57,23 +57,21 @@ describe HipchatService, models: true do
it
'should use v1 if version is provided'
do
it
'should use v1 if version is provided'
do
allow
(
hipchat
).
to
receive
(
:api_version
).
and_return
(
'v1'
)
allow
(
hipchat
).
to
receive
(
:api_version
).
and_return
(
'v1'
)
expect
(
HipChat
::
Client
).
to
receive
(
:new
).
expect
(
HipChat
::
Client
).
to
receive
(
:new
).
with
(
with
(
token
,
token
,
api_version:
'v1'
,
api_version:
'v1'
,
server_url:
server_url
).
server_url:
server_url
and_return
(
).
and_return
(
double
(
:hipchat_service
).
as_null_object
)
double
(
:hipchat_service
).
as_null_object
)
hipchat
.
execute
(
push_sample_data
)
hipchat
.
execute
(
push_sample_data
)
end
end
it
'should use v2 as the version when nothing is provided'
do
it
'should use v2 as the version when nothing is provided'
do
allow
(
hipchat
).
to
receive
(
:api_version
).
and_return
(
''
)
allow
(
hipchat
).
to
receive
(
:api_version
).
and_return
(
''
)
expect
(
HipChat
::
Client
).
to
receive
(
:new
).
expect
(
HipChat
::
Client
).
to
receive
(
:new
).
with
(
with
(
token
,
token
,
api_version:
'v2'
,
api_version:
'v2'
,
server_url:
server_url
).
server_url:
server_url
and_return
(
).
and_return
(
double
(
:hipchat_service
).
as_null_object
)
double
(
:hipchat_service
).
as_null_object
)
hipchat
.
execute
(
push_sample_data
)
hipchat
.
execute
(
push_sample_data
)
end
end
...
...
spec/models/project_services/slack_service/note_message_spec.rb
View file @
b5291f95
spec/models/user_spec.rb
View file @
b5291f95
...
@@ -462,8 +462,8 @@ describe User, models: true do
...
@@ -462,8 +462,8 @@ describe User, models: true do
expect
(
User
.
search
(
user1
.
username
.
downcase
).
to_a
).
to
eq
([
user1
])
expect
(
User
.
search
(
user1
.
username
.
downcase
).
to_a
).
to
eq
([
user1
])
expect
(
User
.
search
(
user2
.
username
.
upcase
).
to_a
).
to
eq
([
user2
])
expect
(
User
.
search
(
user2
.
username
.
upcase
).
to_a
).
to
eq
([
user2
])
expect
(
User
.
search
(
user2
.
username
.
downcase
).
to_a
).
to
eq
([
user2
])
expect
(
User
.
search
(
user2
.
username
.
downcase
).
to_a
).
to
eq
([
user2
])
expect
(
User
.
search
(
user1
.
username
.
downcase
).
to_a
.
count
).
to
eq
(
2
)
expect
(
User
.
search
(
user1
.
username
.
downcase
).
to_a
.
size
).
to
eq
(
2
)
expect
(
User
.
search
(
user2
.
username
.
downcase
).
to_a
.
count
).
to
eq
(
1
)
expect
(
User
.
search
(
user2
.
username
.
downcase
).
to_a
.
size
).
to
eq
(
1
)
end
end
end
end
...
...
spec/requests/api/merge_requests_spec.rb
View file @
b5291f95
...
@@ -6,7 +6,7 @@ describe API::API, api: true do
...
@@ -6,7 +6,7 @@ describe API::API, api: true do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
:simple
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Test"
,
created_at:
base_time
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
:simple
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Test"
,
created_at:
base_time
)
}
let!
(
:merge_request_closed
)
{
create
(
:merge_request
,
state:
"closed"
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Closed test"
,
created_at:
base_time
+
1
.
second
s
)
}
let!
(
:merge_request_closed
)
{
create
(
:merge_request
,
state:
"closed"
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Closed test"
,
created_at:
base_time
+
1
.
second
)
}
let!
(
:merge_request_merged
)
{
create
(
:merge_request
,
state:
"merged"
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Merged test"
,
created_at:
base_time
+
2
.
seconds
)
}
let!
(
:merge_request_merged
)
{
create
(
:merge_request
,
state:
"merged"
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Merged test"
,
created_at:
base_time
+
2
.
seconds
)
}
let!
(
:note
)
{
create
(
:note_on_merge_request
,
author:
user
,
project:
project
,
noteable:
merge_request
,
note:
"a comment on a MR"
)
}
let!
(
:note
)
{
create
(
:note_on_merge_request
,
author:
user
,
project:
project
,
noteable:
merge_request
,
note:
"a comment on a MR"
)
}
let!
(
:note2
)
{
create
(
:note_on_merge_request
,
author:
user
,
project:
project
,
noteable:
merge_request
,
note:
"another comment on a MR"
)
}
let!
(
:note2
)
{
create
(
:note_on_merge_request
,
author:
user
,
project:
project
,
noteable:
merge_request
,
note:
"another comment on a MR"
)
}
...
...
spec/requests/api/services_spec.rb
View file @
b5291f95
...
@@ -29,7 +29,7 @@ describe API::API, api: true do
...
@@ -29,7 +29,7 @@ describe API::API, api: true do
if
required_attributes
.
empty?
if
required_attributes
.
empty?
expected_code
=
200
expected_code
=
200
else
else
attrs
.
delete
(
required_attributes
.
s
huffle
.
first
)
attrs
.
delete
(
required_attributes
.
s
ample
)
expected_code
=
400
expected_code
=
400
end
end
...
...
spec/services/create_commit_builds_service_spec.rb
View file @
b5291f95
spec/services/git_tag_push_service_spec.rb
View file @
b5291f95
spec/services/update_snippet_service_spec.rb
View file @
b5291f95
...
@@ -42,7 +42,7 @@ describe UpdateSnippetService, services: true do
...
@@ -42,7 +42,7 @@ describe UpdateSnippetService, services: true do
CreateSnippetService
.
new
(
project
,
user
,
opts
).
execute
CreateSnippetService
.
new
(
project
,
user
,
opts
).
execute
end
end
def
update_snippet
(
project
=
nil
,
user
,
snippet
,
opts
)
def
update_snippet
(
project
,
user
,
snippet
,
opts
)
UpdateSnippetService
.
new
(
project
,
user
,
snippet
,
opts
).
execute
UpdateSnippetService
.
new
(
project
,
user
,
snippet
,
opts
).
execute
end
end
end
end
spec/support/repo_helpers.rb
View file @
b5291f95
spec/workers/repository_fork_worker_spec.rb
View file @
b5291f95
...
@@ -10,17 +10,19 @@ describe RepositoryForkWorker do
...
@@ -10,17 +10,19 @@ describe RepositoryForkWorker do
it
"creates a new repository from a fork"
do
it
"creates a new repository from a fork"
do
expect_any_instance_of
(
Gitlab
::
Shell
).
to
receive
(
:fork_repository
).
with
(
expect_any_instance_of
(
Gitlab
::
Shell
).
to
receive
(
:fork_repository
).
with
(
project
.
path_with_namespace
,
project
.
path_with_namespace
,
fork_project
.
namespace
.
path
).
fork_project
.
namespace
.
path
and_return
(
true
)
).
and_return
(
true
)
subject
.
perform
(
project
.
id
,
subject
.
perform
(
project
.
id
,
project
.
path_with_namespace
,
project
.
path_with_namespace
,
fork_project
.
namespace
.
path
)
fork_project
.
namespace
.
path
)
end
end
it
"handles bad fork"
do
it
"handles bad fork"
do
expect_any_instance_of
(
Gitlab
::
Shell
).
to
receive
(
:fork_repository
).
and_return
(
false
)
expect_any_instance_of
(
Gitlab
::
Shell
).
to
receive
(
:fork_repository
).
and_return
(
false
)
subject
.
perform
(
project
.
id
,
subject
.
perform
(
project
.
id
,
project
.
path_with_namespace
,
project
.
path_with_namespace
,
fork_project
.
namespace
.
path
)
fork_project
.
namespace
.
path
)
end
end
...
...
spec/workers/stuck_ci_builds_worker_spec.rb
View file @
b5291f95
...
@@ -15,7 +15,7 @@ describe StuckCiBuildsWorker do
...
@@ -15,7 +15,7 @@ describe StuckCiBuildsWorker do
end
end
it
'gets dropped if it was updated over 2 days ago'
do
it
'gets dropped if it was updated over 2 days ago'
do
build
.
update!
(
updated_at:
2
.
day
.
ago
)
build
.
update!
(
updated_at:
2
.
day
s
.
ago
)
StuckCiBuildsWorker
.
new
.
perform
StuckCiBuildsWorker
.
new
.
perform
is_expected
.
to
eq
(
'failed'
)
is_expected
.
to
eq
(
'failed'
)
end
end
...
@@ -35,7 +35,7 @@ describe StuckCiBuildsWorker do
...
@@ -35,7 +35,7 @@ describe StuckCiBuildsWorker do
end
end
it
"is still
#{
status
}
"
do
it
"is still
#{
status
}
"
do
build
.
update!
(
updated_at:
2
.
day
.
ago
)
build
.
update!
(
updated_at:
2
.
day
s
.
ago
)
StuckCiBuildsWorker
.
new
.
perform
StuckCiBuildsWorker
.
new
.
perform
is_expected
.
to
eq
(
status
)
is_expected
.
to
eq
(
status
)
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