Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api/usage_data_spec.rb')
-rw-r--r--spec/requests/api/usage_data_spec.rb24
1 files changed, 5 insertions, 19 deletions
diff --git a/spec/requests/api/usage_data_spec.rb b/spec/requests/api/usage_data_spec.rb
index aefccc4fbf7..ea50c404d92 100644
--- a/spec/requests/api/usage_data_spec.rb
+++ b/spec/requests/api/usage_data_spec.rb
@@ -7,9 +7,7 @@ RSpec.describe API::UsageData do
describe 'POST /usage_data/increment_counter' do
let(:endpoint) { '/usage_data/increment_counter' }
- let(:known_event) { "#{known_event_prefix}_#{known_event_postfix}" }
- let(:known_event_prefix) { "static_site_editor" }
- let(:known_event_postfix) { 'commits' }
+ let(:known_event) { "diff_searches" }
let(:unknown_event) { 'unknown' }
context 'without CSRF token' do
@@ -44,7 +42,6 @@ RSpec.describe API::UsageData do
context 'with authentication' do
before do
stub_feature_flags(usage_data_api: true)
- stub_feature_flags("usage_data_#{known_event}" => true)
stub_application_setting(usage_ping_enabled: true)
allow(Gitlab::RequestForgeryProtection).to receive(:verified?).and_return(true)
end
@@ -58,28 +55,18 @@ RSpec.describe API::UsageData do
end
context 'with correct params' do
- using RSpec::Parameterized::TableSyntax
-
- where(:prefix, :event) do
- 'static_site_editor' | 'merge_requests'
- 'static_site_editor' | 'commits'
- end
-
before do
stub_application_setting(usage_ping_enabled: true)
stub_feature_flags(usage_data_api: true)
allow(Gitlab::RequestForgeryProtection).to receive(:verified?).and_return(true)
- stub_feature_flags("usage_data_#{prefix}_#{event}" => true)
end
- with_them do
- it 'returns status :ok' do
- expect(Gitlab::UsageDataCounters::BaseCounter).to receive(:count).with(event)
+ it 'returns status :ok' do
+ expect(Gitlab::UsageDataCounters::BaseCounter).to receive(:count).with("searches")
- post api(endpoint, user), params: { event: "#{prefix}_#{event}" }
+ post api(endpoint, user), params: { event: known_event }
- expect(response).to have_gitlab_http_status(:ok)
- end
+ expect(response).to have_gitlab_http_status(:ok)
end
end
@@ -137,7 +124,6 @@ RSpec.describe API::UsageData do
context 'with authentication' do
before do
stub_feature_flags(usage_data_api: true)
- stub_feature_flags("usage_data_#{known_event}" => true)
stub_application_setting(usage_ping_enabled: true)
allow(Gitlab::RequestForgeryProtection).to receive(:verified?).and_return(true)
end