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-05-18 00:54:41 +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-05-18 00:54:41 +05:30
|
|
|
it 'loads raven if sentry is enabled' do
|
2017-08-17 22:00:37 +05:30
|
|
|
stub_application_setting(clientside_sentry_dsn: 'https://key@domain.com/id', clientside_sentry_enabled: true)
|
|
|
|
|
|
|
|
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
|