summaryrefslogtreecommitdiff
path: root/spec/helpers/sentry_helper_spec.rb
blob: ff218235cd1d374dcbf80c9c5f48cd85da1c7ee9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'spec_helper'

describe SentryHelper do
  describe '#sentry_dsn_public' do
    it 'returns nil if no sentry_dsn is set' do
      mock_sentry_dsn(nil)

      expect(helper.sentry_dsn_public).to eq nil
    end

    it 'returns the uri string with no password if sentry_dsn is set' do
      mock_sentry_dsn('https://test:dsn@host/path')

      expect(helper.sentry_dsn_public).to eq 'https://test@host/path'
    end
  end

  def mock_sentry_dsn(value)
    allow_message_expectations_on_nil
    allow(ApplicationSetting.current).to receive(:sentry_dsn).and_return(value)
  end
end