Sha256: ac6087e88debb31c062aa3aff4ba369ec7dfcd09d0c0b083bdefbb0cdd4f2ac3

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

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

Airbrake.configure do |c|
end

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

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

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

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

task :airbrake_not_yet_configured do
  Airbrake.configuration.rescue_rake_exceptions = true
  stub_tty_output(true)
  stub_empty_sender
  raise_exception
end

module Airbrake
  def self.notify_or_ignore(*args)
    $stderr.puts "[airbrake] #{args[1][:component]}"
  end
end

def stub_empty_sender
  Airbrake.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

6 entries across 6 versions & 1 rubygems

Version Path
airbrake-3.1.12 features/support/rake/Rakefile
airbrake-3.1.11 features/support/rake/Rakefile
airbrake-3.1.10 features/support/rake/Rakefile
airbrake-3.1.9 features/support/rake/Rakefile
airbrake-3.1.8 features/support/rake/Rakefile
airbrake-3.1.7 features/support/rake/Rakefile