Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
091efb31
Commit
091efb31
authored
Nov 01, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs to pass a project when creating subscriptions
parent
48d851d2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
spec/controllers/sent_notifications_controller_spec.rb
spec/controllers/sent_notifications_controller_spec.rb
+2
-2
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+6
-4
spec/services/issuable/bulk_update_service_spec.rb
spec/services/issuable/bulk_update_service_spec.rb
+1
-1
No files found.
spec/controllers/sent_notifications_controller_spec.rb
View file @
091efb31
...
@@ -7,7 +7,7 @@ describe SentNotificationsController, type: :controller do
...
@@ -7,7 +7,7 @@ describe SentNotificationsController, type: :controller do
let
(
:issue
)
do
let
(
:issue
)
do
create
(
:issue
,
project:
project
,
author:
user
)
do
|
issue
|
create
(
:issue
,
project:
project
,
author:
user
)
do
|
issue
|
issue
.
subscriptions
.
create
(
user:
user
,
subscribed:
true
)
issue
.
subscriptions
.
create
(
user:
user
,
project:
project
,
subscribed:
true
)
end
end
end
end
...
@@ -85,7 +85,7 @@ describe SentNotificationsController, type: :controller do
...
@@ -85,7 +85,7 @@ describe SentNotificationsController, type: :controller do
context
'when the force param is not passed'
do
context
'when the force param is not passed'
do
let
(
:merge_request
)
do
let
(
:merge_request
)
do
create
(
:merge_request
,
source_project:
project
,
author:
user
)
do
|
merge_request
|
create
(
:merge_request
,
source_project:
project
,
author:
user
)
do
|
merge_request
|
merge_request
.
subscriptions
.
create
(
user:
user
,
subscribed:
true
)
merge_request
.
subscriptions
.
create
(
user:
user
,
project:
project
,
subscribed:
true
)
end
end
end
end
let
(
:sent_notification
)
{
create
(
:sent_notification
,
noteable:
merge_request
,
recipient:
user
)
}
let
(
:sent_notification
)
{
create
(
:sent_notification
,
noteable:
merge_request
,
recipient:
user
)
}
...
...
spec/models/concerns/issuable_spec.rb
View file @
091efb31
...
@@ -176,6 +176,8 @@ describe Issue, "Issuable" do
...
@@ -176,6 +176,8 @@ describe Issue, "Issuable" do
end
end
describe
'#subscribed?'
do
describe
'#subscribed?'
do
let
(
:project
)
{
issue
.
project
}
context
'user is not a participant in the issue'
do
context
'user is not a participant in the issue'
do
before
{
allow
(
issue
).
to
receive
(
:participants
).
with
(
user
).
and_return
([])
}
before
{
allow
(
issue
).
to
receive
(
:participants
).
with
(
user
).
and_return
([])
}
...
@@ -184,13 +186,13 @@ describe Issue, "Issuable" do
...
@@ -184,13 +186,13 @@ describe Issue, "Issuable" do
end
end
it
'returns true when a subcription exists and subscribed is true'
do
it
'returns true when a subcription exists and subscribed is true'
do
issue
.
subscriptions
.
create
(
user:
user
,
subscribed:
true
)
issue
.
subscriptions
.
create
(
user:
user
,
project:
project
,
subscribed:
true
)
expect
(
issue
.
subscribed?
(
user
)).
to
be_truthy
expect
(
issue
.
subscribed?
(
user
)).
to
be_truthy
end
end
it
'returns false when a subcription exists and subscribed is false'
do
it
'returns false when a subcription exists and subscribed is false'
do
issue
.
subscriptions
.
create
(
user:
user
,
subscribed:
false
)
issue
.
subscriptions
.
create
(
user:
user
,
project:
project
,
subscribed:
false
)
expect
(
issue
.
subscribed?
(
user
)).
to
be_falsey
expect
(
issue
.
subscribed?
(
user
)).
to
be_falsey
end
end
...
@@ -204,13 +206,13 @@ describe Issue, "Issuable" do
...
@@ -204,13 +206,13 @@ describe Issue, "Issuable" do
end
end
it
'returns true when a subcription exists and subscribed is true'
do
it
'returns true when a subcription exists and subscribed is true'
do
issue
.
subscriptions
.
create
(
user:
user
,
subscribed:
true
)
issue
.
subscriptions
.
create
(
user:
user
,
project:
project
,
subscribed:
true
)
expect
(
issue
.
subscribed?
(
user
)).
to
be_truthy
expect
(
issue
.
subscribed?
(
user
)).
to
be_truthy
end
end
it
'returns false when a subcription exists and subscribed is false'
do
it
'returns false when a subcription exists and subscribed is false'
do
issue
.
subscriptions
.
create
(
user:
user
,
subscribed:
false
)
issue
.
subscriptions
.
create
(
user:
user
,
project:
project
,
subscribed:
false
)
expect
(
issue
.
subscribed?
(
user
)).
to
be_falsey
expect
(
issue
.
subscribed?
(
user
)).
to
be_falsey
end
end
...
...
spec/services/issuable/bulk_update_service_spec.rb
View file @
091efb31
...
@@ -267,7 +267,7 @@ describe Issuable::BulkUpdateService, services: true do
...
@@ -267,7 +267,7 @@ describe Issuable::BulkUpdateService, services: true do
describe
'unsubscribe from issues'
do
describe
'unsubscribe from issues'
do
let
(
:issues
)
do
let
(
:issues
)
do
create_list
(
:closed_issue
,
2
,
project:
project
)
do
|
issue
|
create_list
(
:closed_issue
,
2
,
project:
project
)
do
|
issue
|
issue
.
subscriptions
.
create
(
user:
user
,
subscribed:
true
)
issue
.
subscriptions
.
create
(
user:
user
,
project:
project
,
subscribed:
true
)
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment