simplificator_infrastructure 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/simplificator_infrastructure/errors_controller.rb +1 -1
  3. data/lib/simplificator_infrastructure/error_page_handler.rb +5 -2
  4. data/lib/simplificator_infrastructure/error_summary.rb +19 -13
  5. data/lib/simplificator_infrastructure/version.rb +1 -1
  6. data/test/dummy/app/controllers/error_previews_controller.rb +0 -1
  7. data/test/dummy/config/routes.rb +1 -2
  8. data/test/dummy/log/development.log +22 -1972
  9. data/test/dummy/log/test.log +796 -0
  10. data/test/dummy/test/integration/error_previews_controller_test.rb +16 -0
  11. data/test/lib/simplificator_infrastructure/error_summary_test.rb +64 -0
  12. metadata +6 -46
  13. data/test/dummy/test/controllers/foos_controller_test.rb +0 -7
  14. data/test/dummy/tmp/cache/assets/development/sprockets/0500adeee201d5a348b4c3ec497adae2 +0 -0
  15. data/test/dummy/tmp/cache/assets/development/sprockets/09ed1ef41f7cd9d17777b1411359e566 +0 -0
  16. data/test/dummy/tmp/cache/assets/development/sprockets/1344657b8f5d1906efcbafe0e22c17cc +0 -0
  17. data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  18. data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  19. data/test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  20. data/test/dummy/tmp/cache/assets/development/sprockets/5acaff767402e80bb9961b92c8bc3dda +0 -0
  21. data/test/dummy/tmp/cache/assets/development/sprockets/6d07f71bc133b650e297569a7e19174e +0 -0
  22. data/test/dummy/tmp/cache/assets/development/sprockets/7e3d3b1b8b95a568bcb68e2f29436ca3 +0 -0
  23. data/test/dummy/tmp/cache/assets/development/sprockets/7f0315cb615b6ab601fd42d59b8afde9 +0 -0
  24. data/test/dummy/tmp/cache/assets/development/sprockets/8861585cc3fb654bbf27d60c86aba449 +0 -0
  25. data/test/dummy/tmp/cache/assets/development/sprockets/9c500634b58fe570e801dd477f2f9769 +0 -0
  26. data/test/dummy/tmp/cache/assets/development/sprockets/9e70666db09ef523b119125cc9eb73c5 +0 -0
  27. data/test/dummy/tmp/cache/assets/development/sprockets/a58c29f74df199333ef9f066c7b436bd +0 -0
  28. data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  29. data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  30. data/test/dummy/tmp/cache/assets/development/sprockets/d7cb110ec211a8c4ef021e93a2f976f7 +0 -0
  31. data/test/dummy/tmp/cache/assets/development/sprockets/e303fbe4b122fbe771c62af737c0e1b5 +0 -0
  32. data/test/dummy/tmp/cache/assets/development/sprockets/e96855d0fc8137ba701522baf08faf33 +0 -0
  33. data/test/dummy/tmp/cache/assets/development/sprockets/f39692dced32f5d36d10caed783739ee +0 -0
  34. data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
