2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-05-27 22:25:52 +05:30
|
|
|
RSpec.describe 'Admin browse spam logs', feature_category: :shared do
|
2017-08-17 22:00:37 +05:30
|
|
|
let!(:spam_log) { create(:spam_log, description: 'abcde ' * 20) }
|
|
|
|
|
|
|
|
before do
|
2021-02-22 17:27:13 +05:30
|
|
|
admin = create(:admin)
|
|
|
|
sign_in(admin)
|
|
|
|
gitlab_enable_admin_mode_sign_in(admin)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
it 'browse spam logs' do
|
2017-08-17 22:00:37 +05:30
|
|
|
visit admin_spam_logs_path
|
|
|
|
|
|
|
|
expect(page).to have_content('Spam Logs')
|
|
|
|
expect(page).to have_content(spam_log.source_ip)
|
|
|
|
expect(page).to have_content(spam_log.noteable_type)
|
|
|
|
expect(page).to have_content('N')
|
|
|
|
expect(page).to have_content(spam_log.title)
|
|
|
|
expect(page).to have_content("#{spam_log.description[0...97]}...")
|
|
|
|
expect(page).to have_link('Remove user')
|
|
|
|
expect(page).to have_link('Block user')
|
|
|
|
end
|
2023-03-04 22:38:38 +05:30
|
|
|
|
|
|
|
it 'does not perform N+1 queries' do
|
|
|
|
control_queries = ActiveRecord::QueryRecorder.new { visit admin_spam_logs_path }
|
|
|
|
create(:spam_log)
|
|
|
|
|
|
|
|
expect { visit admin_spam_logs_path }.not_to exceed_query_limit(control_queries)
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|