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
e1e8856e
Valider
e1e8856e
rédigé
il y a 9 ans
par
zaziemo
Validation de
Dennis Schubert
il y a 9 ans
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
refactor more specs
parent
e3fe3758
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
1
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
spec/models/comment_spec.rb
+36
-28
36 ajouts, 28 suppressions
spec/models/comment_spec.rb
avec
36 ajouts
et
28 suppressions
spec/models/comment_spec.rb
+
36
−
28
Voir le fichier @
e1e8856e
...
@@ -69,59 +69,65 @@ describe Comment, :type => :model do
...
@@ -69,59 +69,65 @@ describe Comment, :type => :model do
end
end
end
end
# hier weiter
describe
'xml'
do
describe
'xml'
do
let
(
:commenter
)
{
create
(
:user
)
}
let
(
:commenter_aspect
)
{
commenter
.
aspects
.
create
(
name:
"bruisers"
)
}
let
(
:post
)
{
alice
.
post
:status_message
,
text:
"hello"
,
to:
alices_aspect
.
id
}
let
(
:comment
)
{
commenter
.
comment!
(
post
,
"Fool!"
)
}
let
(
:xml
)
{
comment
.
to_xml
.
to_s
}
before
do
before
do
@commenter
=
FactoryGirl
.
create
(
:user
)
connect_users
(
alice
,
alices_aspect
,
commenter
,
commenter_aspect
)
@commenter_aspect
=
@commenter
.
aspects
.
create
(
:name
=>
"bruisers"
)
connect_users
(
alice
,
alices_aspect
,
@commenter
,
@commenter_aspect
)
@post
=
alice
.
post
:status_message
,
:text
=>
"hello"
,
:to
=>
alices_aspect
.
id
@comment
=
@commenter
.
comment!
(
@post
,
"Fool!"
)
@xml
=
@comment
.
to_xml
.
to_s
end
end
it
'serializes the sender handle'
do
it
'serializes the sender handle'
do
expect
(
@
xml
.
include?
(
@
commenter
.
diaspora_handle
)).
to
be
true
expect
(
xml
.
include?
(
commenter
.
diaspora_handle
)).
to
be
true
end
end
it
'serializes the post_guid'
do
it
'serializes the post_guid'
do
expect
(
@
xml
).
to
include
(
@
post
.
guid
)
expect
(
xml
).
to
include
(
post
.
guid
)
end
end
describe
'marshalling'
do
describe
'marshalling'
do
before
do
let
(
:marshalled_comment
)
{
Comment
.
from_xml
(
xml
)
}
@marshalled_comment
=
Comment
.
from_xml
(
@xml
)
end
it
'marshals the author'
do
it
'marshals the author'
do
expect
(
@
marshalled_comment
.
author
).
to
eq
(
@
commenter
.
person
)
expect
(
marshalled_comment
.
author
).
to
eq
(
commenter
.
person
)
end
end
it
'marshals the post'
do
it
'marshals the post'
do
expect
(
@
marshalled_comment
.
post
).
to
eq
(
@
post
)
expect
(
marshalled_comment
.
post
).
to
eq
(
post
)
end
end
it
'tries to fetch a missing parent'
do
it
'tries to fetch a missing parent'
do
guid
=
@post
.
guid
guid
=
post
.
guid
@post
.
destroy
marshalled_comment
post
.
destroy
expect_any_instance_of
(
Comment
).
to
receive
(
:fetch_parent
).
with
(
guid
).
and_return
(
nil
)
expect_any_instance_of
(
Comment
).
to
receive
(
:fetch_parent
).
with
(
guid
).
and_return
(
nil
)
Comment
.
from_xml
(
@
xml
)
Comment
.
from_xml
(
xml
)
end
end
end
end
end
end
#Andy fragen - shared behaviour
describe
'it is relayable'
do
describe
'it is relayable'
do
let
(
:remote_parent
)
{
build
(
:status_message
,
author:
@remote_raphael
)
}
let
(
:local_parent
)
{
@local_luke
.
post
:status_message
,
text:
"hi"
,
to:
@local_luke
.
aspects
.
first
}
let
(
:object_by_parent_author
)
{
@local_luke
.
comment!
(
text:
"yo!"
,
post:
local_parent
)
}
let
(
:object_by_recipient
)
{
@local_leia
.
build_comment
(
text:
"yo"
,
post:
local_parent
)
}
let
(
:dup_object_by_parent_author
)
{
object_by_parent_author
.
dup
}
let
(
:object_on_remote_parent
)
{
@local_luke
.
comment!
(
remote_parent
,
"Yeah, it was great"
)
}
before
do
before
do
@
local_luke
,
@local_leia
,
@remote_raphael
=
set_up_friends
local_luke
,
@local_leia
,
@remote_raphael
=
set_up_friends
@remote_parent
=
FactoryGirl
.
build
(
:status_message
,
:author
=>
@remote_raphael
)
#
@remote_parent = FactoryGirl.build(:status_message, :author => @remote_raphael)
@local_parent
=
@local_luke
.
post
:status_message
,
:text
=>
"hi"
,
:to
=>
@local_luke
.
aspects
.
first
#
@local_parent = @local_luke.post :status_message, :text => "hi", :to => @local_luke.aspects.first
@object_by_parent_author
=
@local_luke
.
comment!
(
@local_parent
,
"yo"
)
#
@object_by_parent_author = @local_luke.comment!(@local_parent, "yo")
@object_by_recipient
=
@local_leia
.
build_comment
(
:text
=>
"yo"
,
:post
=>
@local_parent
)
#
@object_by_recipient = @local_leia.build_comment(:text => "yo", :post => @local_parent)
@dup_object_by_parent_author
=
@object_by_parent_author
.
dup
#
@dup_object_by_parent_author = @object_by_parent_author.dup
@object_on_remote_parent
=
@local_luke
.
comment!
(
@remote_parent
,
"Yeah, it was great"
)
#
@object_on_remote_parent = @local_luke.comment!(@remote_parent, "Yeah, it was great")
end
end
let
(
:build_object
)
{
alice
.
build_comment
(
:post
=>
status_bob
,
:text
=>
"why so formal?"
)
}
let
(
:build_object
)
{
alice
.
build_comment
(
:post
=>
status_bob
,
:text
=>
"why so formal?"
)
}
...
@@ -129,9 +135,11 @@ describe Comment, :type => :model do
...
@@ -129,9 +135,11 @@ describe Comment, :type => :model do
end
end
describe
'tags'
do
describe
'tags'
do
before
do
let
(
:object
)
{
build
(
:comment
)
}
@object
=
FactoryGirl
.
build
(
:comment
)
end
# before do
# @object = FactoryGirl.build(:comment)
# end
it_should_behave_like
'it is taggable'
it_should_behave_like
'it is taggable'
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