raven_js_spec.rb 607 Bytes
Newer Older
1 2
require 'spec_helper'

3
feature 'RavenJS' do
4
  let(:raven_path) { '/raven.bundle.js' }
5 6 7 8 9 10 11 12

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

    expect(has_requested_raven).to eq(false)
  end

  it 'should load raven if sentry is enabled' do
Luke Bennett's avatar
Luke Bennett committed
13
    stub_application_setting(clientside_sentry_dsn: 'https://key@domain.com/id', clientside_sentry_enabled: true)
14 15 16 17 18 19 20

    visit new_user_session_path

    expect(has_requested_raven).to eq(true)
  end

  def has_requested_raven
Mike Greiling's avatar
Mike Greiling committed
21
    page.all('script', visible: false).one? do |elm|
22 23
      elm[:src] =~ /#{raven_path}$/
    end
24 25
  end
end