Sha256: b0544af6509755c8af5829f5fe18c4e674c61cd155230f2f394c9a4ba7aec0b1

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

# require 'rails/all'
require 'action_controller/railtie'
require 'action_view/railtie'
require 'jbuilder'

# config
app = Class.new(Rails::Application)
app.config.secret_token = '964ab2f0fbbb68bc36f3cc487ca296bb8555fac50627924024c245a1599e5265'
app.config.session_store :cookie_store, :key => '_myapp_session'
app.config.active_support.deprecation = :log
app.config.eager_load = false

# Rais.root
app.config.root = File.dirname(__FILE__)
app.config.autoload_paths += ["#{app.config.root}/lib"] if ENV["CUSTOM_EXCEPTIONS_APP"]
Rails.backtrace_cleaner.remove_silencers!
app.initialize!

# routes
app.routes.draw do
  resources :users
end

# custom exception class
class CustomException < StandardError; end

Rambulance.setup do |config|
  config.rescue_responses = {
    'CustomException' => :not_found
  }
end

# controllers
class ApplicationController < ActionController::Base
  append_view_path "spec/fake_app/views"
  before_filter :bad_filter

  private

  def bad_filter
    raise "This is a bad filter."
  end
end
class UsersController < ApplicationController
  skip_filter :bad_filter, except: :show

  def index
    raise CustomException
  end

  def show; end

  def new
    raise ActionController::InvalidAuthenticityToken
  end
end

# helpers
Object.const_set(:ApplicationHelper, Module.new)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rambulance-0.1.2 spec/fake_app/rails_app.rb
rambulance-0.1.1 spec/fake_app/rails_app.rb