2019-12-26 22:10:19 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Sentry' do
|
|
|
|
let(:sentry_regex_path) { '\/sentry.*\.chunk\.js' }
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
it 'does not load sentry if sentry is disabled' do
|
|
|
|
allow(Gitlab.config.sentry).to receive(:enabled).and_return(false)
|
|
|
|
visit new_user_session_path
|
|
|
|
|
|
|
|
expect(has_requested_sentry).to eq(false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'loads sentry if sentry is enabled' do
|
|
|
|
stub_sentry_settings
|
|
|
|
|
|
|
|
visit new_user_session_path
|
|
|
|
|
|
|
|
expect(has_requested_sentry).to eq(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_requested_sentry
|
|
|
|
page.all('script', visible: false).one? do |elm|
|
2020-06-23 00:09:42 +05:30
|
|
|
elm[:src] =~ /#{sentry_regex_path}$/
|
2019-12-26 22:10:19 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|