errplane 0.3.7 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -1
- data/.rspec +2 -0
- data/.travis.yml +22 -0
- data/README.md +2 -10
- data/Rakefile +19 -31
- data/errplane.gemspec +5 -9
- data/gemfiles/Gemfile.rails-2.3.x +8 -0
- data/gemfiles/Gemfile.rails-2.3.x.lock +60 -0
- data/gemfiles/{rails_3.2.gemfile → Gemfile.rails-3.0.x} +2 -2
- data/gemfiles/Gemfile.rails-3.0.x.lock +82 -0
- data/gemfiles/{rails_3.1.gemfile → Gemfile.rails-3.1.x} +2 -1
- data/gemfiles/Gemfile.rails-3.1.x.lock +94 -0
- data/gemfiles/{rails_3.0.gemfile → Gemfile.rails-3.2.x} +2 -1
- data/gemfiles/Gemfile.rails-3.2.x.lock +92 -0
- data/lib/errplane.rb +15 -10
- data/lib/errplane/backtrace.rb +38 -0
- data/lib/errplane/black_box.rb +8 -5
- data/lib/errplane/capistrano.rb +0 -1
- data/lib/errplane/configuration.rb +30 -22
- data/lib/errplane/errplane_chef_handler.rb +2 -4
- data/lib/errplane/logger.rb +11 -0
- data/lib/errplane/rails/air_traffic_controller.rb +2 -1
- data/lib/errplane/rails/middleware/hijack_render_exception.rb +5 -2
- data/lib/errplane/railtie.rb +0 -9
- data/lib/errplane/transmitter.rb +19 -11
- data/lib/errplane/version.rb +1 -1
- data/lib/rails/generators/errplane/templates/initializer.rb +0 -3
- data/spec/app/rails2.rb +38 -0
- data/spec/app/{rails.rb → rails3.rb} +0 -3
- data/spec/integration/exceptions_spec.rb +27 -9
- data/spec/rails2/README +243 -0
- data/spec/rails2/Rakefile +10 -0
- data/spec/rails2/app/controllers/application_controller.rb +10 -0
- data/spec/rails2/app/controllers/widgets_controller.rb +5 -0
- data/spec/rails2/app/helpers/application_helper.rb +3 -0
- data/spec/rails2/app/helpers/widgets_helper.rb +1 -0
- data/spec/rails2/config/boot.rb +114 -0
- data/spec/rails2/config/database.yml +3 -0
- data/spec/rails2/config/environment.rb +33 -0
- data/spec/rails2/config/environments/development.rb +17 -0
- data/spec/rails2/config/environments/production.rb +28 -0
- data/spec/{internal/public/favicon.ico → rails2/config/environments/test.rb} +0 -0
- data/spec/rails2/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails2/config/initializers/cookie_verification_secret.rb +7 -0
- data/spec/{internal → rails2}/config/initializers/errplane.rb +0 -0
- data/spec/rails2/config/initializers/inflections.rb +10 -0
- data/spec/rails2/config/initializers/mime_types.rb +5 -0
- data/spec/rails2/config/initializers/new_rails_defaults.rb +21 -0
- data/spec/rails2/config/initializers/session_store.rb +15 -0
- data/spec/rails2/config/locales/en.yml +5 -0
- data/spec/rails2/config/routes.rb +3 -0
- data/spec/rails2/lib/tasks/rspec.rake +144 -0
- data/spec/rails2/log/development.log +0 -0
- data/spec/rails2/log/production.log +0 -0
- data/spec/rails2/log/server.log +0 -0
- data/spec/rails2/log/test.log +785 -0
- data/spec/rails2/public/404.html +30 -0
- data/spec/rails2/public/422.html +30 -0
- data/spec/rails2/public/500.html +30 -0
- data/spec/rails2/public/favicon.ico +0 -0
- data/spec/rails2/public/images/rails.png +0 -0
- data/spec/rails2/public/index.html +275 -0
- data/spec/rails2/public/javascripts/application.js +2 -0
- data/spec/rails2/public/javascripts/controls.js +963 -0
- data/spec/rails2/public/javascripts/dragdrop.js +973 -0
- data/spec/rails2/public/javascripts/effects.js +1128 -0
- data/spec/rails2/public/javascripts/prototype.js +4320 -0
- data/spec/rails2/public/robots.txt +5 -0
- data/spec/rails2/script/about +4 -0
- data/spec/rails2/script/autospec +6 -0
- data/spec/rails2/script/console +3 -0
- data/spec/rails2/script/dbconsole +3 -0
- data/spec/rails2/script/destroy +3 -0
- data/spec/rails2/script/generate +3 -0
- data/spec/rails2/script/performance/benchmarker +3 -0
- data/spec/rails2/script/performance/profiler +3 -0
- data/spec/rails2/script/plugin +3 -0
- data/spec/rails2/script/runner +3 -0
- data/spec/rails2/script/server +3 -0
- data/spec/rails2/script/spec +10 -0
- data/spec/rails2/test/performance/browsing_test.rb +9 -0
- data/spec/rails2/test/test_helper.rb +38 -0
- data/spec/spec_helper.rb +27 -16
- data/spec/suite.sh +39 -0
- data/spec/unit/backtrace_spec.rb +62 -0
- data/spec/unit/black_box_spec.rb +3 -3
- data/spec/unit/configuration_spec.rb +29 -0
- data/spec/unit/errplane_spec.rb +24 -15
- data/specs.watchr +21 -0
- metadata +194 -90
- data/gemfiles/rails_2.3.gemfile +0 -6
- data/gemfiles/rails_2.3.gemfile.lock +0 -148
- data/gemfiles/rails_3.0.gemfile.lock +0 -148
- data/gemfiles/rails_3.1.gemfile.lock +0 -148
- data/gemfiles/rails_3.2.gemfile.lock +0 -121
- data/lib/errplane/rails/udp_logger.rb +0 -54
- data/lib/errplane/syslogproto.rb +0 -7
- data/lib/errplane/syslogproto/common.rb +0 -81
- data/lib/errplane/syslogproto/logger.rb +0 -24
- data/lib/errplane/syslogproto/packet.rb +0 -107
- data/lib/errplane/syslogproto/parser.rb +0 -51
- data/spec/internal/app/controllers/application_controller.rb +0 -2
- data/spec/internal/app/controllers/widgets_controller.rb +0 -9
- data/spec/internal/config/database.yml +0 -3
- data/spec/internal/config/routes.rb +0 -3
- data/spec/internal/db/combustion_test.sqlite +0 -0
- data/spec/internal/db/schema.rb +0 -3
- data/spec/internal/log/.gitignore +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
|
|
3
|
+
ENV['RSPEC'] = 'true' # allows autotest to discover rspec
|
|
4
|
+
ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux
|
|
5
|
+
system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) ||
|
|
6
|
+
$stderr.puts("Unable to find autotest. Please install ZenTest or fix your PATH")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
if ARGV.any? {|arg| %w[--drb -X --generate-options -G --help -h --version -v].include?(arg)}
|
|
3
|
+
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
|
4
|
+
else
|
|
5
|
+
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
|
|
6
|
+
ENV["RAILS_ENV"] ||= 'test'
|
|
7
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/environment") unless defined?(RAILS_ROOT)
|
|
8
|
+
end
|
|
9
|
+
require 'spec/autorun'
|
|
10
|
+
exit ::Spec::Runner::CommandLine.run
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
|
3
|
+
require 'test_help'
|
|
4
|
+
|
|
5
|
+
class ActiveSupport::TestCase
|
|
6
|
+
# Transactional fixtures accelerate your tests by wrapping each test method
|
|
7
|
+
# in a transaction that's rolled back on completion. This ensures that the
|
|
8
|
+
# test database remains unchanged so your fixtures don't have to be reloaded
|
|
9
|
+
# between every test method. Fewer database queries means faster tests.
|
|
10
|
+
#
|
|
11
|
+
# Read Mike Clark's excellent walkthrough at
|
|
12
|
+
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
|
13
|
+
#
|
|
14
|
+
# Every Active Record database supports transactions except MyISAM tables
|
|
15
|
+
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
|
16
|
+
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
|
17
|
+
# is recommended.
|
|
18
|
+
#
|
|
19
|
+
# The only drawback to using transactional fixtures is when you actually
|
|
20
|
+
# need to test transactions. Since your test is bracketed by a transaction,
|
|
21
|
+
# any transactions started in your code will be automatically rolled back.
|
|
22
|
+
self.use_transactional_fixtures = true
|
|
23
|
+
|
|
24
|
+
# Instantiated fixtures are slow, but give you @david where otherwise you
|
|
25
|
+
# would need people(:david). If you don't want to migrate your existing
|
|
26
|
+
# test cases which use the @david style and don't mind the speed hit (each
|
|
27
|
+
# instantiated fixtures translates to a database query per test method),
|
|
28
|
+
# then set this back to true.
|
|
29
|
+
self.use_instantiated_fixtures = false
|
|
30
|
+
|
|
31
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
|
32
|
+
#
|
|
33
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
|
34
|
+
# -- they do not yet inherit this setting
|
|
35
|
+
fixtures :all
|
|
36
|
+
|
|
37
|
+
# Add more helper methods to be used by all tests here...
|
|
38
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -2,24 +2,41 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
|
2
2
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
3
3
|
ENV["RAILS_ENV"] ||= "test"
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
require 'rails/version'
|
|
6
|
+
|
|
7
|
+
if Rails::VERSION::MAJOR > 2
|
|
6
8
|
require 'rails'
|
|
7
|
-
|
|
9
|
+
else
|
|
10
|
+
module Rails
|
|
11
|
+
class << self
|
|
12
|
+
def vendor_rails?; return false; end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
class FakeConfig
|
|
16
|
+
def after_initialize; end
|
|
17
|
+
end
|
|
18
|
+
@@configuration = FakeConfig.new
|
|
19
|
+
end
|
|
20
|
+
require 'initializer'
|
|
21
|
+
RAILS_ROOT = "#{File.dirname(__FILE__)}/rails2"
|
|
8
22
|
end
|
|
9
23
|
|
|
10
24
|
require 'bundler/setup'
|
|
11
25
|
Bundler.require
|
|
12
26
|
|
|
13
|
-
require
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
# Simulate a gem providing a subclass of ActiveRecord::Base before the Railtie is loaded.
|
|
17
|
-
# require 'fake_gem' if defined? ActiveRecord
|
|
27
|
+
require "fakeweb"
|
|
28
|
+
FakeWeb.allow_net_connect = false
|
|
18
29
|
|
|
19
30
|
if defined? Rails
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
puts "Loading Rails v#{Rails.version}..."
|
|
32
|
+
|
|
33
|
+
unless Rails.version.to_f < 3.0
|
|
34
|
+
require "app/rails3"
|
|
35
|
+
require "rspec/rails"
|
|
36
|
+
else
|
|
37
|
+
require "rails2/config/environment"
|
|
38
|
+
require "spec/rails"
|
|
39
|
+
end
|
|
23
40
|
end
|
|
24
41
|
if defined? Sinatra
|
|
25
42
|
require 'spec_helper_for_sinatra'
|
|
@@ -29,9 +46,3 @@ end
|
|
|
29
46
|
# in ./support/ and its subdirectories.
|
|
30
47
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
31
48
|
|
|
32
|
-
RSpec.configure do |config|
|
|
33
|
-
config.color_enabled = true
|
|
34
|
-
config.tty = true
|
|
35
|
-
config.formatter = :documentation
|
|
36
|
-
config.mock_with :rr
|
|
37
|
-
end
|
data/spec/suite.sh
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
|
|
4
|
+
source "$HOME/.rvm/scripts/rvm"
|
|
5
|
+
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
|
|
6
|
+
source "/usr/local/rvm/scripts/rvm"
|
|
7
|
+
else
|
|
8
|
+
printf "ERROR: An RVM installation was not found.\n"
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
function build_version() {
|
|
12
|
+
echo "Bundling for Rails $1..."
|
|
13
|
+
BUNDLE_GEMFILE=gemfiles/Gemfile.rails-$1 bundle install --quiet
|
|
14
|
+
BUNDLE_GEMFILE=gemfiles/Gemfile.rails-$1 bundle exec rake -t spec
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function versions() {
|
|
18
|
+
build_version "3.2.x"
|
|
19
|
+
build_version "3.1.x"
|
|
20
|
+
build_version "3.0.x"
|
|
21
|
+
# build_version "2.3.x"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function use_ruby() {
|
|
25
|
+
rvm use ruby-$1@errplane_gem --create
|
|
26
|
+
versions
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function run() {
|
|
30
|
+
use_ruby "1.9.3-p194"
|
|
31
|
+
use_ruby "1.9.2-p290"
|
|
32
|
+
use_ruby "1.8.7-p357"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function clean() {
|
|
36
|
+
rvm gemset empty errplane_gem --force
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
run
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Errplane::Backtrace do
|
|
4
|
+
before do
|
|
5
|
+
@raw_backtrace = [
|
|
6
|
+
"/var/www/current/app/models/foo.rb:10:in `bar'",
|
|
7
|
+
"/var/www/current/app/models/foo.rb:19:in `baz'",
|
|
8
|
+
"/var/www/current/app/models/foo.rb:32:in `<main>'"
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
@backtrace = Errplane::Backtrace.new(@raw_backtrace)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "should accept an exception into the initializer" do
|
|
15
|
+
@backtrace.lines.should_not be_empty
|
|
16
|
+
@backtrace.lines.count.should == 3
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "should correctly parse lines into their elements" do
|
|
20
|
+
line = @backtrace.lines.first
|
|
21
|
+
|
|
22
|
+
line.file.should == "/var/www/current/app/models/foo.rb"
|
|
23
|
+
line.number.should == "10"
|
|
24
|
+
line.method.should == "bar"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe "backtrace filters" do
|
|
28
|
+
before do
|
|
29
|
+
Errplane.configure do |config|
|
|
30
|
+
config.application_root = "/var/www/current"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should apply a single default backtrace filter correctly" do
|
|
35
|
+
filtered_backtrace = Errplane::Backtrace.new(@raw_backtrace)
|
|
36
|
+
|
|
37
|
+
line = filtered_backtrace.lines.first
|
|
38
|
+
line.file.should == "[APP_ROOT]/app/models/foo.rb"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "should all default backtrace filters correctly" do
|
|
42
|
+
extended_backtrace = @raw_backtrace.dup
|
|
43
|
+
extended_backtrace << "#{Gem.path.first}/lib/foo_gem.rb:1:in `blah'"
|
|
44
|
+
|
|
45
|
+
filtered_backtrace = Errplane::Backtrace.new(extended_backtrace)
|
|
46
|
+
filtered_backtrace.lines.first.file.should == "[APP_ROOT]/app/models/foo.rb"
|
|
47
|
+
filtered_backtrace.lines.last.file.should == "[GEM_ROOT]/lib/foo_gem.rb"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it "should allow the addition of custom backtrace filters" do
|
|
51
|
+
Errplane.configure do |config|
|
|
52
|
+
config.backtrace_filters << lambda { |line| line.gsub(/foo/, "F00") }
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
filtered_backtrace = Errplane::Backtrace.new(@raw_backtrace)
|
|
56
|
+
|
|
57
|
+
line = filtered_backtrace.lines.first
|
|
58
|
+
line.file.should == "[APP_ROOT]/app/models/F00.rb"
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
data/spec/unit/black_box_spec.rb
CHANGED
|
@@ -16,14 +16,14 @@ describe Errplane::BlackBox do
|
|
|
16
16
|
|
|
17
17
|
it "should accept an exception as a parameter" do
|
|
18
18
|
|
|
19
|
-
black_box = Errplane::BlackBox.new(exception
|
|
19
|
+
black_box = Errplane::BlackBox.new(:exception => @exception)
|
|
20
20
|
black_box.should_not be_nil
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
describe "#to_json" do
|
|
25
25
|
it "should return a JSON string" do
|
|
26
|
-
black_box = Errplane::BlackBox.new(exception
|
|
26
|
+
black_box = Errplane::BlackBox.new(:exception => @exception)
|
|
27
27
|
json = JSON.parse(black_box.to_json)
|
|
28
28
|
|
|
29
29
|
json["message"].should == "divided by 0"
|
|
@@ -41,7 +41,7 @@ describe Errplane::BlackBox do
|
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
black_box = Errplane::BlackBox.new(exception
|
|
44
|
+
black_box = Errplane::BlackBox.new(:exception => @exception)
|
|
45
45
|
json = JSON.parse(black_box.to_json)
|
|
46
46
|
json["hash"].should == "some_hash"
|
|
47
47
|
json["custom_data"]["extra_info"].should == "blah"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Errplane::Configuration do
|
|
4
|
+
before do
|
|
5
|
+
@configuration = Errplane::Configuration.new
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
describe "#ignore_user_agent?" do
|
|
9
|
+
it "should be true for user agents that have been set as ignorable" do
|
|
10
|
+
@configuration.ignored_user_agents = %w{Googlebot}
|
|
11
|
+
@configuration.ignore_user_agent?("Googlebot/2.1").should be_true
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "should be false for user agents that have not been set as ignorable" do
|
|
15
|
+
@configuration.ignored_user_agents = %w{Googlebot}
|
|
16
|
+
@configuration.ignore_user_agent?("Mozilla/5.0").should be_false
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "should be false if the ignored user agents list is empty" do
|
|
20
|
+
@configuration.ignored_user_agents = []
|
|
21
|
+
@configuration.ignore_user_agent?("Googlebot/2.1").should be_false
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should be false if the ignored user agents list is inadvertently set to nil" do
|
|
25
|
+
@configuration.ignored_user_agents = nil
|
|
26
|
+
@configuration.ignore_user_agent?("Googlebot/2.1").should be_false
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
data/spec/unit/errplane_spec.rb
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Errplane do
|
|
4
|
+
before do
|
|
5
|
+
FakeWeb.last_request = nil
|
|
6
|
+
FakeWeb.clean_registry
|
|
7
|
+
|
|
8
|
+
@request_path = "/api/v1/applications/#{Errplane.configuration.application_id}/exceptions/test?api_key=f123-e456-d789c012"
|
|
9
|
+
@request_url = "http://api.errplane.com#{@request_path}"
|
|
10
|
+
end
|
|
11
|
+
|
|
4
12
|
describe ".ignorable_exception?" do
|
|
5
13
|
it "should be true for exception types specified in the configuration" do
|
|
6
14
|
class DummyException < Exception; end
|
|
@@ -25,23 +33,23 @@ describe Errplane do
|
|
|
25
33
|
end
|
|
26
34
|
|
|
27
35
|
describe 'rescue' do
|
|
28
|
-
|
|
29
36
|
it "should transmit an exception when passed" do
|
|
30
|
-
Errplane.configure
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
Errplane.configure { |config| config.ignored_environments = [] }
|
|
38
|
+
|
|
39
|
+
FakeWeb.register_uri(:post, @request_url, :body => "", :status => ["200", "OK"])
|
|
33
40
|
|
|
34
|
-
stub_request(:post, "#{Errplane.configuration.api_host}/api/v1/applications/#{Errplane.configuration.application_id}/exceptions/test?api_key=f123-e456-d789c012").to_return(status: 200)
|
|
35
41
|
Errplane.rescue do
|
|
36
42
|
raise ArgumentError.new('wrong')
|
|
37
43
|
end
|
|
38
|
-
|
|
44
|
+
|
|
45
|
+
FakeWeb.last_request.should_not be_nil
|
|
46
|
+
FakeWeb.last_request.method.should == "POST"
|
|
47
|
+
FakeWeb.last_request.path.should == @request_path
|
|
39
48
|
end
|
|
40
49
|
|
|
41
50
|
it "should also raise the exception when in an ignored environment" do
|
|
42
|
-
Errplane.configure
|
|
43
|
-
|
|
44
|
-
end
|
|
51
|
+
Errplane.configure { |config| config.ignored_environments = %w{development test} }
|
|
52
|
+
|
|
45
53
|
expect {
|
|
46
54
|
Errplane.rescue do
|
|
47
55
|
raise ArgumentError.new('wrong')
|
|
@@ -52,18 +60,19 @@ describe Errplane do
|
|
|
52
60
|
|
|
53
61
|
describe "rescue_and_reraise" do
|
|
54
62
|
before do
|
|
55
|
-
Errplane.configure
|
|
56
|
-
config.ignored_environments = %w{development}
|
|
57
|
-
end
|
|
63
|
+
Errplane.configure { |config| config.ignored_environments = [] }
|
|
58
64
|
end
|
|
59
65
|
|
|
60
66
|
it "should transmit an exception when passed" do
|
|
61
|
-
|
|
67
|
+
FakeWeb.register_uri(:post, @request_url, :body => "", :status => ["200", "OK"])
|
|
68
|
+
|
|
62
69
|
expect {
|
|
63
70
|
Errplane.rescue_and_reraise { raise ArgumentError.new('wrong') }
|
|
64
71
|
}.to raise_error(ArgumentError)
|
|
65
|
-
|
|
72
|
+
|
|
73
|
+
FakeWeb.last_request.should_not be_nil
|
|
74
|
+
FakeWeb.last_request.method.should == "POST"
|
|
75
|
+
FakeWeb.last_request.path.should == @request_path
|
|
66
76
|
end
|
|
67
77
|
end
|
|
68
|
-
|
|
69
78
|
end
|
data/specs.watchr
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
watch( '^lib/errplane/(.*)\.rb' ) { |m| build "rake spec" }
|
|
2
|
+
watch( '^spec/spec_helper\.rb' ) { |m| build "rake spec" }
|
|
3
|
+
watch( '^spec/unit/(.*)_spec\.rb' ) { |m| build "rake spec" }
|
|
4
|
+
watch( '^spec/integration/(.*)_spec\.rb' ) { |m| build "rake spec" }
|
|
5
|
+
|
|
6
|
+
# Signal.trap('QUIT') { build specs } # Ctrl-\
|
|
7
|
+
Signal.trap('QUIT') { puts; build "rake spec" } # Ctrl-\
|
|
8
|
+
Signal.trap('INT' ) { abort("\n") } # Ctrl-C
|
|
9
|
+
|
|
10
|
+
def build(*paths)
|
|
11
|
+
run "bundle exec #{paths.flatten.join(' ')}"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def specs
|
|
15
|
+
Dir['spec/**/spec_*.rb'] - ['spec/spec_helper.rb']
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def run( cmd )
|
|
19
|
+
puts "Running `#{cmd}'"
|
|
20
|
+
system cmd
|
|
21
|
+
end
|