Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
J
jasette-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
jasette-facil
Validations
8c0e77d6
Valider
8c0e77d6
rédigé
il y a 7 ans
par
ysksn
Validation de
Eugen Rochko
il y a 7 ans
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Add tests for AccountRelationshipsPresenter (#5805)
parent
7a45d382
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/presenters/account_relationships_presenter_spec.rb
+82
-0
82 ajouts, 0 suppression
spec/presenters/account_relationships_presenter_spec.rb
avec
82 ajouts
et
0 suppression
spec/presenters/account_relationships_presenter_spec.rb
0 → 100644
+
82
−
0
Voir le fichier @
8c0e77d6
# frozen_string_literal: true
require
'rails_helper'
RSpec
.
describe
AccountRelationshipsPresenter
do
describe
'.initialize'
do
before
do
allow
(
Account
).
to
receive
(
:following_map
).
with
(
account_ids
,
current_account_id
).
and_return
(
default_map
)
allow
(
Account
).
to
receive
(
:followed_by_map
).
with
(
account_ids
,
current_account_id
).
and_return
(
default_map
)
allow
(
Account
).
to
receive
(
:blocking_map
).
with
(
account_ids
,
current_account_id
).
and_return
(
default_map
)
allow
(
Account
).
to
receive
(
:muting_map
).
with
(
account_ids
,
current_account_id
).
and_return
(
default_map
)
allow
(
Account
).
to
receive
(
:requested_map
).
with
(
account_ids
,
current_account_id
).
and_return
(
default_map
)
allow
(
Account
).
to
receive
(
:domain_blocking_map
).
with
(
account_ids
,
current_account_id
).
and_return
(
default_map
)
end
let
(
:presenter
)
{
AccountRelationshipsPresenter
.
new
(
account_ids
,
current_account_id
,
options
)
}
let
(
:current_account_id
)
{
Fabricate
(
:account
).
id
}
let
(
:account_ids
)
{
[
Fabricate
(
:account
).
id
]
}
let
(
:default_map
)
{
{
1
=>
true
}
}
context
'options are not set'
do
let
(
:options
)
{
{}
}
it
'sets default maps'
do
expect
(
presenter
.
following
).
to
eq
default_map
expect
(
presenter
.
followed_by
).
to
eq
default_map
expect
(
presenter
.
blocking
).
to
eq
default_map
expect
(
presenter
.
muting
).
to
eq
default_map
expect
(
presenter
.
requested
).
to
eq
default_map
expect
(
presenter
.
domain_blocking
).
to
eq
default_map
end
end
context
'options[:following_map] is set'
do
let
(
:options
)
{
{
following_map:
{
2
=>
true
}
}
}
it
'sets @following merged with default_map and options[:following_map]'
do
expect
(
presenter
.
following
).
to
eq
default_map
.
merge
(
options
[
:following_map
])
end
end
context
'options[:followed_by_map] is set'
do
let
(
:options
)
{
{
followed_by_map:
{
3
=>
true
}
}
}
it
'sets @followed_by merged with default_map and options[:followed_by_map]'
do
expect
(
presenter
.
followed_by
).
to
eq
default_map
.
merge
(
options
[
:followed_by_map
])
end
end
context
'options[:blocking_map] is set'
do
let
(
:options
)
{
{
blocking_map:
{
4
=>
true
}
}
}
it
'sets @blocking merged with default_map and options[:blocking_map]'
do
expect
(
presenter
.
blocking
).
to
eq
default_map
.
merge
(
options
[
:blocking_map
])
end
end
context
'options[:muting_map] is set'
do
let
(
:options
)
{
{
muting_map:
{
5
=>
true
}
}
}
it
'sets @muting merged with default_map and options[:muting_map]'
do
expect
(
presenter
.
muting
).
to
eq
default_map
.
merge
(
options
[
:muting_map
])
end
end
context
'options[:requested_map] is set'
do
let
(
:options
)
{
{
requested_map:
{
6
=>
true
}
}
}
it
'sets @requested merged with default_map and options[:requested_map]'
do
expect
(
presenter
.
requested
).
to
eq
default_map
.
merge
(
options
[
:requested_map
])
end
end
context
'options[:domain_blocking_map] is set'
do
let
(
:options
)
{
{
domain_blocking_map:
{
7
=>
true
}
}
}
it
'sets @domain_blocking merged with default_map and options[:domain_blocking_map]'
do
expect
(
presenter
.
domain_blocking
).
to
eq
default_map
.
merge
(
options
[
:domain_blocking_map
])
end
end
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