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
6dc75b78
Commit
6dc75b78
authored
Jul 15, 2021
by
Rajendra Kadam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add service ping setting module
parent
a117dca9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
30 deletions
+20
-30
app/services/service_ping/permit_data_categories_service.rb
app/services/service_ping/permit_data_categories_service.rb
+1
-11
spec/services/service_ping/permit_data_categories_service_spec.rb
...vices/service_ping/permit_data_categories_service_spec.rb
+19
-19
No files found.
app/services/service_ping/permit_data_categories_service.rb
View file @
6dc75b78
...
...
@@ -14,20 +14,10 @@ module ServicePing
].
to_set
.
freeze
def
execute
return
[]
unless
product_intelligence_enabled?
return
[]
unless
ServicePingSettings
.
product_intelligence_enabled?
CATEGORIES
end
def
product_intelligence_enabled?
pings_enabled?
&&
!
User
.
single_user
&
.
requires_usage_stats_consent?
end
private
def
pings_enabled?
::
Gitlab
::
CurrentSettings
.
usage_ping_enabled?
end
end
end
...
...
spec/services/service_ping/permit_data_categories_service_spec.rb
View file @
6dc75b78
...
...
@@ -42,26 +42,26 @@ RSpec.describe ServicePing::PermitDataCategoriesService do
end
end
describe
'#product_intelligence_enabled?'
do
where
(
:usage_ping_enabled
,
:requires_usage_stats_consent
,
:expected_product_intelligence_enabled
)
do
# Usage ping enabled
true
|
false
|
true
true
|
true
|
false
#
describe '#product_intelligence_enabled?' do
#
where(:usage_ping_enabled, :requires_usage_stats_consent, :expected_product_intelligence_enabled) do
#
# Usage ping enabled
#
true | false | true
#
true | true | false
# Usage ping disabled
false
|
false
|
false
false
|
true
|
false
end
#
# Usage ping disabled
#
false | false | false
#
false | true | false
#
end
with_them
do
before
do
allow
(
User
).
to
receive
(
:single_user
).
and_return
(
double
(
:user
,
requires_usage_stats_consent?:
requires_usage_stats_consent
))
stub_config_setting
(
usage_ping_enabled:
usage_ping_enabled
)
end
#
with_them do
#
before do
#
allow(User).to receive(:single_user).and_return(double(:user, requires_usage_stats_consent?: requires_usage_stats_consent))
#
stub_config_setting(usage_ping_enabled: usage_ping_enabled)
#
end
it
'has the correct product_intelligence_enabled?'
do
expect
(
described_class
.
new
.
product_intelligence_enabled?
).
to
eq
(
expected_product_intelligence_enabled
)
end
end
end
#
it 'has the correct product_intelligence_enabled?' do
#
expect(described_class.new.product_intelligence_enabled?).to eq(expected_product_intelligence_enabled)
#
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