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
c2829d40
Commit
c2829d40
authored
Oct 29, 2020
by
Arturo Herrero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit test for service methods
This covers external_issue_tracker? and external_wiki? methods.
parent
bb96902e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
2 deletions
+30
-2
spec/models/service_spec.rb
spec/models/service_spec.rb
+30
-2
No files found.
spec/models/service_spec.rb
View file @
c2829d40
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
Service
do
RSpec
.
describe
Service
do
using
RSpec
::
Parameterized
::
TableSyntax
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:project
)
{
create
(
:project
,
group:
group
)
}
let_it_be
(
:project
)
{
create
(
:project
,
group:
group
)
}
...
@@ -15,8 +17,6 @@ RSpec.describe Service do
...
@@ -15,8 +17,6 @@ RSpec.describe Service do
end
end
describe
'validations'
do
describe
'validations'
do
using
RSpec
::
Parameterized
::
TableSyntax
it
{
is_expected
.
to
validate_presence_of
(
:type
)
}
it
{
is_expected
.
to
validate_presence_of
(
:type
)
}
where
(
:project_id
,
:group_id
,
:template
,
:instance
,
:valid
)
do
where
(
:project_id
,
:group_id
,
:template
,
:instance
,
:valid
)
do
...
@@ -863,4 +863,32 @@ RSpec.describe Service do
...
@@ -863,4 +863,32 @@ RSpec.describe Service do
end
end
end
end
end
end
describe
'#external_issue_tracker?'
do
where
(
:category
,
:active
,
:result
)
do
:issue_tracker
|
true
|
true
:issue_tracker
|
false
|
false
:common
|
true
|
false
end
with_them
do
it
'returns the right result'
do
expect
(
build
(
:service
,
category:
category
,
active:
active
).
external_issue_tracker?
).
to
eq
(
result
)
end
end
end
describe
'#external_wiki?'
do
where
(
:type
,
:active
,
:result
)
do
'ExternalWikiService'
|
true
|
true
'ExternalWikiService'
|
false
|
false
'SlackService'
|
true
|
false
end
with_them
do
it
'returns the right result'
do
expect
(
build
(
:service
,
type:
type
,
active:
active
).
external_wiki?
).
to
eq
(
result
)
end
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