Sha256: e1d7429f7b343b07bf3c1c9270b9b0d6e2e105e0430ab3ee288af5d799532739

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

# -------------------------------------------
# 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

3 entries across 3 versions & 1 rubygems

Version Path
exception_notification-4.5.0 examples/sample_app.rb
exception_notification-4.4.3 examples/sample_app.rb
exception_notification-4.4.1 examples/sample_app.rb