@@ -0,0 +1,16 @@
1
+ require 'test_helper'
2
+
3
+ class ErrorPreviewsControllerTest < ActionDispatch::IntegrationTest
4
+ test '500' do
5
+ get '/error_previews/preview'
6
+ assert_response 500
7
+ end
8
+
9
+ test '404' do
10
+ get '/error_previews/preview?code=404'
11
+ assert_response 404
12
+ assert_template 'errors/404'
13
+ end
14
+
15
+
16
+ end
@@ -0,0 +1,64 @@
1
+ class SimplificatorInfrastructure::ErrorSummaryTest < ActiveSupport::TestCase
2
+ setup do
3
+ I18n.available_locales = [:de, :fr]
4
+ I18n.default_locale = :de
5
+ end
6
+ test 'extracts exception from env' do
7
+ exception = RuntimeError.new
8
+ summary = SimplificatorInfrastructure::ErrorSummary.new('action_dispatch.exception' => exception)
9
+ assert_equal exception, summary.exception
10
+ end
11
+
12
+ test 'extracts params from env' do
13
+ params = {a: 1, b: 2}
14
+ summary = SimplificatorInfrastructure::ErrorSummary.new('action_dispatch.request.parameters' => params)
15
+ assert_equal params, summary.params
16
+ end
17
+
18
+ test 'determines status_code from exception' do
19
+ exception = ActionController::RoutingError.new("howdy")
20
+ summary = SimplificatorInfrastructure::ErrorSummary.new('action_dispatch.exception' => exception)
21
+ assert_equal 404, summary.status_code
22
+ end
23
+
24
+ test 'locale: check path' do
25
+ summary = SimplificatorInfrastructure::ErrorSummary.new(
26
+ 'REQUEST_PATH' => '/fr/bli'
27
+ )
28
+ assert_equal :fr, summary.locale
29
+ end
30
+
31
+ test 'locale: check params if not in path' do
32
+ summary = SimplificatorInfrastructure::ErrorSummary.new(
33
+ 'REQUEST_PATH' => '/xx/bli',
34
+ 'action_dispatch.request.parameters' => {
35
+ 'locale' => 'fr'
36
+ }
37
+ )
38
+ assert_equal :fr, summary.locale
39
+ end
40
+
41
+ test 'locale: check accept header if not in path or params' do
42
+ summary = SimplificatorInfrastructure::ErrorSummary.new(
43
+ 'REQUEST_PATH' => '/xx/bli',
44
+ 'action_dispatch.request.parameters' => {
45
+ 'locale' => 'xx',
46
+ },
47
+ 'HTTP_ACCEPT_LANGUAGE' => 'fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4'
48
+ )
49
+ assert_equal :fr, summary.locale
50
+ end
51
+
52
+ test 'locale: use default if not in path or params or accept header' do
53
+ summary = SimplificatorInfrastructure::ErrorSummary.new(
54
+ 'REQUEST_PATH' => '/xx/bli',
55
+ 'action_dispatch.request.parameters' => {
56
+ 'locale' => 'xx',
57
+ },
58
+ 'HTTP_ACCEPT_LANGUAGE' => 'xx-FR,fr;q=0.8,xx-US;q=0.6,xx;q=0.4'
59
+ )
60
+ assert_equal :de, summary.locale
61
+ end
62
+
63
+
64
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplificator_infrastructure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pascal Betz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-18 00:00:00.000000000 Z
11
+ date: 2015-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -97,29 +97,9 @@ files:
97
97
  - test/dummy/log/development.log
98
98
  - test/dummy/log/test.log
99
99
  - test/dummy/public/favicon.ico
100
- - test/dummy/test/controllers/foos_controller_test.rb
101
- - test/dummy/tmp/cache/assets/development/sprockets/0500adeee201d5a348b4c3ec497adae2
102
- - test/dummy/tmp/cache/assets/development/sprockets/09ed1ef41f7cd9d17777b1411359e566
103
- - test/dummy/tmp/cache/assets/development/sprockets/1344657b8f5d1906efcbafe0e22c17cc
104
- - test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705
105
- - test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af
106
- - test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953
107
- - test/dummy/tmp/cache/assets/development/sprockets/5acaff767402e80bb9961b92c8bc3dda
108
- - test/dummy/tmp/cache/assets/development/sprockets/6d07f71bc133b650e297569a7e19174e
109
- - test/dummy/tmp/cache/assets/development/sprockets/7e3d3b1b8b95a568bcb68e2f29436ca3
110
- - test/dummy/tmp/cache/assets/development/sprockets/7f0315cb615b6ab601fd42d59b8afde9
111
- - test/dummy/tmp/cache/assets/development/sprockets/8861585cc3fb654bbf27d60c86aba449
112
- - test/dummy/tmp/cache/assets/development/sprockets/9c500634b58fe570e801dd477f2f9769
113
- - test/dummy/tmp/cache/assets/development/sprockets/9e70666db09ef523b119125cc9eb73c5
114
- - test/dummy/tmp/cache/assets/development/sprockets/a58c29f74df199333ef9f066c7b436bd
115
- - test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994
116
- - test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6
117
- - test/dummy/tmp/cache/assets/development/sprockets/d7cb110ec211a8c4ef021e93a2f976f7
118
- - test/dummy/tmp/cache/assets/development/sprockets/e303fbe4b122fbe771c62af737c0e1b5
119
- - test/dummy/tmp/cache/assets/development/sprockets/e96855d0fc8137ba701522baf08faf33
120
- - test/dummy/tmp/cache/assets/development/sprockets/f39692dced32f5d36d10caed783739ee
121
- - test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
100
+ - test/dummy/test/integration/error_previews_controller_test.rb
122
101
  - test/integration/navigation_test.rb
