rails_exception_handler 1.3.0 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +11 -3
- data/Gemfile.lock +32 -30
- data/README.markdown +2 -2
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/rails_exception_handler.rb +1 -0
- data/lib/rails_exception_handler/handler.rb +7 -1
- data/rails_exception_handler.gemspec +18 -42
- data/spec/testapp_32/.gitignore +15 -0
- data/spec/testapp_32/app/mailers/.gitkeep +0 -0
- data/spec/testapp_32/app/models/.gitkeep +0 -0
- data/spec/testapp_32/lib/assets/.gitkeep +0 -0
- data/spec/testapp_32/lib/tasks/.gitkeep +0 -0
- data/spec/testapp_32/log/.gitkeep +0 -0
- data/spec/testapp_32/vendor/assets/javascripts/.gitkeep +0 -0
- data/spec/testapp_32/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/testapp_32/vendor/plugins/.gitkeep +0 -0
- metadata +21 -45
- data/spec/integration/configuration_spec.rb +0 -220
- data/spec/integration/rails_exception_handler_spec.rb +0 -67
- data/spec/spec_helper.rb +0 -24
- data/spec/test_macros.rb +0 -63
- data/spec/testapp_30/Gemfile +0 -31
- data/spec/testapp_30/Gemfile.lock +0 -75
- data/spec/testapp_30/Rakefile +0 -7
- data/spec/testapp_30/app/controllers/application_controller.rb +0 -16
- data/spec/testapp_30/app/controllers/home_controller.rb +0 -22
- data/spec/testapp_30/app/helpers/application_helper.rb +0 -2
- data/spec/testapp_30/app/models/stored_exception.rb +0 -9
- data/spec/testapp_30/app/views/home/view_error.html.erb +0 -2
- data/spec/testapp_30/app/views/layouts/fallback.html.erb +0 -15
- data/spec/testapp_30/app/views/layouts/home.html.erb +0 -15
- data/spec/testapp_30/config.ru +0 -4
- data/spec/testapp_30/config/application.rb +0 -44
- data/spec/testapp_30/config/boot.rb +0 -6
- data/spec/testapp_30/config/environment.rb +0 -5
- data/spec/testapp_30/config/environments/development.rb +0 -26
- data/spec/testapp_30/config/environments/production.rb +0 -49
- data/spec/testapp_30/config/environments/test.rb +0 -35
- data/spec/testapp_30/config/examples/database.yml +0 -13
- data/spec/testapp_30/config/locales/en.yml +0 -5
- data/spec/testapp_30/config/routes.rb +0 -6
- data/spec/testapp_30/db/migrate/20110630174538_create_error_messages.rb +0 -22
- data/spec/testapp_30/db/migrate/20110702131654_add_sessions_table.rb +0 -16
- data/spec/testapp_30/db/schema.rb +0 -39
- data/spec/testapp_30/db/seeds.rb +0 -7
- data/spec/testapp_30/script/rails +0 -6
- data/spec/testapp_30/script/setup +0 -19
- data/spec/unit/configuration_spec.rb +0 -37
- data/spec/unit/handler_spec.rb +0 -200
- data/spec/unit/parser_spec.rb +0 -136
data/spec/testapp_30/Rakefile
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
-
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
-
|
4
|
-
require File.expand_path('../config/application', __FILE__)
|
5
|
-
require 'rake'
|
6
|
-
|
7
|
-
ExceptionHandlerTestApp::Application.load_tasks
|
@@ -1,22 +0,0 @@
|
|
1
|
-
class HomeController < ApplicationController
|
2
|
-
layout 'home'
|
3
|
-
|
4
|
-
def controller_error
|
5
|
-
nil.foo
|
6
|
-
render(:text => 'did not fail')
|
7
|
-
end
|
8
|
-
|
9
|
-
def model_error
|
10
|
-
s = StoredException.new
|
11
|
-
s.failure
|
12
|
-
render(:text => 'did not fail')
|
13
|
-
end
|
14
|
-
|
15
|
-
def view_error
|
16
|
-
end
|
17
|
-
|
18
|
-
def syntax_error
|
19
|
-
eval("arr = [")
|
20
|
-
render(:text => 'did not fail')
|
21
|
-
end
|
22
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>ExceptionHandlerTestApp</title>
|
5
|
-
<%= stylesheet_link_tag :all %>
|
6
|
-
<%= javascript_include_tag :defaults %>
|
7
|
-
<%= csrf_meta_tag %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
this_is_the_fallback_layout
|
12
|
-
<%= yield %>
|
13
|
-
|
14
|
-
</body>
|
15
|
-
</html>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>ExceptionHandlerTestApp</title>
|
5
|
-
<%= stylesheet_link_tag :all %>
|
6
|
-
<%= javascript_include_tag :defaults %>
|
7
|
-
<%= csrf_meta_tag %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
this_is_the_home_layout
|
12
|
-
<%= yield %>
|
13
|
-
|
14
|
-
</body>
|
15
|
-
</html>
|
data/spec/testapp_30/config.ru
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
require 'rails/all'
|
4
|
-
|
5
|
-
# If you have a Gemfile, require the gems listed there, including any gems
|
6
|
-
# you've limited to :test, :development, or :production.
|
7
|
-
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
8
|
-
|
9
|
-
module ExceptionHandlerTestApp
|
10
|
-
class Application < Rails::Application
|
11
|
-
# Settings in config/environments/* take precedence over those specified here.
|
12
|
-
# Application configuration should go into files in config/initializers
|
13
|
-
# -- all .rb files in that directory are automatically loaded.
|
14
|
-
|
15
|
-
# Custom directories with classes and modules you want to be autoloadable.
|
16
|
-
# config.autoload_paths += %W(#{config.root}/extras)
|
17
|
-
|
18
|
-
# Only load the plugins named here, in the order given (default is alphabetical).
|
19
|
-
# :all can be used as a placeholder for all plugins not explicitly named.
|
20
|
-
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
21
|
-
|
22
|
-
# Activate observers that should always be running.
|
23
|
-
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
24
|
-
|
25
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
26
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
27
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
28
|
-
|
29
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
30
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
31
|
-
# config.i18n.default_locale = :de
|
32
|
-
|
33
|
-
# JavaScript files you want as :defaults (application.js is always included).
|
34
|
-
config.action_view.javascript_expansions[:defaults] = []
|
35
|
-
|
36
|
-
# Configure the default encoding used in templates for Ruby 1.9.
|
37
|
-
config.encoding = "utf-8"
|
38
|
-
|
39
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
40
|
-
config.filter_parameters += [:password]
|
41
|
-
|
42
|
-
config.session_store :active_record_store
|
43
|
-
end
|
44
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
ExceptionHandlerTestApp::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# In the development environment your application's code is reloaded on
|
5
|
-
# every request. This slows down response time but is perfect for development
|
6
|
-
# since you don't have to restart the webserver when you make code changes.
|
7
|
-
config.cache_classes = false
|
8
|
-
|
9
|
-
# Log error messages when you accidentally call methods on nil.
|
10
|
-
config.whiny_nils = true
|
11
|
-
|
12
|
-
# Show full error reports and disable caching
|
13
|
-
config.consider_all_requests_local = true
|
14
|
-
config.action_view.debug_rjs = true
|
15
|
-
config.action_controller.perform_caching = false
|
16
|
-
|
17
|
-
# Don't care if the mailer can't send
|
18
|
-
config.action_mailer.raise_delivery_errors = false
|
19
|
-
|
20
|
-
# Print deprecation notices to the Rails logger
|
21
|
-
config.active_support.deprecation = :log
|
22
|
-
|
23
|
-
# Only use best-standards-support built into browsers
|
24
|
-
config.action_dispatch.best_standards_support = :builtin
|
25
|
-
end
|
26
|
-
|
@@ -1,49 +0,0 @@
|
|
1
|
-
ExceptionHandlerTestApp::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# The production environment is meant for finished, "live" apps.
|
5
|
-
# Code is not reloaded between requests
|
6
|
-
config.cache_classes = true
|
7
|
-
|
8
|
-
# Full error reports are disabled and caching is turned on
|
9
|
-
config.consider_all_requests_local = false
|
10
|
-
config.action_controller.perform_caching = true
|
11
|
-
|
12
|
-
# Specifies the header that your server uses for sending files
|
13
|
-
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
14
|
-
|
15
|
-
# For nginx:
|
16
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
17
|
-
|
18
|
-
# If you have no front-end server that supports something like X-Sendfile,
|
19
|
-
# just comment this out and Rails will serve the files
|
20
|
-
|
21
|
-
# See everything in the log (default is :info)
|
22
|
-
# config.log_level = :debug
|
23
|
-
|
24
|
-
# Use a different logger for distributed setups
|
25
|
-
# config.logger = SyslogLogger.new
|
26
|
-
|
27
|
-
# Use a different cache store in production
|
28
|
-
# config.cache_store = :mem_cache_store
|
29
|
-
|
30
|
-
# Disable Rails's static asset server
|
31
|
-
# In production, Apache or nginx will already do this
|
32
|
-
config.serve_static_assets = false
|
33
|
-
|
34
|
-
# Enable serving of images, stylesheets, and javascripts from an asset server
|
35
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
36
|
-
|
37
|
-
# Disable delivery errors, bad email addresses will be ignored
|
38
|
-
# config.action_mailer.raise_delivery_errors = false
|
39
|
-
|
40
|
-
# Enable threaded mode
|
41
|
-
# config.threadsafe!
|
42
|
-
|
43
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
44
|
-
# the I18n.default_locale when a translation can not be found)
|
45
|
-
config.i18n.fallbacks = true
|
46
|
-
|
47
|
-
# Send deprecation notices to registered listeners
|
48
|
-
config.active_support.deprecation = :notify
|
49
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
ExceptionHandlerTestApp::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite. You never need to work with it otherwise. Remember that
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
8
|
-
config.cache_classes = true
|
9
|
-
|
10
|
-
# Log error messages when you accidentally call methods on nil.
|
11
|
-
config.whiny_nils = true
|
12
|
-
|
13
|
-
# Show full error reports and disable caching
|
14
|
-
config.consider_all_requests_local = true
|
15
|
-
config.action_controller.perform_caching = false
|
16
|
-
|
17
|
-
# Raise exceptions instead of rendering exception templates
|
18
|
-
config.action_dispatch.show_exceptions = false
|
19
|
-
|
20
|
-
# Disable request forgery protection in test environment
|
21
|
-
config.action_controller.allow_forgery_protection = false
|
22
|
-
|
23
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
24
|
-
# The :test delivery method accumulates sent emails in the
|
25
|
-
# ActionMailer::Base.deliveries array.
|
26
|
-
config.action_mailer.delivery_method = :test
|
27
|
-
|
28
|
-
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
29
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
30
|
-
# like if you have constraints or database-specific column types
|
31
|
-
# config.active_record.schema_format = :sql
|
32
|
-
|
33
|
-
# Print deprecation notices to the stderr
|
34
|
-
config.active_support.deprecation = :stderr
|
35
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
class CreateErrorMessages < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :error_messages do |t|
|
4
|
-
t.text :class_name
|
5
|
-
t.text :message
|
6
|
-
t.text :trace
|
7
|
-
t.text :params
|
8
|
-
t.text :target_url
|
9
|
-
t.text :referer_url
|
10
|
-
t.text :user_agent
|
11
|
-
t.string :user_info
|
12
|
-
t.string :app_name
|
13
|
-
t.datetime :created_at
|
14
|
-
|
15
|
-
t.timestamps
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.down
|
20
|
-
drop_table :error_messages
|
21
|
-
end
|
22
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
class AddSessionsTable < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :sessions do |t|
|
4
|
-
t.string :session_id, :null => false
|
5
|
-
t.text :data
|
6
|
-
t.timestamps
|
7
|
-
end
|
8
|
-
|
9
|
-
add_index :sessions, :session_id
|
10
|
-
add_index :sessions, :updated_at
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.down
|
14
|
-
drop_table :sessions
|
15
|
-
end
|
16
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# This file is auto-generated from the current state of the database. Instead
|
2
|
-
# of editing this file, please use the migrations feature of Active Record to
|
3
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
-
#
|
5
|
-
# Note that this schema.rb definition is the authoritative source for your
|
6
|
-
# database schema. If you need to create the application database on another
|
7
|
-
# system, you should be using db:schema:load, not running all the migrations
|
8
|
-
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
-
#
|
11
|
-
# It's strongly recommended to check this file into your version control system.
|
12
|
-
|
13
|
-
ActiveRecord::Schema.define(:version => 20110702131654) do
|
14
|
-
|
15
|
-
create_table "error_messages", :force => true do |t|
|
16
|
-
t.text "class_name"
|
17
|
-
t.text "message"
|
18
|
-
t.text "trace"
|
19
|
-
t.text "params"
|
20
|
-
t.text "target_url"
|
21
|
-
t.text "referer_url"
|
22
|
-
t.text "user_agent"
|
23
|
-
t.string "user_info"
|
24
|
-
t.string "app_name"
|
25
|
-
t.datetime "created_at"
|
26
|
-
t.datetime "updated_at"
|
27
|
-
end
|
28
|
-
|
29
|
-
create_table "sessions", :force => true do |t|
|
30
|
-
t.string "session_id", :null => false
|
31
|
-
t.text "data"
|
32
|
-
t.datetime "created_at"
|
33
|
-
t.datetime "updated_at"
|
34
|
-
end
|
35
|
-
|
36
|
-
add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
|
37
|
-
add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
|
38
|
-
|
39
|
-
end
|
data/spec/testapp_30/db/seeds.rb
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
-
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
-
#
|
4
|
-
# Examples:
|
5
|
-
#
|
6
|
-
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
7
|
-
# Mayor.create(:name => 'Daley', :city => cities.first)
|
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|
@@ -1,19 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
Dir.chdir(File.expand_path(File.dirname(__FILE__)) + "/../")
|
6
|
-
|
7
|
-
source = "config/examples/database.yml"
|
8
|
-
target = "config/database.yml"
|
9
|
-
|
10
|
-
if File.exist?(target)
|
11
|
-
puts "#{target} already exists"
|
12
|
-
else
|
13
|
-
FileUtils.cp(source, target)
|
14
|
-
puts "#{target} copied"
|
15
|
-
end
|
16
|
-
|
17
|
-
system "bundle"
|
18
|
-
system "bundle exec rake db:create --trace RAILS_ENV=test"
|
19
|
-
system "bundle exec rake db:migrate --trace RAILS_ENV=test"
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe RailsExceptionHandler::Configuration do
|
4
|
-
describe ".initialize" do
|
5
|
-
before(:each) do
|
6
|
-
@configuration = RailsExceptionHandler::Configuration.new
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should add :production to environments" do
|
10
|
-
@configuration.environments.should == [:production]
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should set storage_strategies to []" do
|
14
|
-
@configuration.storage_strategies.should == []
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should set store_user_info to false" do
|
18
|
-
@configuration.store_user_info = false
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should set filters to [] " do
|
22
|
-
@configuration.filters.should == []
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should initialize responses to an empty hash" do
|
26
|
-
@configuration.responses.should == {}
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should set the reponse_mapping to {}" do
|
30
|
-
@configuration.response_mapping.should == {}
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should set the fallback layout to 'application'" do
|
34
|
-
@configuration.fallback_layout.should == 'application'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|