Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
P
parlote-facil
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
facil
parlote-facil
Validations
7c75a54d
Valider
7c75a54d
rédigé
il y a 14 ans
par
Raphael
Parcourir les fichiers
Options
Téléchargements
Plain Diff
Merge branch 'master' of github.com:diaspora/diaspora_rails
parents
cb152ea3
9ee10450
Aucune branche associée trouvée
Branches contenant la validation
Aucune étiquette associée trouvée
Étiquettes contenant la validation
Aucune requête de fusion associée trouvée
Modifications
2
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
spec/models/person_spec.rb
+45
-42
45 ajouts, 42 suppressions
spec/models/person_spec.rb
spec/models/post_spec.rb
+14
-15
14 ajouts, 15 suppressions
spec/models/post_spec.rb
avec
59 ajouts
et
57 suppressions
spec/models/person_spec.rb
+
45
−
42
Voir le fichier @
7c75a54d
...
...
@@ -9,7 +9,6 @@ describe Person do
@group2
=
@user2
.
group
(
:name
=>
"Abscence of Babes"
)
end
it
'should not allow two people with the same email'
do
person_two
=
Factory
.
build
(
:person
,
:url
=>
@person
.
email
)
person_two
.
valid?
.
should
==
false
...
...
@@ -19,125 +18,129 @@ describe Person do
before
do
@xml
=
@person
.
to_xml
.
to_s
end
it
'should serialize to xml'
do
(
@xml
.
include?
"person"
).
should
==
true
@xml
.
include?
(
"person"
).
should
==
true
end
it
'should have a profile in its xml'
do
(
@xml
.
include?
"first_name"
).
should
==
true
@xml
.
include?
(
"first_name"
).
should
==
true
end
end
it
'should know when a post belongs to it'
do
person_message
=
Factory
.
create
(
:status_message
,
:person
=>
@person
)
person_two
=
Factory
.
create
(
:person
)
person_two
=
Factory
.
create
(
:person
)
@person
.
owns?
(
person_message
).
should
be
true
@person
.
owns?
(
person_message
).
should
be
true
person_two
.
owns?
(
person_message
).
should
be
false
end
it
'should delete all of user except comments upon user deletion'
do
f
=
Factory
.
create
(
:person
)
person
=
Factory
.
create
(
:person
)
Factory
.
create
(
:status_message
,
:person
=>
person
)
Factory
.
create
(
:status_message
,
:person
=>
person
)
Factory
.
create
(
:status_message
,
:person
=>
person
)
Factory
.
create
(
:status_message
,
:person
=>
person
)
Factory
.
create
(
:status_message
,
:person
=>
f
)
Factory
.
create
(
:blog
,
:person
=>
f
)
Factory
.
create
(
:bookmark
,
:person
=>
f
)
Factory
.
create
(
:status_message
,
:person
=>
f
)
s
=
Factory
.
create
(
:status_message
,
:person
=>
@person
)
status_message
=
Factory
.
create
(
:status_message
,
:person
=>
@person
)
Factory
.
create
(
:comment
,
:person_id
=>
f
.
id
,
:text
=>
"yes i do"
,
:post
=>
s
)
Factory
.
create
(
:comment
,
:person_id
=>
f
.
id
,
:text
=>
"i love you"
,
:post
=>
s
)
Factory
.
create
(
:comment
,
:person_id
=>
f
.
id
,
:text
=>
"hello"
,
:post
=>
s
)
Factory
.
create
(
:comment
,
:person_id
=>
@person
.
id
,
:text
=>
"you are creepy"
,
:post
=>
s
)
Factory
.
create
(
:comment
,
:person_id
=>
person
.
id
,
:text
=>
"yes i do"
,
:post
=>
s
tatus_message
)
Factory
.
create
(
:comment
,
:person_id
=>
person
.
id
,
:text
=>
"i love you"
,
:post
=>
s
tatus_message
)
Factory
.
create
(
:comment
,
:person_id
=>
person
.
id
,
:text
=>
"hello"
,
:post
=>
s
tatus_message
)
Factory
.
create
(
:comment
,
:person_id
=>
@person
.
id
,
:text
=>
"you are creepy"
,
:post
=>
s
tatus_message
)
f
.
destroy
person
.
destroy
Post
.
count
.
should
==
1
Post
.
count
.
should
==
1
Comment
.
all
.
count
.
should
==
4
s
.
comments
.
count
.
should
==
4
s
tatus_message
.
comments
.
count
.
should
==
4
end
describe
"unfriending"
do
it
'should delete an orphaned friend'
do
request
=
@user
.
send_friend_request_to
@person
.
receive_url
,
@group
.
id
@user
.
activate_friend
(
@person
,
@group
)
@user
.
reload
Person
.
all
.
count
.
should
==
3
Person
.
all
.
count
.
should
==
3
@user
.
friends
.
count
.
should
==
1
@user
.
unfriend
(
@person
)
@user
.
reload
@user
.
friends
.
count
.
should
==
0
Person
.
all
.
count
.
should
==
2
Person
.
all
.
count
.
should
==
2
end
it
'should not delete an un-orphaned friend'
do
request
=
@user
.
send_friend_request_to
@person
.
receive_url
,
@group
.
id
request2
=
@user2
.
send_friend_request_to
@person
.
receive_url
,
@group2
.
id
@user
.
activate_friend
(
@person
,
@group
)
@user
.
activate_friend
(
@person
,
@group
)
@user2
.
activate_friend
(
@person
,
@group2
)
@user
.
reload
@user2
.
reload
Person
.
all
.
count
.
should
==
3
@user
.
friends
.
count
.
should
==
1
Person
.
all
.
count
.
should
==
3
@user
.
friends
.
count
.
should
==
1
@user2
.
friends
.
count
.
should
==
1
@user
.
unfriend
(
@person
)
@user
.
reload
@user2
.
reload
@user
.
friends
.
count
.
should
==
0
@user
.
friends
.
count
.
should
==
0
@user2
.
friends
.
count
.
should
==
1
Person
.
all
.
count
.
should
==
3
Person
.
all
.
count
.
should
==
3
end
end
describe
'searching'
do
before
do
@friend_one
=
Factory
.
create
(
:person
)
@friend_two
=
Factory
.
create
(
:person
)
@friend_one
=
Factory
.
create
(
:person
)
@friend_two
=
Factory
.
create
(
:person
)
@friend_three
=
Factory
.
create
(
:person
)
@friend_four
=
Factory
.
create
(
:person
)
@friend_four
=
Factory
.
create
(
:person
)
@friend_one
.
profile
.
first_name
=
"Robert"
@friend_one
.
profile
.
last_name
=
"Grimm"
@friend_one
.
profile
.
last_name
=
"Grimm"
@friend_one
.
profile
.
save
@friend_two
.
profile
.
first_name
=
"Eugene"
@friend_two
.
profile
.
last_name
=
"Weinstein"
@friend_two
.
profile
.
last_name
=
"Weinstein"
@friend_two
.
save
@friend_three
.
profile
.
first_name
=
"Yevgeniy"
@friend_three
.
profile
.
last_name
=
"Dodis"
@friend_three
.
profile
.
last_name
=
"Dodis"
@friend_three
.
save
@friend_four
.
profile
.
first_name
=
"Casey"
@friend_four
.
profile
.
last_name
=
"Grippi"
@friend_four
.
profile
.
last_name
=
"Grippi"
@friend_four
.
save
end
it
'should yield search results on partial names'
do
people
=
Person
.
search
(
"Eu"
)
people
.
include?
(
@friend_two
).
should
==
true
people
.
include?
(
@friend_one
).
should
==
false
people
.
include?
(
@friend_two
).
should
==
true
people
.
include?
(
@friend_one
).
should
==
false
people
.
include?
(
@friend_three
).
should
==
false
people
.
include?
(
@friend_four
).
should
==
false
people
.
include?
(
@friend_four
).
should
==
false
people
=
Person
.
search
(
"Wei"
)
people
.
include?
(
@friend_two
).
should
==
true
people
.
include?
(
@friend_one
).
should
==
false
people
.
include?
(
@friend_two
).
should
==
true
people
.
include?
(
@friend_one
).
should
==
false
people
.
include?
(
@friend_three
).
should
==
false
people
.
include?
(
@friend_four
).
should
==
false
people
.
include?
(
@friend_four
).
should
==
false
people
=
Person
.
search
(
"Gri"
)
people
.
include?
(
@friend_one
).
should
==
true
people
.
include?
(
@friend_four
).
should
==
true
people
.
include?
(
@friend_two
).
should
==
false
people
.
include?
(
@friend_one
).
should
==
true
people
.
include?
(
@friend_four
).
should
==
true
people
.
include?
(
@friend_two
).
should
==
false
people
.
include?
(
@friend_three
).
should
==
false
end
it
'should search by email exactly'
do
Person
.
by_webfinger
(
@friend_one
.
email
).
should
==
@friend_one
end
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
spec/models/post_spec.rb
+
14
−
15
Voir le fichier @
7c75a54d
...
...
@@ -10,35 +10,34 @@ describe Post do
before
do
@person_one
=
Factory
.
create
(
:person
,
:email
=>
"some@dudes.com"
)
@person_two
=
Factory
.
create
(
:person
,
:email
=>
"other@dudes.com"
)
(
2
..
4
).
each
{
|
n
|
Blog
.
create
(
:
title
=>
"title
#{
n
}
"
,
:body
=>
"test
#{
n
}
"
,
:person
=>
@person_one
)}
(
5
..
8
).
each
{
|
n
|
Blog
.
create
(
:
title
=>
"title
#{
n
}
"
,
:body
=>
"test
#{
n
}
"
,
:person
=>
@user
.
person
)}
(
9
..
11
).
each
{
|
n
|
Blog
.
create
(
:
title
=>
"title
#{
n
}
"
,
:body
=>
"test
#{
n
}
"
,
:person
=>
@person_two
)}
(
2
..
4
).
each
{
|
n
|
Factory
.
create
(
:
status_message
,
:message
=>
"test
#{
n
}
"
,
:person
=>
@person_one
)
}
(
5
..
8
).
each
{
|
n
|
Factory
.
create
(
:
status_message
,
:message
=>
"test
#{
n
}
"
,
:person
=>
@user
.
person
)}
(
9
..
11
).
each
{
|
n
|
Factory
.
create
(
:
status_message
,
:message
=>
"test
#{
n
}
"
,
:person
=>
@person_two
)
}
Factory
.
create
(
:status_message
,
:person
=>
@user
)
Factory
.
create
(
:
bookmark
,
:person
=>
@user
)
Factory
.
create
(
:
status_message
,
:person
=>
@user
)
end
it
"should give the most recent blog title and body from owner"
do
blog
=
Blog
.
newest_for
(
@user
.
person
)
blog
.
person
.
email
.
should
==
@user
.
person
.
email
blog
.
class
.
should
==
Blog
blog
.
title
.
should
==
"title 8"
blog
.
body
.
should
==
"test 8"
it
"should give the most recent status_message title and body from owner"
do
status_message
=
StatusMessage
.
newest_for
(
@user
.
person
)
status_message
.
person
.
email
.
should
==
@user
.
person
.
email
status_message
.
class
.
should
==
StatusMessage
status_message
.
message
.
should
==
"test 8"
end
end
describe
"stream"
do
before
do
@owner
=
Factory
.
build
(
:user
)
@owner
=
Factory
.
build
(
:user
)
@person_one
=
Factory
.
create
(
:person
,
:email
=>
"some@dudes.com"
)
@person_two
=
Factory
.
create
(
:person
,
:email
=>
"other@dudes.com"
)
Factory
.
create
(
:status_message
,
:message
=>
"puppies"
,
:created_at
=>
Time
.
now
+
1
,
:person
=>
@owner
.
person
)
Factory
.
create
(
:
bookmark
,
:title
=>
"Reddit"
,
:link
=>
"http://reddit.com"
,
:created_at
=>
Time
.
now
+
2
,
:person
=>
@person_one
)
Factory
.
create
(
:
status_message
,
:message
=>
"http://reddit.com"
,
:created_at
=>
Time
.
now
+
2
,
:person
=>
@person_one
)
Factory
.
create
(
:status_message
,
:message
=>
"kittens"
,
:created_at
=>
Time
.
now
+
3
,
:person
=>
@person_two
)
Factory
.
create
(
:
blog
,
:title
=>
"Bears"
,
:body
=>
"Bear's body"
,
:created_at
=>
Time
.
now
+
4
,
:person
=>
@owner
.
person
)
Factory
.
create
(
:
bookmark
,
:title
=>
"Google"
,
:link
=>
"http://g
oogle
.com
"
,
:created_at
=>
Time
.
now
+
5
,
:person
=>
@person_two
)
Factory
.
create
(
:
status_message
,
:message
=>
"Bear's body"
,
:created_at
=>
Time
.
now
+
4
,
:person
=>
@owner
.
person
)
Factory
.
create
(
:
status_message
,
:message
=>
"G
oogle"
,
:created_at
=>
Time
.
now
+
5
,
:person
=>
@person_two
)
end
it
"should get all posts for a specified user"
do
...
...
@@ -52,7 +51,7 @@ describe Post do
describe
'xml'
do
it
'should serialize to xml with its person'
do
message
=
Factory
.
create
(
:status_message
,
:person
=>
@user
.
person
)
(
message
.
to_xml
.
to_s
.
include?
@user
.
person
.
email
).
should
==
true
message
.
to_xml
.
to_s
.
include?
(
@user
.
person
.
email
).
should
==
true
end
end
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter