Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4b464eaa
Commit
4b464eaa
authored
May 03, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix avatar-related failures
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
a0f8bcc2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
40 deletions
+33
-40
spec/factories/groups.rb
spec/factories/groups.rb
+4
-0
spec/factories/users.rb
spec/factories/users.rb
+4
-0
spec/models/group_spec.rb
spec/models/group_spec.rb
+3
-6
spec/models/project_spec.rb
spec/models/project_spec.rb
+20
-25
spec/models/user_spec.rb
spec/models/user_spec.rb
+2
-9
No files found.
spec/factories/groups.rb
View file @
4b464eaa
...
@@ -17,6 +17,10 @@ FactoryGirl.define do
...
@@ -17,6 +17,10 @@ FactoryGirl.define do
visibility_level
Gitlab
::
VisibilityLevel
::
PRIVATE
visibility_level
Gitlab
::
VisibilityLevel
::
PRIVATE
end
end
trait
:with_avatar
do
avatar
{
File
.
open
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
))
}
end
factory
:group_with_members
do
factory
:group_with_members
do
after
(
:create
)
do
|
group
,
evaluator
|
after
(
:create
)
do
|
group
,
evaluator
|
group
.
add_developer
(
create
:user
)
group
.
add_developer
(
create
:user
)
...
...
spec/factories/users.rb
View file @
4b464eaa
...
@@ -33,6 +33,10 @@ FactoryGirl.define do
...
@@ -33,6 +33,10 @@ FactoryGirl.define do
after
(
:build
)
{
|
user
,
_
|
user
.
block!
}
after
(
:build
)
{
|
user
,
_
|
user
.
block!
}
end
end
trait
:with_avatar
do
avatar
{
File
.
open
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
))
}
end
trait
:two_factor_via_otp
do
trait
:two_factor_via_otp
do
before
(
:create
)
do
|
user
|
before
(
:create
)
do
|
user
|
user
.
otp_required_for_login
=
true
user
.
otp_required_for_login
=
true
...
...
spec/models/group_spec.rb
View file @
4b464eaa
...
@@ -176,19 +176,16 @@ describe Group, models: true do
...
@@ -176,19 +176,16 @@ describe Group, models: true do
end
end
describe
'#avatar_url'
do
describe
'#avatar_url'
do
let!
(
:group
)
{
create
(
:group
,
:access_requestable
,
:with_avatar
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
subject
{
group
.
avatar_url
}
subject
{
group
.
avatar_url
}
context
'when avatar file is uploaded'
do
context
'when avatar file is uploaded'
do
before
do
before
do
group
.
add_user
(
user
,
GroupMember
::
MASTER
)
group
.
add_master
(
user
)
group
.
update_columns
(
avatar:
'avatar.png'
)
allow
(
group
.
avatar
).
to
receive
(
:present?
)
{
true
}
end
end
let
(
:avatar_path
)
do
let
(
:avatar_path
)
{
"/uploads/group/avatar/
#{
group
.
id
}
/dk.png"
}
"/uploads/group/avatar/
#{
group
.
id
}
/avatar.png"
end
it
{
should
eq
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
}
it
{
should
eq
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
}
...
...
spec/models/project_spec.rb
View file @
4b464eaa
...
@@ -963,23 +963,6 @@ describe Project, models: true do
...
@@ -963,23 +963,6 @@ describe Project, models: true do
end
end
end
end
describe
'#execute_hooks'
do
it
"triggers project and group hooks"
do
group
=
create
:group
,
name:
'gitlab'
project
=
create
(
:project
,
name:
'gitlabhq'
,
namespace:
group
)
project_hook
=
create
(
:project_hook
,
push_events:
true
,
project:
project
)
group_hook
=
create
(
:group_hook
,
push_events:
true
,
group:
group
)
stub_request
(
:post
,
project_hook
.
url
)
stub_request
(
:post
,
group_hook
.
url
)
expect_any_instance_of
(
GroupHook
).
to
receive
(
:async_execute
).
and_return
(
true
)
expect_any_instance_of
(
ProjectHook
).
to
receive
(
:async_execute
).
and_return
(
true
)
project
.
execute_hooks
({},
:push_hooks
)
end
end
describe
'#avatar_url'
do
describe
'#avatar_url'
do
subject
{
project
.
avatar_url
}
subject
{
project
.
avatar_url
}
...
@@ -987,12 +970,9 @@ describe Project, models: true do
...
@@ -987,12 +970,9 @@ describe Project, models: true do
context
'when avatar file is uploaded'
do
context
'when avatar file is uploaded'
do
let
(
:project
)
{
create
(
:empty_project
,
:with_avatar
)
}
let
(
:project
)
{
create
(
:empty_project
,
:with_avatar
)
}
let
(
:avatar_path
)
{
"/uploads/project/avatar/
#{
project
.
id
}
/dk.png"
}
it
'creates a correct avatar path'
do
it
{
should
eq
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
}
avatar_path
=
"/uploads/project/avatar/
#{
project
.
id
}
/dk.png"
expect
(
project
.
avatar_url
).
to
eq
(
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
)
end
context
'When in a geo secondary node'
do
context
'When in a geo secondary node'
do
let
(
:geo_url
)
{
'http://geo.example.com'
}
let
(
:geo_url
)
{
'http://geo.example.com'
}
...
@@ -1011,9 +991,7 @@ describe Project, models: true do
...
@@ -1011,9 +991,7 @@ describe Project, models: true do
allow
(
project
).
to
receive
(
:avatar_in_git
)
{
true
}
allow
(
project
).
to
receive
(
:avatar_in_git
)
{
true
}
end
end
let
(
:avatar_path
)
do
let
(
:avatar_path
)
{
"/
#{
project
.
full_path
}
/avatar"
}
"/
#{
project
.
full_path
}
/avatar"
end
it
{
should
eq
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
}
it
{
should
eq
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
}
end
end
...
@@ -1025,6 +1003,23 @@ describe Project, models: true do
...
@@ -1025,6 +1003,23 @@ describe Project, models: true do
end
end
end
end
describe
'#execute_hooks'
do
it
"triggers project and group hooks"
do
group
=
create
:group
,
name:
'gitlab'
project
=
create
(
:project
,
name:
'gitlabhq'
,
namespace:
group
)
project_hook
=
create
(
:project_hook
,
push_events:
true
,
project:
project
)
group_hook
=
create
(
:group_hook
,
push_events:
true
,
group:
group
)
stub_request
(
:post
,
project_hook
.
url
)
stub_request
(
:post
,
group_hook
.
url
)
expect_any_instance_of
(
GroupHook
).
to
receive
(
:async_execute
).
and_return
(
true
)
expect_any_instance_of
(
ProjectHook
).
to
receive
(
:async_execute
).
and_return
(
true
)
project
.
execute_hooks
({},
:push_hooks
)
end
end
describe
'#allowed_to_share_with_group?'
do
describe
'#allowed_to_share_with_group?'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
...
...
spec/models/user_spec.rb
View file @
4b464eaa
...
@@ -899,18 +899,11 @@ describe User, models: true do
...
@@ -899,18 +899,11 @@ describe User, models: true do
end
end
describe
'#avatar_url'
do
describe
'#avatar_url'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
,
:with_avatar
)
}
subject
{
user
.
avatar_url
}
subject
{
user
.
avatar_url
}
context
'when avatar file is uploaded'
do
context
'when avatar file is uploaded'
do
before
do
let
(
:avatar_path
)
{
"/uploads/user/avatar/
#{
user
.
id
}
/dk.png"
}
user
.
update_columns
(
avatar:
'uploads/avatar.png'
)
allow
(
user
.
avatar
).
to
receive
(
:present?
)
{
true
}
end
let
(
:avatar_path
)
do
"/uploads/user/avatar/
#{
user
.
id
}
/uploads/avatar.png"
end
it
{
should
eq
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
}
it
{
should
eq
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
}
...
...
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