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.rb26
1 files changed, 20 insertions, 6 deletions
diff --git a/spec/requests/api/usage_data_spec.rb b/spec/requests/api/usage_data_spec.rb
index bacaf960e6a..aefccc4fbf7 100644
--- a/spec/requests/api/usage_data_spec.rb
+++ b/spec/requests/api/usage_data_spec.rb
@@ -57,13 +57,26 @@ RSpec.describe API::UsageData do
end
end
- %w[merge_requests commits].each do |postfix|
- context 'with correct params' do
- let(:known_event_postfix) { postfix }
+ 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(known_event_postfix)
- post api(endpoint, user), params: { event: known_event }
+ post api(endpoint, user), params: { event: "#{prefix}_#{event}" }
expect(response).to have_gitlab_http_status(:ok)
end
@@ -73,6 +86,7 @@ RSpec.describe API::UsageData do
context 'with unknown event' do
before do
skip_feature_flags_yaml_validation
+ skip_default_enabled_yaml_check
end
it 'returns status ok' do