utopia 1.0.0 → 1.0.1
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d79188e4c82a0e063f4d4d322b9c9f6ede2abac6
|
4
|
+
data.tar.gz: 066c1fd1bece542a5a6e310bfdcff65670a0e91e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39c11885cf3802fd246bcc6b551afc9164d4d9e3f13f27823be4a59f9a1a8212517f81c9b630f8706ef565adfead313209f28e37a81180b086f8081aeec9e1c3
|
7
|
+
data.tar.gz: abb2c8242bcfd5d9a4213de4458756b78d4dbc1be049800100e888c0487e367112a277a40a5c19e74c374a2000fada23b3dde9b89a2176df75c2b71d1877587b
|
@@ -45,7 +45,7 @@ module Utopia
|
|
45
45
|
return [400, {"Content-Type" => "text/html"}, body]
|
46
46
|
end
|
47
47
|
|
48
|
-
def redirect(env,
|
48
|
+
def redirect(env, exception)
|
49
49
|
return @app.call(env.merge('PATH_INFO' => @location, 'REQUEST_METHOD' => 'GET'))
|
50
50
|
end
|
51
51
|
|
@@ -58,19 +58,19 @@ module Utopia
|
|
58
58
|
|
59
59
|
log.error "Exception #{exception.to_s.dump}!"
|
60
60
|
|
61
|
-
|
62
|
-
log.error
|
61
|
+
exception.backtrace.each do |line|
|
62
|
+
log.error line
|
63
63
|
end
|
64
64
|
|
65
65
|
# If the error occurred while accessing the error handler, we finish with a fatal error:
|
66
66
|
if env['PATH_INFO'] == @location
|
67
|
-
return fatal_error(env,
|
67
|
+
return fatal_error(env, exception)
|
68
68
|
else
|
69
69
|
# If redirection fails, we also finish with a fatal error:
|
70
70
|
begin
|
71
|
-
return redirect(env,
|
71
|
+
return redirect(env, exception)
|
72
72
|
rescue
|
73
|
-
return fatal_error(env,
|
73
|
+
return fatal_error(env, exception)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
data/lib/utopia/version.rb
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
|
3
|
+
# Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require_relative 'spec_helper'
|
24
|
+
|
25
|
+
require 'rack/mock'
|
26
|
+
require 'rack/test'
|
27
|
+
|
28
|
+
require 'utopia/exception_handler'
|
29
|
+
|
30
|
+
module Utopia::ExceptionHandlerSpec
|
31
|
+
describe Utopia::ExceptionHandler do
|
32
|
+
include Rack::Test::Methods
|
33
|
+
|
34
|
+
let(:app) {Rack::Builder.parse_file(File.expand_path('../exception_handler_spec.ru', __FILE__)).first}
|
35
|
+
|
36
|
+
it "should successfully call the controller method" do
|
37
|
+
get "/controller/blow"
|
38
|
+
|
39
|
+
expect(last_response.status).to be == 400
|
40
|
+
expect(last_response.body).to be_include 'Fatal Error'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01
|
11
|
+
date: 2015-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trenni
|
@@ -228,6 +228,8 @@ files:
|
|
228
228
|
- spec/utopia/content_spec.ru
|
229
229
|
- spec/utopia/controller_spec.rb
|
230
230
|
- spec/utopia/controller_spec.ru
|
231
|
+
- spec/utopia/exception_handler_spec.rb
|
232
|
+
- spec/utopia/exception_handler_spec.ru
|
231
233
|
- spec/utopia/extensions_spec.rb
|
232
234
|
- spec/utopia/localization_spec.rb
|
233
235
|
- spec/utopia/localization_spec.ru
|
@@ -305,6 +307,8 @@ test_files:
|
|
305
307
|
- spec/utopia/content_spec.ru
|
306
308
|
- spec/utopia/controller_spec.rb
|
307
309
|
- spec/utopia/controller_spec.ru
|
310
|
+
- spec/utopia/exception_handler_spec.rb
|
311
|
+
- spec/utopia/exception_handler_spec.ru
|
308
312
|
- spec/utopia/extensions_spec.rb
|
309
313
|
- spec/utopia/localization_spec.rb
|
310
314
|
- spec/utopia/localization_spec.ru
|