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
413455ca
Commit
413455ca
authored
Mar 23, 2020
by
Arturo Herrero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract shared examples for service templates
parent
7204ffea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
13 deletions
+11
-13
spec/models/service_spec.rb
spec/models/service_spec.rb
+11
-13
No files found.
spec/models/service_spec.rb
View file @
413455ca
...
...
@@ -152,14 +152,18 @@ describe Service do
describe
'template'
do
let
(
:project
)
{
create
(
:project
)
}
shared_examples
'retrieves service templates'
do
it
'returns the available service templates'
do
expect
(
Service
.
find_or_create_templates
.
pluck
(
:type
)).
to
match_array
(
Service
.
available_services_types
)
end
end
describe
'.find_or_create_templates'
do
it
'creates service templates'
do
expect
{
Service
.
find_or_create_templates
}.
to
change
{
Service
.
count
}.
from
(
0
).
to
(
Service
.
available_services_names
.
size
)
end
it
'returns the available service templates'
do
expect
(
Service
.
find_or_create_templates
.
map
(
&
:type
)).
to
match_array
(
Service
.
available_services_types
)
end
it_behaves_like
'retrieves service templates'
context
'with all existing templates'
do
before
do
...
...
@@ -172,9 +176,7 @@ describe Service do
expect
{
Service
.
find_or_create_templates
}.
to
change
{
Service
.
count
}.
by
(
0
)
end
it
'returns the available service templates'
do
expect
(
Service
.
find_or_create_templates
.
map
(
&
:type
)).
to
match_array
(
Service
.
available_services_types
)
end
it_behaves_like
'retrieves service templates'
context
'with a previous existing service (Previous) and a new service (Asana)'
do
before
do
...
...
@@ -182,24 +184,20 @@ describe Service do
Service
.
delete_by
(
type:
'AsanaService'
,
template:
true
)
end
it
'returns the available service templates'
do
expect
(
Service
.
find_or_create_templates
.
map
(
&
:type
)).
to
match_array
(
Service
.
available_services_types
)
end
it_behaves_like
'retrieves service templates'
end
end
context
'with a few existing templates'
do
before
do
JiraService
.
create
(
template:
tru
e
)
create
(
:jira_service
,
:templat
e
)
end
it
'creates the rest of the service templates'
do
expect
{
Service
.
find_or_create_templates
}.
to
change
{
Service
.
count
}.
from
(
1
).
to
(
Service
.
available_services_names
.
size
)
end
it
'returns the available service templates'
do
expect
(
Service
.
find_or_create_templates
.
map
(
&
:type
)).
to
match_array
(
Service
.
available_services_types
)
end
it_behaves_like
'retrieves service templates'
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