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
a0e8f161
Valider
a0e8f161
rédigé
il y a 13 ans
par
danielgrippi
Validation de
Maxwell Salzberg
il y a 13 ans
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
fix notifications controller. yay.
parent
ceb8497e
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/controllers/notifications_controller_spec.rb
+11
-15
11 ajouts, 15 suppressions
spec/controllers/notifications_controller_spec.rb
avec
11 ajouts
et
15 suppressions
spec/controllers/notifications_controller_spec.rb
+
11
−
15
Voir le fichier @
a0e8f161
...
...
@@ -5,12 +5,8 @@
require
'spec_helper'
describe
NotificationsController
do
render_views
(
false
)
before
do
@user
=
alice
@aspect
=
@user
.
aspects
.
first
@controller
=
NotificationsController
.
new
@controller
.
stub!
(
:current_user
).
and_return
(
@user
)
sign_in
:user
,
alice
end
describe
'#update'
do
...
...
@@ -37,7 +33,7 @@ describe NotificationsController do
it
'only lets you read your own notifications'
do
user2
=
bob
Factory
(
:notification
,
:recipient
=>
@user
)
Factory
(
:notification
,
:recipient
=>
alice
)
note
=
Factory
(
:notification
,
:recipient
=>
user2
)
get
:update
,
"id"
=>
note
.
id
,
:set_unread
=>
"false"
...
...
@@ -49,20 +45,20 @@ describe NotificationsController do
describe
"#read_all"
do
it
'marks all notifications as read'
do
request
.
env
[
"HTTP_REFERER"
]
=
"I wish I were spelled right"
Factory
(
:notification
,
:recipient
=>
@user
)
Factory
(
:notification
,
:recipient
=>
@user
)
Factory
(
:notification
,
:recipient
=>
alice
)
Factory
(
:notification
,
:recipient
=>
alice
)
Notification
.
where
(
:unread
=>
true
).
count
.
should
==
2
get
:read_all
Notification
.
where
(
:unread
=>
true
).
count
.
should
==
0
end
it
"should redirect to the stream in the html version"
do
Factory
(
:notification
,
:recipient
=>
@user
)
Factory
(
:notification
,
:recipient
=>
alice
)
get
:read_all
,
:format
=>
:html
response
.
should
redirect_to
(
stream_path
)
end
it
"should return a dummy value in the json version"
do
Factory
(
:notification
,
:recipient
=>
@user
)
Factory
(
:notification
,
:recipient
=>
alice
)
get
:read_all
,
:format
=>
:json
response
.
should_not
be_redirect
end
...
...
@@ -71,11 +67,11 @@ describe NotificationsController do
describe
'#index'
do
before
do
@post
=
Factory
(
:status_message
)
Factory
(
:notification
,
:recipient
=>
@user
,
:target
=>
@post
)
Factory
(
:notification
,
:recipient
=>
alice
,
:target
=>
@post
)
end
it
'paginates the notifications'
do
25
.
times
{
Factory
(
:notification
,
:recipient
=>
@user
,
:target
=>
@post
)
}
25
.
times
{
Factory
(
:notification
,
:recipient
=>
alice
,
:target
=>
@post
)
}
get
:index
assigns
[
:notifications
].
count
.
should
==
25
get
:index
,
"page"
=>
2
...
...
@@ -83,20 +79,20 @@ describe NotificationsController do
end
it
"supports a limit per_page parameter"
do
5
.
times
{
Factory
(
:notification
,
:recipient
=>
@user
,
:target
=>
@post
)
}
5
.
times
{
Factory
(
:notification
,
:recipient
=>
alice
,
:target
=>
@post
)
}
get
:index
,
"per_page"
=>
5
assigns
[
:notifications
].
count
.
should
==
5
end
describe
"special case for start sharing notifications"
do
it
"should not provide a contacts menu for standard notifications"
do
2
.
times
{
Factory
(
:notification
,
:recipient
=>
@user
,
:target
=>
@post
)
}
2
.
times
{
Factory
(
:notification
,
:recipient
=>
alice
,
:target
=>
@post
)
}
get
:index
,
"per_page"
=>
5
Nokogiri
(
response
.
body
).
css
(
'.aspect_membership'
).
should
be_empty
end
it
"should provide a contacts menu for start sharing notifications"
do
2
.
times
{
Factory
(
:notification
,
:recipient
=>
@user
,
:target
=>
@post
)
}
2
.
times
{
Factory
(
:notification
,
:recipient
=>
alice
,
:target
=>
@post
)
}
eve
.
share_with
(
alice
.
person
,
eve
.
aspects
.
first
)
get
:index
,
"per_page"
=>
5
...
...
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