Sha256: 6ea7fcb2e19bfa42946d6af27201c29c19b9f8036286592116d487f88399472f

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

# -------------------------------------------
# To run the application: ruby examples/sample_app.rb
# -------------------------------------------

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'

  gem 'rails', '5.0.0'
  gem 'exception_notification', '4.3.0'
  gem 'httparty', '0.15.7'
end

class SampleApp < Rails::Application
  config.middleware.use ExceptionNotification::Rack,
                        webhook: {
                          url: 'http://example.com'
                        }

  config.secret_key_base = 'my secret key base'

  Rails.logger = Logger.new($stdout)

  routes.draw do
    get '/', to: 'exceptions#index'
  end
end

require 'action_controller/railtie'

class ExceptionsController < ActionController::Base
  def index
    raise 'Sample exception raised, you should receive a notification!'
  end
end

require 'minitest/autorun'

class Test < Minitest::Test
  include Rack::Test::Methods

  def test_raise_exception
    get '/'

    assert last_response.server_error?
  end

  private

  def app
    Rails.application
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
exception_notification-4.4.0 examples/sample_app.rb