102
+ - test/lib/simplificator_infrastructure/error_summary_test.rb
123
103
  - test/simplificator_infrastructure_test.rb
124
104
  - test/test_helper.rb
125
105
  homepage: http://www.simplificator.com
@@ -183,28 +163,8 @@ test_files:
183
163
  - test/dummy/public/favicon.ico
184
164
  - test/dummy/Rakefile
185
165
  - test/dummy/README.rdoc
186
- - test/dummy/test/controllers/foos_controller_test.rb
187
- - test/dummy/tmp/cache/assets/development/sprockets/0500adeee201d5a348b4c3ec497adae2
188
- - test/dummy/tmp/cache/assets/development/sprockets/09ed1ef41f7cd9d17777b1411359e566
189
- - test/dummy/tmp/cache/assets/development/sprockets/1344657b8f5d1906efcbafe0e22c17cc
190
- - test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705
191
- - test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af
192
- - test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953
193
- - test/dummy/tmp/cache/assets/development/sprockets/5acaff767402e80bb9961b92c8bc3dda
194
- - test/dummy/tmp/cache/assets/development/sprockets/6d07f71bc133b650e297569a7e19174e
195
- - test/dummy/tmp/cache/assets/development/sprockets/7e3d3b1b8b95a568bcb68e2f29436ca3
196
- - test/dummy/tmp/cache/assets/development/sprockets/7f0315cb615b6ab601fd42d59b8afde9
197
- - test/dummy/tmp/cache/assets/development/sprockets/8861585cc3fb654bbf27d60c86aba449
198
- - test/dummy/tmp/cache/assets/development/sprockets/9c500634b58fe570e801dd477f2f9769
199
- - test/dummy/tmp/cache/assets/development/sprockets/9e70666db09ef523b119125cc9eb73c5
200
- - test/dummy/tmp/cache/assets/development/sprockets/a58c29f74df199333ef9f066c7b436bd
201
- - test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994
202
- - test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6
203
- - test/dummy/tmp/cache/assets/development/sprockets/d7cb110ec211a8c4ef021e93a2f976f7
204
- - test/dummy/tmp/cache/assets/development/sprockets/e303fbe4b122fbe771c62af737c0e1b5
205
- - test/dummy/tmp/cache/assets/development/sprockets/e96855d0fc8137ba701522baf08faf33
206
- - test/dummy/tmp/cache/assets/development/sprockets/f39692dced32f5d36d10caed783739ee
207
- - test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
166
+ - test/dummy/test/integration/error_previews_controller_test.rb
208
167
  - test/integration/navigation_test.rb
168
+ - test/lib/simplificator_infrastructure/error_summary_test.rb
209
169
  - test/simplificator_infrastructure_test.rb
210
170
  - test/test_helper.rb
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class FoosControllerTest < ActionController::TestCase
4
- # test "the truth" do
5
- # assert true
6
- # end
7
- end