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
f1ace97f
Commit
f1ace97f
authored
May 03, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport avatar-related spec changes from gitlab-org/gitlab-ee@4b464eaaee
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
d3768dd7
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
8 deletions
+38
-8
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
+16
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+3
-8
spec/models/user_spec.rb
spec/models/user_spec.rb
+11
-0
No files found.
spec/factories/groups.rb
View file @
f1ace97f
...
...
@@ -17,6 +17,10 @@ FactoryGirl.define do
visibility_level
Gitlab
::
VisibilityLevel
::
PRIVATE
end
trait
:with_avatar
do
avatar
{
File
.
open
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
))
}
end
trait
:access_requestable
do
request_access_enabled
true
end
...
...
spec/factories/users.rb
View file @
f1ace97f
...
...
@@ -29,6 +29,10 @@ FactoryGirl.define do
after
(
:build
)
{
|
user
,
_
|
user
.
block!
}
end
trait
:with_avatar
do
avatar
{
File
.
open
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
))
}
end
trait
:two_factor_via_otp
do
before
(
:create
)
do
|
user
|
user
.
otp_required_for_login
=
true
...
...
spec/models/group_spec.rb
View file @
f1ace97f
...
...
@@ -175,6 +175,22 @@ describe Group, models: true do
end
end
describe
'#avatar_url'
do
let!
(
:group
)
{
create
(
:group
,
:access_requestable
,
:with_avatar
)
}
let
(
:user
)
{
create
(
:user
)
}
subject
{
group
.
avatar_url
}
context
'when avatar file is uploaded'
do
before
do
group
.
add_master
(
user
)
end
let
(
:avatar_path
)
{
"/uploads/group/avatar/
#{
group
.
id
}
/dk.png"
}
it
{
should
eq
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
}
end
end
describe
'.search'
do
it
'returns groups with a matching name'
do
expect
(
described_class
.
search
(
group
.
name
)).
to
eq
([
group
])
...
...
spec/models/project_spec.rb
View file @
f1ace97f
...
...
@@ -811,12 +811,9 @@ describe Project, models: true do
context
'when avatar file is uploaded'
do
let
(
:project
)
{
create
(
:empty_project
,
:with_avatar
)
}
let
(
:avatar_path
)
{
"/uploads/project/avatar/
#{
project
.
id
}
/dk.png"
}
it
'creates a correct avatar path'
do
avatar_path
=
"/uploads/project/avatar/
#{
project
.
id
}
/dk.png"
expect
(
project
.
avatar_url
).
to
eq
(
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
)
end
it
{
should
eq
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
}
end
context
'When avatar file in git'
do
...
...
@@ -824,9 +821,7 @@ describe Project, models: true do
allow
(
project
).
to
receive
(
:avatar_in_git
)
{
true
}
end
let
(
:avatar_path
)
do
"/
#{
project
.
full_path
}
/avatar"
end
let
(
:avatar_path
)
{
"/
#{
project
.
full_path
}
/avatar"
}
it
{
should
eq
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
}
end
...
...
spec/models/user_spec.rb
View file @
f1ace97f
...
...
@@ -874,6 +874,17 @@ describe User, models: true do
end
end
describe
'#avatar_url'
do
let
(
:user
)
{
create
(
:user
,
:with_avatar
)
}
subject
{
user
.
avatar_url
}
context
'when avatar file is uploaded'
do
let
(
:avatar_path
)
{
"/uploads/user/avatar/
#{
user
.
id
}
/dk.png"
}
it
{
should
eq
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
}
end
end
describe
'#requires_ldap_check?'
do
let
(
:user
)
{
User
.
new
}
...
...
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