Sha256: 38ff5b19584720d91676537f765381cb29ec9fde778c99db5b83350cffc008fc

Contents?: true

Size: 1.46 KB

Versions: 54

Compression:

Stored size: 1.46 KB

Contents

# A test harness for RakeHandler
#
require 'rake'
require 'rubygems'
require 'honeybadger'
require 'honeybadger/rake_handler'

Honeybadger.configure do |c|
end

# Should catch exception
task :honeybadger do
  Honeybadger.configuration.rescue_rake_exceptions = true
  stub_tty_output(true)
  raise_exception
end

# Should not catch exception
task :honeybadger_disabled do
  Honeybadger.configuration.rescue_rake_exceptions = false
  stub_tty_output(true)
  raise_exception
end

# Should not catch exception as tty_output is true
task :honeybadger_autodetect_from_terminal do
  Honeybadger.configuration.rescue_rake_exceptions = nil
  stub_tty_output(true)
  raise_exception
end

# Should catch exception as tty_output is false
task :honeybadger_autodetect_not_from_terminal do
  Honeybadger.configuration.rescue_rake_exceptions = nil
  stub_tty_output(false)
  raise_exception
end

task :honeybadger_not_yet_configured do
  Honeybadger.configuration.rescue_rake_exceptions = true
  stub_tty_output(true)
  stub_empty_sender
  raise_exception
end

module Honeybadger
  def self.notify_or_ignore(*args)
    # TODO if you need to check more params, you'll have to use json.dump or something
    $stderr.puts "honeybadger #{args[1][:component]}"
  end
end

def stub_empty_sender
  Honeybadger.sender = nil
end

def stub_tty_output(value)
  Rake.application.instance_eval do
    @tty_output_stub = value
    def tty_output?
      @tty_output_stub
    end
  end
end

def raise_exception
  raise 'TEST'
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
honeybadger-1.11.0 features/support/rake/Rakefile
honeybadger-1.10.3 features/support/rake/Rakefile
honeybadger-1.11.0.beta4 features/support/rake/Rakefile
honeybadger-1.11.0.beta3 features/support/rake/Rakefile
honeybadger-1.11.0.beta2 features/support/rake/Rakefile
honeybadger-1.10.2 features/support/rake/Rakefile
honeybadger-1.11.0.beta1 features/support/rake/Rakefile
honeybadger-1.10.1 features/support/rake/Rakefile
honeybadger-1.10.0 features/support/rake/Rakefile
honeybadger-1.9.5 features/support/rake/Rakefile
honeybadger-1.10.0.beta2 features/support/rake/Rakefile
honeybadger-1.10.0.beta1 features/support/rake/Rakefile
honeybadger-1.9.4 features/support/rake/Rakefile
honeybadger-1.9.3 features/support/rake/Rakefile
honeybadger-1.9.2 features/support/rake/Rakefile
honeybadger-1.9.1 features/support/rake/Rakefile
honeybadger-1.9.0 features/support/rake/Rakefile
honeybadger-1.9.0.beta3 features/support/rake/Rakefile
honeybadger-1.9.0.beta2 features/support/rake/Rakefile
honeybadger-1.9.0.beta1 features/support/rake/Rakefile