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
3e4d0c3a
Commit
3e4d0c3a
authored
May 22, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce CE/EE diff in spec/controllers/projects/settings/integrations_controller_spec.rb
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
6668669d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
75 deletions
+86
-75
ee/spec/controllers/projects/settings/integrations_controller_spec.rb
...rollers/projects/settings/integrations_controller_spec.rb
+86
-0
spec/controllers/projects/settings/integrations_controller_spec.rb
...rollers/projects/settings/integrations_controller_spec.rb
+0
-75
No files found.
ee/spec/controllers/projects/settings/integrations_controller_spec.rb
0 → 100644
View file @
3e4d0c3a
require
'spec_helper'
describe
Projects
::
Settings
::
IntegrationsController
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_master
(
user
)
sign_in
(
user
)
end
shared_examples
'endpoint with some disabled services'
do
it
'has some disabled services'
do
get
:show
,
namespace_id:
project
.
namespace
,
project_id:
project
expect
(
active_services
).
not_to
include
(
*
disabled_services
)
end
end
shared_examples
'endpoint without disabled services'
do
it
'does not have disabled services'
do
get
:show
,
namespace_id:
project
.
namespace
,
project_id:
project
expect
(
active_services
).
to
include
(
*
disabled_services
)
end
end
context
'Sets correct services list'
do
let
(
:active_services
)
{
assigns
(
:services
).
map
(
&
:type
)
}
let
(
:disabled_services
)
{
%w(JenkinsService JenkinsDeprecatedService)
}
it
'enables SlackSlashCommandsService and disables GitlabSlackApplication'
do
get
:show
,
namespace_id:
project
.
namespace
,
project_id:
project
expect
(
active_services
).
to
include
(
'SlackSlashCommandsService'
)
expect
(
active_services
).
not_to
include
(
'GitlabSlackApplicationService'
)
end
it
'enables GitlabSlackApplication and disables SlackSlashCommandsService'
do
stub_application_setting
(
slack_app_enabled:
true
)
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
get
:show
,
namespace_id:
project
.
namespace
,
project_id:
project
expect
(
active_services
).
to
include
(
'GitlabSlackApplicationService'
)
expect
(
active_services
).
not_to
include
(
'SlackSlashCommandsService'
)
end
context
'without a license key'
do
before
do
License
.
destroy_all
end
it_behaves_like
'endpoint with some disabled services'
end
context
'with a license key'
do
let
(
:namespace
)
{
create
(
:group
,
:private
)
}
let
(
:project
)
{
create
(
:project
,
:private
,
namespace:
namespace
)
}
context
'when checking of namespace plan is enabled'
do
before
do
allow
(
Gitlab
::
CurrentSettings
.
current_application_settings
).
to
receive
(
:should_check_namespace_plan?
)
{
true
}
end
context
'and namespace does not have a plan'
do
it_behaves_like
'endpoint with some disabled services'
end
context
'and namespace has a plan'
do
let
(
:namespace
)
{
create
(
:group
,
:private
,
plan: :bronze_plan
)
}
it_behaves_like
'endpoint without disabled services'
end
end
context
'when checking of namespace plan is not enabled'
do
before
do
allow
(
Gitlab
::
CurrentSettings
.
current_application_settings
).
to
receive
(
:should_check_namespace_plan?
)
{
false
}
end
it_behaves_like
'endpoint without disabled services'
end
end
end
end
spec/controllers/projects/settings/integrations_controller_spec.rb
View file @
3e4d0c3a
...
...
@@ -17,79 +17,4 @@ describe Projects::Settings::IntegrationsController do
expect
(
response
).
to
render_template
(
:show
)
end
end
shared_examples
'endpoint with some disabled services'
do
it
'has some disabled services'
do
get
:show
,
namespace_id:
project
.
namespace
,
project_id:
project
expect
(
active_services
).
not_to
include
(
*
disabled_services
)
end
end
shared_examples
'endpoint without disabled services'
do
it
'does not have disabled services'
do
get
:show
,
namespace_id:
project
.
namespace
,
project_id:
project
expect
(
active_services
).
to
include
(
*
disabled_services
)
end
end
context
'Sets correct services list'
do
let
(
:active_services
)
{
assigns
(
:services
).
map
(
&
:type
)
}
let
(
:disabled_services
)
{
%w(JenkinsService JenkinsDeprecatedService)
}
it
'enables SlackSlashCommandsService and disables GitlabSlackApplication'
do
get
:show
,
namespace_id:
project
.
namespace
,
project_id:
project
expect
(
active_services
).
to
include
(
'SlackSlashCommandsService'
)
expect
(
active_services
).
not_to
include
(
'GitlabSlackApplicationService'
)
end
it
'enables GitlabSlackApplication and disables SlackSlashCommandsService'
do
stub_application_setting
(
slack_app_enabled:
true
)
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
get
:show
,
namespace_id:
project
.
namespace
,
project_id:
project
expect
(
active_services
).
to
include
(
'GitlabSlackApplicationService'
)
expect
(
active_services
).
not_to
include
(
'SlackSlashCommandsService'
)
end
context
'without a license key'
do
before
do
License
.
destroy_all
end
it_behaves_like
'endpoint with some disabled services'
end
context
'with a license key'
do
let
(
:namespace
)
{
create
(
:group
,
:private
)
}
let
(
:project
)
{
create
(
:project
,
:private
,
namespace:
namespace
)
}
context
'when checking of namespace plan is enabled'
do
before
do
allow
(
Gitlab
::
CurrentSettings
.
current_application_settings
).
to
receive
(
:should_check_namespace_plan?
)
{
true
}
end
context
'and namespace does not have a plan'
do
it_behaves_like
'endpoint with some disabled services'
end
context
'and namespace has a plan'
do
let
(
:namespace
)
{
create
(
:group
,
:private
,
plan: :bronze_plan
)
}
it_behaves_like
'endpoint without disabled services'
end
end
context
'when checking of namespace plan is not enabled'
do
before
do
allow
(
Gitlab
::
CurrentSettings
.
current_application_settings
).
to
receive
(
:should_check_namespace_plan?
)
{
false
}
end
it_behaves_like
'endpoint without disabled services'
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