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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
83f47163
Commit
83f47163
authored
Oct 21, 2019
by
allison.browne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update specs from zoom notes service
parent
56403b97
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
37 deletions
+42
-37
app/services/zoom_notes_service.rb
app/services/zoom_notes_service.rb
+5
-2
spec/helpers/issuables_helper_spec.rb
spec/helpers/issuables_helper_spec.rb
+3
-1
spec/services/issues/update_service_spec.rb
spec/services/issues/update_service_spec.rb
+10
-5
spec/services/zoom_notes_service_spec.rb
spec/services/zoom_notes_service_spec.rb
+24
-29
No files found.
app/services/zoom_notes_service.rb
View file @
83f47163
...
...
@@ -9,7 +9,7 @@ class ZoomNotesService
end
def
execute
return
if
@issue
.
zoom_meetings
==
@zoom_meetings
return
if
@issue
.
zoom_meetings
==
@
old_
zoom_meetings
if
zoom_link_added?
zoom_link_added_notification
...
...
@@ -21,7 +21,10 @@ class ZoomNotesService
private
def
zoom_link_added?
ZoomMeeting
.
canonical_meeting_url
(
@issue
)
meetings
=
@issue
.
zoom_meetings
.
select
do
|
z
|
z
.
issue_status
==
ZoomMeeting
.
issue_statuses
[
:added
]
end
!
meetings
.
empty?
end
def
zoom_link_added_notification
...
...
spec/helpers/issuables_helper_spec.rb
View file @
83f47163
...
...
@@ -230,7 +230,9 @@ describe IssuablesHelper do
end
context
'with "added" zoom meeting'
do
before
{
create
(
:zoom_meeting
,
issue:
issue
)
}
before
do
create
(
:zoom_meeting
,
issue:
issue
)
end
shared_examples
'sets zoomMeetingUrl to canonical meeting url'
do
specify
do
...
...
spec/services/issues/update_service_spec.rb
View file @
83f47163
...
...
@@ -226,13 +226,18 @@ describe Issues::UpdateService, :mailer do
end
end
it
'creates zoom_link_added system note when a zoom link is added to the description'
do
update_issue
(
description:
'Changed description https://zoom.us/j/5873603787'
)
context
'blah'
do
before
do
let
(
:zoom_meeting
)
{
create
(
:zoom_meeting
,
issue:
issue
)
}
end
it
'creates zoom_link_added system note when a zoom link is added to the description'
do
update_issue
(
zoom_meetings:
[
zoom_meeting
])
note
=
find_note
(
'added a Zoom call'
)
note
=
find_note
(
'added a Zoom call'
)
expect
(
note
).
not_to
be_nil
expect
(
note
.
note
).
to
eq
(
'added a Zoom call to this issue'
)
expect
(
note
).
not_to
be_nil
expect
(
note
.
note
).
to
eq
(
'added a Zoom call to this issue'
)
end
end
context
'when issue turns confidential'
do
...
...
spec/services/zoom_notes_service_spec.rb
View file @
83f47163
...
...
@@ -4,13 +4,15 @@ require 'spec_helper'
describe
ZoomNotesService
do
describe
'#execute'
do
let
(
:issue
)
{
OpenStruct
.
new
(
description:
description
)
}
let
(
:issue
)
{
OpenStruct
.
new
(
zoom_meetings:
zoom_meetings
)
}
let
(
:project
)
{
Object
.
new
}
let
(
:user
)
{
Object
.
new
}
let
(
:description
)
{
'an issue description'
}
let
(
:old_description
)
{
nil
}
let
(
:added_zoom_meeting
)
{
OpenStruct
.
new
(
issue_status:
ZoomMeeting
.
issue_statuses
[
:added
])
}
let
(
:removed_zoom_meeting
)
{
OpenStruct
.
new
(
issue_status:
ZoomMeeting
.
issue_statuses
[
:removed
])
}
let
(
:old_zoom_meetings
)
{
[]
}
let
(
:zoom_meetings
)
{
[]
}
subject
{
described_class
.
new
(
issue
,
project
,
user
,
old_
description:
old_description
)
}
subject
{
described_class
.
new
(
issue
,
project
,
user
,
old_
zoom_meetings:
old_zoom_meetings
)
}
shared_examples
'no notifications'
do
it
"doesn't create notifications"
do
...
...
@@ -21,30 +23,23 @@ describe ZoomNotesService do
end
end
it_behaves_like
'no notifications'
context
'when the zoom link exists in both description and old_description'
do
let
(
:description
)
{
'a changed issue description https://zoom.us/j/123'
}
let
(
:old_description
)
{
'an issue description https://zoom.us/j/123'
}
it_behaves_like
'no notifications'
end
context
'when zoom_meetings == old_zoom_meetings'
do
context
'when both are empty'
do
it_behaves_like
'no notifications'
end
context
"when the zoom link doesn't exist in both description and old_description"
do
let
(
:description
)
{
'a changed issue description'
}
let
(
:old_description
)
{
'an issue description'
}
context
'when both are removed'
do
let
(
:old_zoom_meetings
)
{
[
removed_zoom_meeting
]
}
let
(
:zoom_meetings
)
{
old_zoom_meetings
}
it_behaves_like
'no notifications'
it_behaves_like
'no notifications'
end
end
context
'when description == old_description'
do
let
(
:old_description
)
{
'an issue description'
}
it_behaves_like
'no notifications'
end
context
'when the description contains a zoom link and old_description is nil'
do
let
(
:description
)
{
'a changed issue description https://zoom.us/j/123'
}
context
'when old_zoom_meetings is empty and zoom_meetings contains an added zoom_meeting'
do
let
(
:old_zoom_meetings
)
{
[]
}
let
(
:zoom_meetings
)
{
[
added_zoom_meeting
]
}
it
'creates a zoom_link_added notification'
do
expect
(
SystemNoteService
).
to
receive
(
:zoom_link_added
).
with
(
issue
,
project
,
user
)
...
...
@@ -54,9 +49,9 @@ describe ZoomNotesService do
end
end
context
'when the zoom link has been added
to the description
'
do
let
(
:
description
)
{
'a changed issue description https://zoom.us/j/123'
}
let
(
:
old_description
)
{
'an issue description'
}
context
'when the zoom link has been added'
do
let
(
:
old_zoom_meetings
)
{
[
removed_zoom_meeting
]
}
let
(
:
zoom_meetings
)
{
[
removed_zoom_meeting
,
added_zoom_meeting
]
}
it
'creates a zoom_link_added notification'
do
expect
(
SystemNoteService
).
to
receive
(
:zoom_link_added
).
with
(
issue
,
project
,
user
)
...
...
@@ -66,9 +61,9 @@ describe ZoomNotesService do
end
end
context
'when the zoom link has been removed from
the description
'
do
let
(
:
description
)
{
'a changed issue description'
}
let
(
:
old_description
)
{
'an issue description https://zoom.us/j/123'
}
context
'when the zoom link has been removed from
zoom_meetings
'
do
let
(
:
old_zoom_meetings
)
{
[
added_zoom_meeting
]
}
let
(
:
zoom_meetings
)
{
[
removed_zoom_meeting
]
}
it
'creates a zoom_link_removed notification'
do
expect
(
SystemNoteService
).
not_to
receive
(
:zoom_link_added
).
with
(
issue
,
project
,
user
)
...
...
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