Module: RollbarTest

Defined in:
lib/rollbar/rollbar_test.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.confirmed_token?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
23
# File 'lib/rollbar/rollbar_test.rb', line 17

def self.confirmed_token?
  return true if Rollbar.configuration.access_token

  puts token_error_message

  false
end

.error_messageObject



29
30
31
32
33
# File 'lib/rollbar/rollbar_test.rb', line 29

def self.error_message
  'Test failed! You may have a configuration issue, or you could be using a ' \
  'gem that\'s blocking the test. Contact [email protected] if you need ' \
  'help troubleshooting.'
end

.runObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/rollbar/rollbar_test.rb', line 4

def self.run
  return unless confirmed_token?

  puts 'Test sending to Rollbar...'
  result = Rollbar.info('Test message from rollbar:test')

  if result == 'error'
    puts error_message
  else
    puts success_message
  end
end

.success_messageObject



35
36
37
# File 'lib/rollbar/rollbar_test.rb', line 35

def self.success_message
  'Testing rollbar with "rake rollbar:test". If you can see this, it works.'
end

.token_error_messageObject



25
26
27
# File 'lib/rollbar/rollbar_test.rb', line 25

def self.token_error_message
  'Rollbar needs an access token configured. Check the README for instructions.'
end