Skip to content
Snippets Groups Projects
Commit 3ab6e0e2 authored by Mayra Cabrera's avatar Mayra Cabrera
Browse files

Merge branch 'am-use-other-redis-event-in-test' into 'master'

Remove usage of static_site_editor events in tests

See merge request gitlab-org/gitlab!87399
parents 01f04fa0 af172356
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
Loading
@@ -57,27 +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)
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
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment