2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-10-09 18:40:58 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
describe 'RavenJS' do
|
2018-05-03 16:24:18 -04:00
|
|
|
let(:raven_path) { '/raven.chunk.js' }
|
2016-10-09 18:40:58 -04:00
|
|
|
|
2019-04-05 04:43:27 -04:00
|
|
|
it 'does not load raven if sentry is disabled' do
|
2016-10-09 18:40:58 -04:00
|
|
|
visit new_user_session_path
|
|
|
|
|
|
|
|
expect(has_requested_raven).to eq(false)
|
|
|
|
end
|
|
|
|
|
2019-04-05 04:43:27 -04:00
|
|
|
it 'loads raven if sentry is enabled' do
|
2019-04-30 16:06:08 -04:00
|
|
|
stub_sentry_settings
|
2016-10-09 18:40:58 -04:00
|
|
|
|
|
|
|
visit new_user_session_path
|
|
|
|
|
|
|
|
expect(has_requested_raven).to eq(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_requested_raven
|
2017-10-29 09:04:49 -04:00
|
|
|
page.all('script', visible: false).one? do |elm|
|
2017-10-26 14:10:11 -04:00
|
|
|
elm[:src] =~ /#{raven_path}$/
|
|
|
|
end
|
2016-10-09 18:40:58 -04:00
|
|
|
end
|
|
|
|
end
|