summaryrefslogtreecommitdiff
path: root/spec/features/raven_js_spec.rb
blob: 38699f0cc1b521288f3b480a0d280df4b74079c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

require 'spec_helper'

describe 'RavenJS' do
  let(:raven_path) { '/raven.chunk.js' }

  it 'does not load raven if sentry is disabled' do
    visit new_user_session_path

    expect(has_requested_raven).to eq(false)
  end

  it 'loads raven if sentry is enabled' do
    stub_sentry_settings

    visit new_user_session_path

    expect(has_requested_raven).to eq(true)
  end

  def has_requested_raven
    page.all('script', visible: false).one? do |elm|
      elm[:src] =~ /#{raven_path}$/
    end
  end
end