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
20c98dec
Commit
20c98dec
authored
Sep 10, 2019
by
Peter Leitzen
Committed by
Rémy Coutable
Sep 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify specs for Project#disabled_services
parent
f901b03e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
42 deletions
+12
-42
ee/spec/models/project_spec.rb
ee/spec/models/project_spec.rb
+12
-42
No files found.
ee/spec/models/project_spec.rb
View file @
20c98dec
...
...
@@ -962,61 +962,31 @@ describe Project do
end
end
shared_examples
'project with disabled services'
do
it
'has some disabled services'
do
stub_const
(
'License::ANY_PLAN_FEATURES'
,
[])
expect
(
project
.
disabled_services
).
to
match_array
(
disabled_services
)
end
end
shared_examples
'project without disabled services'
do
it
'has some disabled services'
do
expect
(
project
.
disabled_services
).
to
be_empty
end
end
describe
'#disabled_services'
do
let
(
:namespace
)
{
create
(
:group
,
:private
)
}
let
(
:project
)
{
create
(
:project
,
:private
,
namespace:
namespace
)
}
let
(
:disabled_services
)
{
%w(jenkins jenkins_deprecated github)
}
let
(
:project
)
{
build
(
:project
)
}
context
'without a license key'
do
before
do
License
.
destroy_all
# rubocop: disable DestroyAll
end
subject
{
project
.
disabled_services
}
it_behaves_like
'project with disabled services'
where
(
:license_feature
,
:disabled_services
)
do
:jenkins_integration
|
%w(jenkins jenkins_deprecated)
:github_project_service_integration
|
%w(github)
end
context
'with a license key'
do
before
do
allow_any_instance_of
(
License
).
to
receive
(
:plan
).
and_return
(
License
::
PREMIUM_PLAN
)
end
context
'when checking of namespace plan is enabled'
do
with_them
do
context
'when feature is available'
do
before
do
stub_
application_setting_on_object
(
project
,
should_check_namespace_plan:
true
)
stub_
licensed_features
(
license_feature
=>
true
)
end
context
'and namespace does not have a plan'
do
it_behaves_like
'project with disabled services'
end
context
'and namespace has a plan'
do
let
(
:namespace
)
{
create
(
:group
,
:private
,
plan: :silver_plan
)
}
let!
(
:gitlab_subscription
)
{
create
(
:gitlab_subscription
,
:silver
,
namespace:
namespace
)
}
it_behaves_like
'project without disabled services'
end
it
{
is_expected
.
not_to
include
(
*
disabled_services
)
}
end
context
'when
checking of namespace plan is not enabled
'
do
context
'when
feature is unavailable
'
do
before
do
stub_
application_setting_on_object
(
project
,
should_check_namespace_plan:
false
)
stub_
licensed_features
(
license_feature
=>
false
)
end
it
_behaves_like
'project without disabled services'
it
{
is_expected
.
to
include
(
*
disabled_services
)
}
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