2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
describe 'RavenJS' do
|
2018-10-15 14:42:47 +05:30
|
|
|
let(:raven_path) { '/raven.chunk.js' }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
it 'does not load raven if sentry is disabled' do
|
2017-08-17 22:00:37 +05:30
|
|
|
visit new_user_session_path
|
|
|
|
|
|
|
|
expect(has_requested_raven).to eq(false)
|
|
|
|
end
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
it 'loads raven if sentry is enabled' do
|
2019-09-30 21:07:59 +05:30
|
|
|
stub_sentry_settings
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
visit new_user_session_path
|
|
|
|
|
|
|
|
expect(has_requested_raven).to eq(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_requested_raven
|
2018-03-17 18:26:18 +05:30
|
|
|
page.all('script', visible: false).one? do |elm|
|
|
|
|
elm[:src] =~ /#{raven_path}$/
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|