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é
9 years ago
par
zaziemo
Validation de
Dennis Schubert
9 years ago
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
refactor more specs
parent
e3fe3758
Aucune branche associée trouvée
Aucune étiquette associée trouvée
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
end
end
# hier weiter
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
@commenter
=
FactoryGirl
.
create
(
:user
)
@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
connect_users
(
alice
,
alices_aspect
,
commenter
,
commenter_aspect
)
end
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
it
'serializes the post_guid'
do
expect
(
@
xml
).
to
include
(
@
post
.
guid
)
expect
(
xml
).
to
include
(
post
.
guid
)
end
describe
'marshalling'
do
before
do
@marshalled_comment
=
Comment
.
from_xml
(
@xml
)
end
let
(
:marshalled_comment
)
{
Comment
.
from_xml
(
xml
)
}
it
'marshals the author'
do
expect
(
@
marshalled_comment
.
author
).
to
eq
(
@
commenter
.
person
)
expect
(
marshalled_comment
.
author
).
to
eq
(
commenter
.
person
)
end
it
'marshals the post'
do
expect
(
@
marshalled_comment
.
post
).
to
eq
(
@
post
)
expect
(
marshalled_comment
.
post
).
to
eq
(
post
)
end
it
'tries to fetch a missing parent'
do
guid
=
@post
.
guid
@post
.
destroy
guid
=
post
.
guid
marshalled_comment
post
.
destroy
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
#Andy fragen - shared behaviour
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
@
local_luke
,
@local_leia
,
@remote_raphael
=
set_up_friends
@remote_parent
=
FactoryGirl
.
build
(
:status_message
,
:author
=>
@remote_raphael
)
@local_parent
=
@local_luke
.
post
:status_message
,
:text
=>
"hi"
,
:to
=>
@local_luke
.
aspects
.
first
local_luke
,
@local_leia
,
@remote_raphael
=
set_up_friends
#
@remote_parent = FactoryGirl.build(:status_message, :author => @remote_raphael)
#
@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_recipient
=
@local_leia
.
build_comment
(
:text
=>
"yo"
,
:post
=>
@local_parent
)
@dup_object_by_parent_author
=
@object_by_parent_author
.
dup
#
@object_by_parent_author = @local_luke.comment!(@local_parent, "yo")
#
@object_by_recipient = @local_leia.build_comment(:text => "yo", :post => @local_parent)
#
@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
let
(
:build_object
)
{
alice
.
build_comment
(
:post
=>
status_bob
,
:text
=>
"why so formal?"
)
}
...
...
@@ -129,9 +135,11 @@ describe Comment, :type => :model do
end
describe
'tags'
do
before
do
@object
=
FactoryGirl
.
build
(
:comment
)
end
let
(
:object
)
{
build
(
:comment
)
}
# before do
# @object = FactoryGirl.build(:comment)
# end
it_should_behave_like
'it is taggable'
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