flail 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flail (0.1.2)
4
+ flail (0.1.5)
5
+ json
5
6
 
6
7
  GEM
7
8
  remote: http://rubygems.org/
@@ -14,6 +15,7 @@ GEM
14
15
  activesupport (2.3.14)
15
16
  diff-lcs (1.1.3)
16
17
  fakeweb (1.3.0)
18
+ json (1.7.5)
17
19
  rack (1.1.3)
18
20
  rake (0.9.2.2)
19
21
  rr (1.0.4)
data/lib/flail/rack.rb CHANGED
@@ -7,7 +7,7 @@ class Flail
7
7
  def call(env)
8
8
  begin
9
9
  response = @app.call(env)
10
- rescue Exception => exception
10
+ rescue ::Exception => exception
11
11
  Flail::Exception.new(env, exception).handle!
12
12
  raise
13
13
  end
data/lib/flail/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Flail
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
data/spec/rack_spec.rb ADDED
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ require 'ostruct'
4
+ require 'flail/rack'
5
+
6
+ describe Flail::Rack do
7
+
8
+ subject { Flail::Rack.new lambda {|env| "val: #{env.fetch(:required_key)}" } }
9
+
10
+ context "when an exception is raised by the app" do
11
+ let(:env) { {} }
12
+
13
+ it "should make an instance of Flail::Exception from the exception" do
14
+ stub_fe = OpenStruct.new(:"handle!" => nil)
15
+ mock(Flail::Exception).new(env, is_a(KeyError)) { stub_fe }
16
+
17
+ # catch the re-raised KeyError so the spec isn't wrecked
18
+ begin
19
+ subject.call(env)
20
+ rescue KeyError
21
+ end
22
+ end
23
+
24
+ it "should handle the new Flail::Exception" do
25
+ stub.proxy(Flail::Exception).new do |fe|
26
+ mock(fe).handle!
27
+ end
28
+
29
+ begin
30
+ subject.call(env)
31
+ rescue KeyError
32
+ end
33
+ end
34
+ end
35
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-18 00:00:00.000000000 Z
12
+ date: 2012-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -188,6 +188,7 @@ files:
188
188
  - spec/backtrace_spec.rb
189
189
  - spec/base_spec.rb
190
190
  - spec/exception_spec.rb
191
+ - spec/rack_spec.rb
191
192
  - spec/rescue_action_spec.rb
192
193
  - spec/spec_helper.rb
193
194
  - spec/support/rr.rb
@@ -219,6 +220,7 @@ test_files:
219
220
  - spec/backtrace_spec.rb
220
221
  - spec/base_spec.rb
221
222
  - spec/exception_spec.rb
223
+ - spec/rack_spec.rb
222
224
  - spec/rescue_action_spec.rb
223
225
  - spec/spec_helper.rb
224
226
  - spec/support/rr.rb