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
8ca14f0e
Commit
8ca14f0e
authored
Sep 03, 2020
by
Arturo Herrero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce queries for service spec
parent
5e95de31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
13 deletions
+7
-13
spec/models/service_spec.rb
spec/models/service_spec.rb
+7
-13
No files found.
spec/models/service_spec.rb
View file @
8ca14f0e
...
...
@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec
.
describe
Service
do
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:project
)
{
create
(
:project
,
group:
group
)
}
describe
"Associations"
do
it
{
is_expected
.
to
belong_to
:project
}
...
...
@@ -15,8 +16,6 @@ RSpec.describe Service do
describe
'validations'
do
using
RSpec
::
Parameterized
::
TableSyntax
let
(
:project
)
{
create
(
:project
)
}
it
{
is_expected
.
to
validate_presence_of
(
:type
)
}
where
(
:project_id
,
:group_id
,
:template
,
:instance
,
:valid
)
do
...
...
@@ -145,11 +144,11 @@ RSpec.describe Service do
end
describe
"Test Button"
do
let
(
:service
)
{
build
(
:service
,
project:
project
)
}
describe
'#can_test?'
do
subject
{
service
.
can_test?
}
let
(
:service
)
{
build
(
:service
,
project:
project
)
}
context
'when repository is not empty'
do
let
(
:project
)
{
build
(
:project
,
:repository
)
}
...
...
@@ -185,7 +184,6 @@ RSpec.describe Service do
describe
'#test'
do
let
(
:data
)
{
'test'
}
let
(
:service
)
{
build
(
:service
,
project:
project
)
}
context
'when repository is not empty'
do
let
(
:project
)
{
build
(
:project
,
:repository
)
}
...
...
@@ -264,8 +262,6 @@ RSpec.describe Service do
end
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
)
...
...
@@ -453,7 +449,7 @@ RSpec.describe Service do
describe
"{property}_changed?"
do
let
(
:service
)
do
BambooService
.
create
(
project:
create
(
:project
)
,
project:
project
,
properties:
{
bamboo_url:
'http://gitlab.com'
,
username:
'mic'
,
...
...
@@ -493,7 +489,7 @@ RSpec.describe Service do
describe
"{property}_touched?"
do
let
(
:service
)
do
BambooService
.
create
(
project:
create
(
:project
)
,
project:
project
,
properties:
{
bamboo_url:
'http://gitlab.com'
,
username:
'mic'
,
...
...
@@ -533,7 +529,7 @@ RSpec.describe Service do
describe
"{property}_was"
do
let
(
:service
)
do
BambooService
.
create
(
project:
create
(
:project
)
,
project:
project
,
properties:
{
bamboo_url:
'http://gitlab.com'
,
username:
'mic'
,
...
...
@@ -573,7 +569,7 @@ RSpec.describe Service do
describe
'initialize service with no properties'
do
let
(
:service
)
do
BugzillaService
.
create
(
project:
create
(
:project
)
,
project:
project
,
project_url:
'http://gitlab.example.com'
)
end
...
...
@@ -588,7 +584,6 @@ RSpec.describe Service do
end
describe
"callbacks"
do
let
(
:project
)
{
create
(
:project
)
}
let!
(
:service
)
do
RedmineService
.
new
(
project:
project
,
...
...
@@ -655,7 +650,6 @@ RSpec.describe Service do
end
context
'logging'
do
let
(
:project
)
{
build
(
:project
)
}
let
(
:service
)
{
build
(
:service
,
project:
project
)
}
let
(
:test_message
)
{
"test message"
}
let
(
:arguments
)
do
...
...
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