Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
30e622943a34
Commit
30e62294
authored
Dec 14, 2013
by
skv
Browse files
fix most of warnings
parent
b76269dd849a
Changes
28
Hide whitespace changes
Inline
Side-by-side
app/controllers/admin/projects_controller.rb
View file @
30e62294
...
...
@@ -7,7 +7,7 @@
owner_id
=
params
[
:owner_id
]
user
=
User
.
find_by_id
(
owner_id
)
@projects
=
user
?
user
.
owned_projects
:
Project
.
scoped
@projects
=
user
?
user
.
owned_projects
:
Project
.
all
@projects
=
@projects
.
where
(
"visibility_level IN (?)"
,
params
[
:visibility_levels
])
if
params
[
:visibility_levels
].
present?
@projects
=
@projects
.
with_push
if
params
[
:with_push
].
present?
@projects
=
@projects
.
abandoned
if
params
[
:abandoned
].
present?
...
...
app/controllers/admin/users_controller.rb
View file @
30e62294
...
...
@@ -2,8 +2,7 @@
before_filter
:user
,
only:
[
:show
,
:edit
,
:update
,
:destroy
]
def
index
@users
=
User
.
scoped
@users
=
@users
.
filter
(
params
[
:filter
])
@users
=
User
.
filter
(
params
[
:filter
])
@users
=
@users
.
search
(
params
[
:name
])
if
params
[
:name
].
present?
@users
=
@users
.
alphabetically
.
page
(
params
[
:page
])
end
...
...
app/controllers/profiles/keys_controller.rb
View file @
30e62294
...
...
@@ -2,7 +2,7 @@
layout
"profile"
def
index
@keys
=
current_user
.
keys
.
order
(
'id DESC'
)
.
all
@keys
=
current_user
.
keys
.
order
(
'id DESC'
)
end
def
show
...
...
app/controllers/projects/deploy_keys_controller.rb
View file @
30e62294
...
...
@@ -7,7 +7,7 @@
layout
"project_settings"
def
index
@enabled_keys
=
@project
.
deploy_keys
.
all
@enabled_keys
=
@project
.
deploy_keys
@available_keys
=
available_keys
-
@enabled_keys
end
...
...
app/controllers/projects/hooks_controller.rb
View file @
30e62294
...
...
@@ -7,7 +7,7 @@
layout
"project_settings"
def
index
@hooks
=
@project
.
hooks
.
all
@hooks
=
@project
.
hooks
@hook
=
ProjectHook
.
new
end
...
...
@@ -18,7 +18,7 @@
if
@hook
.
valid?
redirect_to
project_hooks_path
(
@project
)
else
@hooks
=
@project
.
hooks
.
all
@hooks
=
@project
.
hooks
render
:index
end
end
...
...
app/models/project.rb
View file @
30e62294
...
...
@@ -322,5 +322,5 @@
c_ids
=
self
.
repository
.
commits_between
(
oldrev
,
newrev
).
map
(
&
:id
)
# Update code for merge requests into project between project branches
mrs
=
self
.
merge_requests
.
opened
.
by_branch
(
branch_name
).
all
mrs
=
self
.
merge_requests
.
opened
.
by_branch
(
branch_name
).
to_a
# Update code for merge requests between project and project fork
...
...
@@ -326,6 +326,6 @@
# Update code for merge requests between project and project fork
mrs
+=
self
.
fork_merge_requests
.
opened
.
by_branch
(
branch_name
).
all
mrs
+=
self
.
fork_merge_requests
.
opened
.
by_branch
(
branch_name
).
to_a
mrs
.
each
{
|
merge_request
|
merge_request
.
reload_code
;
merge_request
.
mark_as_unchecked
}
# Close merge requests
...
...
@@ -328,8 +328,8 @@
mrs
.
each
{
|
merge_request
|
merge_request
.
reload_code
;
merge_request
.
mark_as_unchecked
}
# Close merge requests
mrs
=
self
.
merge_requests
.
opened
.
where
(
target_branch:
branch_name
).
all
mrs
=
self
.
merge_requests
.
opened
.
where
(
target_branch:
branch_name
).
to_a
mrs
=
mrs
.
select
(
&
:last_commit
).
select
{
|
mr
|
c_ids
.
include?
(
mr
.
last_commit
.
id
)
}
mrs
.
each
{
|
merge_request
|
merge_request
.
merge!
(
user
.
id
)
}
...
...
app/models/project_team.rb
View file @
30e62294
...
...
@@ -87,8 +87,8 @@
def
import
(
source_project
)
target_project
=
project
source_team
=
source_project
.
users_projects
.
all
target_team
=
target_project
.
users_projects
.
all
source_team
=
source_project
.
users_projects
.
to_a
target_team
=
target_project
.
users_projects
.
to_a
target_user_ids
=
target_team
.
map
(
&
:user_id
)
source_team
.
reject!
do
|
tm
|
...
...
app/models/user.rb
View file @
30e62294
...
...
@@ -163,7 +163,7 @@
scope
:alphabetically
,
->
{
order
(
'name ASC'
)
}
scope
:in_team
,
->
(
team
){
where
(
id:
team
.
member_ids
)
}
scope
:not_in_team
,
->
(
team
){
where
(
'users.id NOT IN (:ids)'
,
ids:
team
.
member_ids
)
}
scope
:not_in_project
,
->
(
project
)
{
project
.
users
.
present?
?
where
(
"id not in (:ids)"
,
ids:
project
.
users
.
map
(
&
:id
)
)
:
scoped
}
scope
:not_in_project
,
->
(
project
)
{
project
.
users
.
present?
?
where
(
"id not in (:ids)"
,
ids:
project
.
users
.
map
(
&
:id
)
)
:
all
}
scope
:without_projects
,
->
{
where
(
'id NOT IN (SELECT DISTINCT(user_id) FROM users_projects)'
)
}
scope
:ldap
,
->
{
where
(
provider:
'ldap'
)
}
...
...
app/views/projects/issues/_form.html.haml
View file @
30e62294
...
...
@@ -29,7 +29,7 @@
=
f
.
label
:milestone_id
do
%i
.icon-time
Milestone
.controls
=
f
.
select
(
:milestone_id
,
@project
.
milestones
.
active
.
all
.
collect
{
|
p
|
[
p
.
title
,
p
.
id
]
},
{
include_blank:
"Select milestone"
},
{
class:
'chosen'
})
.controls
=
f
.
select
(
:milestone_id
,
@project
.
milestones
.
active
.
collect
{
|
p
|
[
p
.
title
,
p
.
id
]
},
{
include_blank:
"Select milestone"
},
{
class:
'chosen'
})
.ui-box-bottom
.control-group
...
...
app/views/projects/merge_requests/_form.html.haml
View file @
30e62294
...
...
@@ -44,7 +44,7 @@
=
f
.
label
:milestone_id
do
%i
.icon-time
Milestone
.controls
=
f
.
select
(
:milestone_id
,
@project
.
milestones
.
active
.
all
.
map
{
|
p
|
[
p
.
title
,
p
.
id
]
},
{
include_blank:
"Select milestone"
},
{
class:
'chosen'
})
.controls
=
f
.
select
(
:milestone_id
,
@project
.
milestones
.
active
.
map
{
|
p
|
[
p
.
title
,
p
.
id
]
},
{
include_blank:
"Select milestone"
},
{
class:
'chosen'
})
.control-group
=
f
.
label
:description
,
"Description"
.controls
...
...
lib/api/namespaces.rb
View file @
30e62294
...
...
@@ -12,7 +12,7 @@
# Example Request:
# GET /namespaces
get
do
@namespaces
=
Namespace
.
scoped
@namespaces
=
Namespace
.
all
@namespaces
=
@namespaces
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
@namespaces
=
paginate
@namespaces
...
...
lib/api/users.rb
View file @
30e62294
...
...
@@ -9,7 +9,7 @@
# Example Request:
# GET /users
get
do
@users
=
User
.
scoped
@users
=
User
.
all
@users
=
@users
.
active
if
params
[
:active
].
present?
@users
=
@users
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
@users
=
paginate
@users
...
...
spec/contexts/fork_context_spec.rb
View file @
30e62294
...
...
@@ -48,7 +48,7 @@
def
fork_project
(
from_project
,
user
,
fork_success
=
true
)
context
=
Projects
::
ForkContext
.
new
(
from_project
,
user
)
shell
=
mock
(
"gitlab_shell"
)
shell
=
double
(
"gitlab_shell"
)
shell
.
stub
(
fork_repository:
fork_success
)
context
.
stub
(
gitlab_shell:
shell
)
context
.
execute
...
...
spec/controllers/application_controller_spec.rb
View file @
30e62294
...
...
@@ -8,7 +8,7 @@
it
'should redirect if the user is over their password expiry'
do
user
.
password_expires_at
=
Time
.
new
(
2002
)
user
.
ldap_user?
.
should
be_false
controller
.
stub
!
(
:current_user
).
and_return
(
user
)
controller
.
stub
(
:current_user
).
and_return
(
user
)
controller
.
should_receive
(
:redirect_to
)
controller
.
should_receive
(
:new_profile_password_path
)
controller
.
send
(
:check_password_expiration
)
...
...
@@ -17,10 +17,10 @@
it
'should not redirect if the user is under their password expiry'
do
user
.
password_expires_at
=
Time
.
now
+
20010101
user
.
ldap_user?
.
should
be_false
controller
.
stub
!
(
:current_user
).
and_return
(
user
)
controller
.
stub
(
:current_user
).
and_return
(
user
)
controller
.
should_not_receive
(
:redirect_to
)
controller
.
send
(
:check_password_expiration
)
end
it
'should not redirect if the user is over their password expiry but they are an ldap user'
do
user
.
password_expires_at
=
Time
.
new
(
2002
)
...
...
@@ -21,11 +21,11 @@
controller
.
should_not_receive
(
:redirect_to
)
controller
.
send
(
:check_password_expiration
)
end
it
'should not redirect if the user is over their password expiry but they are an ldap user'
do
user
.
password_expires_at
=
Time
.
new
(
2002
)
user
.
stub
!
(
:ldap_user?
).
and_return
(
true
)
controller
.
stub
!
(
:current_user
).
and_return
(
user
)
user
.
stub
(
:ldap_user?
).
and_return
(
true
)
controller
.
stub
(
:current_user
).
and_return
(
user
)
controller
.
should_not_receive
(
:redirect_to
)
controller
.
send
(
:check_password_expiration
)
end
...
...
spec/helpers/application_helper_spec.rb
View file @
30e62294
...
...
@@ -3,7 +3,7 @@
describe
ApplicationHelper
do
describe
'current_controller?'
do
before
do
controller
.
stub
!
(
:controller_name
).
and_return
(
'foo'
)
controller
.
stub
(
:controller_name
).
and_return
(
'foo'
)
end
it
"returns true when controller matches argument"
do
...
...
@@ -22,7 +22,7 @@
describe
'current_action?'
do
before
do
stub!
(
:action_name
).
and_return
(
'foo'
)
allow
(
self
).
to
receive
(
:action_name
).
and_return
(
'foo'
)
end
it
"returns true when action matches argument"
do
...
...
@@ -52,7 +52,7 @@
it
"should call gravatar_icon when no avatar is present"
do
user
=
create
(
:user
)
user
.
save!
stub!
(
:gravatar_icon
).
and_return
(
'gravatar_method_called'
)
allow
(
self
).
to
receive
(
:gravatar_icon
).
and_return
(
'gravatar_method_called'
)
avatar_icon
(
user
.
email
).
to_s
.
should
==
"gravatar_method_called"
end
end
...
...
@@ -70,8 +70,8 @@
end
it
"should return default gravatar url"
do
stub!
(
:request
).
and_return
(
double
(
:ssl?
=>
false
))
allow
(
self
).
to
receive
(
:request
).
and_return
(
double
(
:ssl?
=>
false
))
gravatar_icon
(
user_email
).
should
match
(
'http://www.gravatar.com/avatar/b58c6f14d292556214bd64909bcdb118'
)
end
it
"should use SSL when appropriate"
do
...
...
@@ -74,9 +74,9 @@
gravatar_icon
(
user_email
).
should
match
(
'http://www.gravatar.com/avatar/b58c6f14d292556214bd64909bcdb118'
)
end
it
"should use SSL when appropriate"
do
stub!
(
:request
).
and_return
(
double
(
:ssl?
=>
true
))
allow
(
self
).
to
receive
(
:request
).
and_return
(
double
(
:ssl?
=>
true
))
gravatar_icon
(
user_email
).
should
match
(
'https://secure.gravatar.com'
)
end
it
"should return custom gravatar path when gravatar_url is set"
do
...
...
@@ -79,10 +79,10 @@
gravatar_icon
(
user_email
).
should
match
(
'https://secure.gravatar.com'
)
end
it
"should return custom gravatar path when gravatar_url is set"
do
stub!
(
:request
).
and_return
(
double
(
:ssl?
=>
false
))
allow
(
self
).
to
receive
(
:request
).
and_return
(
double
(
:ssl?
=>
false
))
Gitlab
.
config
.
gravatar
.
stub
(
:plain_url
).
and_return
(
'http://example.local/?s=%{size}&hash=%{hash}'
)
gravatar_icon
(
user_email
,
20
).
should
==
'http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118'
end
it
"should accept a custom size"
do
...
...
@@ -84,10 +84,10 @@
Gitlab
.
config
.
gravatar
.
stub
(
:plain_url
).
and_return
(
'http://example.local/?s=%{size}&hash=%{hash}'
)
gravatar_icon
(
user_email
,
20
).
should
==
'http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118'
end
it
"should accept a custom size"
do
stub!
(
:request
).
and_return
(
double
(
:ssl?
=>
false
))
allow
(
self
).
to
receive
(
:request
).
and_return
(
double
(
:ssl?
=>
false
))
gravatar_icon
(
user_email
,
64
).
should
match
(
/\?s=64/
)
end
it
"should use default size when size is wrong"
do
...
...
@@ -90,9 +90,9 @@
gravatar_icon
(
user_email
,
64
).
should
match
(
/\?s=64/
)
end
it
"should use default size when size is wrong"
do
stub!
(
:request
).
and_return
(
double
(
:ssl?
=>
false
))
allow
(
self
).
to
receive
(
:request
).
and_return
(
double
(
:ssl?
=>
false
))
gravatar_icon
(
user_email
,
nil
).
should
match
(
/\?s=40/
)
end
it
"should be case insensitive"
do
...
...
@@ -95,8 +95,8 @@
gravatar_icon
(
user_email
,
nil
).
should
match
(
/\?s=40/
)
end
it
"should be case insensitive"
do
stub!
(
:request
).
and_return
(
double
(
:ssl?
=>
false
))
allow
(
self
).
to
receive
(
:request
).
and_return
(
double
(
:ssl?
=>
false
))
gravatar_icon
(
user_email
).
should
==
gravatar_icon
(
user_email
.
upcase
+
" "
)
end
...
...
@@ -105,7 +105,7 @@
describe
"user_color_scheme_class"
do
context
"with current_user is nil"
do
it
"should return a string"
do
stub!
(
:current_user
).
and_return
(
nil
)
allow
(
self
).
to
receive
(
:current_user
).
and_return
(
nil
)
user_color_scheme_class
.
should
be_kind_of
(
String
)
end
end
...
...
@@ -115,7 +115,7 @@
context
"with color_scheme_id ==
#{
color_scheme_id
}
"
do
it
"should return a string"
do
current_user
=
double
(
:color_scheme_id
=>
color_scheme_id
)
stub!
(
:current_user
).
and_return
(
current_user
)
allow
(
self
).
to
receive
(
:current_user
).
and_return
(
current_user
)
user_color_scheme_class
.
should
be_kind_of
(
String
)
end
end
...
...
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
30e62294
...
...
@@ -435,7 +435,7 @@
describe
"#render_wiki_content"
do
before
do
@wiki
=
stub
(
'WikiPage'
)
@wiki
=
double
(
'WikiPage'
)
@wiki
.
stub
(
:content
).
and_return
(
'wiki content'
)
end
...
...
@@ -449,7 +449,7 @@
it
"should use the Gollum renderer for all other file types"
do
@wiki
.
stub
(
:format
).
and_return
(
:rdoc
)
formatted_content_stub
=
stub
(
'formatted_content'
)
formatted_content_stub
=
double
(
'formatted_content'
)
formatted_content_stub
.
should_receive
(
:html_safe
)
@wiki
.
stub
(
:formatted_content
).
and_return
(
formatted_content_stub
)
...
...
spec/helpers/notifications_helper_spec.rb
View file @
30e62294
...
...
@@ -2,7 +2,7 @@
describe
NotificationsHelper
do
describe
'notification_icon'
do
let
(
:notification
)
{
stub
(
disabled?:
false
,
participating?:
false
,
watch?:
false
)
}
let
(
:notification
)
{
double
(
disabled?:
false
,
participating?:
false
,
watch?:
false
)
}
context
"disabled notification"
do
before
{
notification
.
stub
(
disabled?:
true
)
}
...
...
spec/helpers/search_helper_spec.rb
View file @
30e62294
...
...
@@ -8,7 +8,9 @@
describe
'search_autocomplete_source'
do
context
"with no current user"
do
before
{
stub!
(
:current_user
).
and_return
(
nil
)
}
before
do
allow
(
self
).
to
receive
(
:current_user
).
and_return
(
nil
)
end
it
"it returns nil"
do
search_autocomplete_source
.
should
be_nil
...
...
@@ -20,7 +22,7 @@
let
(
:result
)
{
JSON
.
parse
(
search_autocomplete_source
)
}
before
do
stub!
(
:current_user
).
and_return
(
user
)
allow
(
self
).
to
receive
(
:current_user
).
and_return
(
user
)
end
it
"includes Help sections"
do
...
...
spec/helpers/tab_helper_spec.rb
View file @
30e62294
...
...
@@ -5,8 +5,8 @@
describe
'nav_link'
do
before
do
controller
.
stub
!
(
:controller_name
).
and_return
(
'foo'
)
stub!
(
:action_name
).
and_return
(
'foo'
)
controller
.
stub
(
:controller_name
).
and_return
(
'foo'
)
allow
(
self
).
to
receive
(
:action_name
).
and_return
(
'foo'
)
end
it
"captures block output"
do
...
...
spec/lib/extracts_path_spec.rb
View file @
30e62294
...
...
@@ -7,7 +7,7 @@
before
do
@project
=
project
project
.
stub
(
repository:
stub
(
ref_names:
[
'master'
,
'foo/bar/baz'
,
'v1.0.0'
,
'v2.0.0'
]))
project
.
stub
(
repository:
double
(
ref_names:
[
'master'
,
'foo/bar/baz'
,
'v1.0.0'
,
'v2.0.0'
]))
project
.
stub
(
path_with_namespace:
'gitlab/gitlab-ci'
)
end
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
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