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
e039aabe
Valider
e039aabe
rédigé
13 years ago
par
Maxwell Salzberg
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
senders must now own aspects
parent
eb8c540a
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
app/models/invitation.rb
+9
-0
9 ajouts, 0 suppression
app/models/invitation.rb
spec/models/invitation_spec.rb
+9
-3
9 ajouts, 3 suppressions
spec/models/invitation_spec.rb
avec
18 ajouts
et
3 suppressions
app/models/invitation.rb
+
9
−
0
Voir le fichier @
e039aabe
...
@@ -17,6 +17,7 @@ class Invitation < ActiveRecord::Base
...
@@ -17,6 +17,7 @@ class Invitation < ActiveRecord::Base
validate
:ensure_not_inviting_self
,
:on
=>
:create
validate
:ensure_not_inviting_self
,
:on
=>
:create
validate
:valid_identifier?
validate
:valid_identifier?
validate
:sender_owns_aspect?
validates_uniqueness_of
:sender_id
,
:scope
=>
[
:identifier
,
:service
],
:unless
=>
:admin?
validates_uniqueness_of
:sender_id
,
:scope
=>
[
:identifier
,
:service
],
:unless
=>
:admin?
after_create
:queue_send!
#TODO make this after_commit :queue_saved!, :on => :create
after_create
:queue_send!
#TODO make this after_commit :queue_saved!, :on => :create
...
@@ -121,6 +122,14 @@ class Invitation < ActiveRecord::Base
...
@@ -121,6 +122,14 @@ class Invitation < ActiveRecord::Base
end
end
end
end
# @note Validation
def
sender_owns_aspect?
unless
(
self
.
sender
&&
(
self
.
sender_id
==
self
.
aspect
.
user_id
))
errors
[
:base
]
<<
'You do not own that aspect'
end
end
# @note Validation
# @note Validation
def
valid_identifier?
def
valid_identifier?
return
false
unless
self
.
identifier
return
false
unless
self
.
identifier
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
spec/models/invitation_spec.rb
+
9
−
3
Voir le fichier @
e039aabe
...
@@ -24,7 +24,8 @@ describe Invitation do
...
@@ -24,7 +24,8 @@ describe Invitation do
end
end
it
'ensures the sender is placing the recipient into one of his aspects'
do
it
'ensures the sender is placing the recipient into one of his aspects'
do
pending
@invitation
.
aspect
=
Factory
(
:aspect
)
@invitation
.
should_not
be_valid
end
end
end
end
...
@@ -35,6 +36,7 @@ describe Invitation do
...
@@ -35,6 +36,7 @@ describe Invitation do
end
end
describe
'the invite process'
do
describe
'the invite process'
do
before
do
before
do
end
end
...
@@ -61,13 +63,17 @@ describe Invitation do
...
@@ -61,13 +63,17 @@ describe Invitation do
invite
.
send!
invite
.
send!
}.
should_not
change
(
User
,
:count
)
}.
should_not
change
(
User
,
:count
)
end
end
it
'is able to resend an invite'
do
end
it
'handles the case when that user has an invite but not a user'
do
it
'handles the case when that user has an invite but not a user'
do
pending
end
end
it
'handles the case where that user has an invite but has not yet accepted'
do
it
'handles the case where that user has an invite but has not yet accepted'
do
pending
end
it
'generate the invitation token and pass it to the user'
do
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