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
Show 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
...
@@ -9,7 +9,7 @@ class ZoomNotesService
end
end
def
execute
def
execute
return
if
@issue
.
zoom_meetings
==
@zoom_meetings
return
if
@issue
.
zoom_meetings
==
@
old_
zoom_meetings
if
zoom_link_added?
if
zoom_link_added?
zoom_link_added_notification
zoom_link_added_notification
...
@@ -21,7 +21,10 @@ class ZoomNotesService
...
@@ -21,7 +21,10 @@ class ZoomNotesService
private
private
def
zoom_link_added?
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
end
def
zoom_link_added_notification
def
zoom_link_added_notification
...
...
spec/helpers/issuables_helper_spec.rb
View file @
83f47163
...
@@ -230,7 +230,9 @@ describe IssuablesHelper do
...
@@ -230,7 +230,9 @@ describe IssuablesHelper do
end
end
context
'with "added" zoom meeting'
do
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
shared_examples
'sets zoomMeetingUrl to canonical meeting url'
do
specify
do
specify
do
...
...
spec/services/issues/update_service_spec.rb
View file @
83f47163
...
@@ -226,14 +226,19 @@ describe Issues::UpdateService, :mailer do
...
@@ -226,14 +226,19 @@ describe Issues::UpdateService, :mailer do
end
end
end
end
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
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'
)
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
).
not_to
be_nil
expect
(
note
.
note
).
to
eq
(
'added a Zoom call to this issue'
)
expect
(
note
.
note
).
to
eq
(
'added a Zoom call to this issue'
)
end
end
end
context
'when issue turns confidential'
do
context
'when issue turns confidential'
do
let
(
:opts
)
do
let
(
:opts
)
do
...
...
spec/services/zoom_notes_service_spec.rb
View file @
83f47163
...
@@ -4,13 +4,15 @@ require 'spec_helper'
...
@@ -4,13 +4,15 @@ require 'spec_helper'
describe
ZoomNotesService
do
describe
ZoomNotesService
do
describe
'#execute'
do
describe
'#execute'
do
let
(
:issue
)
{
OpenStruct
.
new
(
description:
description
)
}
let
(
:issue
)
{
OpenStruct
.
new
(
zoom_meetings:
zoom_meetings
)
}
let
(
:project
)
{
Object
.
new
}
let
(
:project
)
{
Object
.
new
}
let
(
:user
)
{
Object
.
new
}
let
(
:user
)
{
Object
.
new
}
let
(
:description
)
{
'an issue description'
}
let
(
:added_zoom_meeting
)
{
OpenStruct
.
new
(
issue_status:
ZoomMeeting
.
issue_statuses
[
:added
])
}
let
(
:old_description
)
{
nil
}
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
shared_examples
'no notifications'
do
it
"doesn't create notifications"
do
it
"doesn't create notifications"
do
...
@@ -21,30 +23,23 @@ describe ZoomNotesService do
...
@@ -21,30 +23,23 @@ describe ZoomNotesService do
end
end
end
end
it_behaves_like
'no notifications'
context
'when zoom_meetings == old_zoom_meetings'
do
context
'when both are empty'
do
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'
it_behaves_like
'no notifications'
end
end
context
"when the zoom link doesn't exist in both description and old_description"
do
context
'when both are removed'
do
let
(
:description
)
{
'a changed issue description'
}
let
(
:old_zoom_meetings
)
{
[
removed_zoom_meeting
]
}
let
(
:old_description
)
{
'an issue description'
}
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
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
it
'creates a zoom_link_added notification'
do
expect
(
SystemNoteService
).
to
receive
(
:zoom_link_added
).
with
(
issue
,
project
,
user
)
expect
(
SystemNoteService
).
to
receive
(
:zoom_link_added
).
with
(
issue
,
project
,
user
)
...
@@ -54,9 +49,9 @@ describe ZoomNotesService do
...
@@ -54,9 +49,9 @@ describe ZoomNotesService do
end
end
end
end
context
'when the zoom link has been added
to the description
'
do
context
'when the zoom link has been added'
do
let
(
:
description
)
{
'a changed issue description https://zoom.us/j/123'
}
let
(
:
old_zoom_meetings
)
{
[
removed_zoom_meeting
]
}
let
(
:
old_description
)
{
'an issue description'
}
let
(
:
zoom_meetings
)
{
[
removed_zoom_meeting
,
added_zoom_meeting
]
}
it
'creates a zoom_link_added notification'
do
it
'creates a zoom_link_added notification'
do
expect
(
SystemNoteService
).
to
receive
(
:zoom_link_added
).
with
(
issue
,
project
,
user
)
expect
(
SystemNoteService
).
to
receive
(
:zoom_link_added
).
with
(
issue
,
project
,
user
)
...
@@ -66,9 +61,9 @@ describe ZoomNotesService do
...
@@ -66,9 +61,9 @@ describe ZoomNotesService do
end
end
end
end
context
'when the zoom link has been removed from
the description
'
do
context
'when the zoom link has been removed from
zoom_meetings
'
do
let
(
:
description
)
{
'a changed issue description'
}
let
(
:
old_zoom_meetings
)
{
[
added_zoom_meeting
]
}
let
(
:
old_description
)
{
'an issue description https://zoom.us/j/123'
}
let
(
:
zoom_meetings
)
{
[
removed_zoom_meeting
]
}
it
'creates a zoom_link_removed notification'
do
it
'creates a zoom_link_removed notification'
do
expect
(
SystemNoteService
).
not_to
receive
(
:zoom_link_added
).
with
(
issue
,
project
,
user
)
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