cp-sparrow 0.0.14 → 0.0.15

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.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.ruby-version +1 -1
  4. data/.travis.yml +2 -5
  5. data/README.md +6 -3
  6. data/Rakefile +8 -7
  7. data/lib/cp-sparrow.rb +1 -0
  8. data/lib/sparrow/configuration.rb +5 -1
  9. data/lib/sparrow/core_ext/hash.rb +22 -17
  10. data/lib/sparrow/dependencies.rb +11 -2
  11. data/lib/sparrow/logger.rb +1 -1
  12. data/lib/sparrow/railtie.rb +3 -3
  13. data/lib/sparrow/request_http_message.rb +1 -1
  14. data/lib/sparrow/response_middleware.rb +5 -5
  15. data/lib/sparrow/route_parser.rb +1 -1
  16. data/lib/sparrow/strategies/ignore.rb +2 -2
  17. data/lib/sparrow/strategies/json_format_strategies/default_json_format_strategy.rb +1 -1
  18. data/lib/sparrow/strategies/json_format_strategies/json_format_strategy.rb +5 -4
  19. data/lib/sparrow/strategies/key_transformation/underscore_key.rb +1 -1
  20. data/lib/sparrow/strategies/transform_params.rb +5 -1
  21. data/lib/sparrow/transformable.rb +8 -8
  22. data/lib/sparrow/version.rb +1 -1
  23. data/sparrow.gemspec +5 -3
  24. data/spec/integration/apps/rack_app/app.rb +22 -5
  25. data/spec/integration/apps/rack_app/config.ru +2 -2
  26. data/spec/integration/apps/rails_app/README.rdoc +15 -248
  27. data/spec/integration/apps/rails_app/Rakefile +1 -2
  28. data/spec/integration/apps/rails_app/app/assets/images/.keep +0 -0
  29. data/spec/integration/apps/rails_app/app/assets/javascripts/application.js +4 -6
  30. data/spec/integration/apps/rails_app/app/assets/stylesheets/application.css +6 -4
  31. data/spec/integration/apps/rails_app/app/controllers/application_controller.rb +3 -1
  32. data/spec/integration/apps/rails_app/app/controllers/concerns/.keep +0 -0
  33. data/spec/integration/apps/rails_app/app/controllers/errors_controller.rb +10 -0
  34. data/spec/integration/apps/rails_app/app/controllers/welcome_controller.rb +0 -5
  35. data/spec/integration/apps/rails_app/app/mailers/.keep +0 -0
  36. data/spec/integration/apps/rails_app/app/models/.keep +0 -0
  37. data/spec/integration/apps/rails_app/app/models/concerns/.keep +0 -0
  38. data/spec/integration/apps/rails_app/app/views/layouts/application.html.erb +3 -3
  39. data/spec/integration/apps/rails_app/bin/bundle +3 -0
  40. data/spec/integration/apps/rails_app/bin/rails +4 -0
  41. data/spec/integration/apps/rails_app/bin/rake +4 -0
  42. data/spec/integration/apps/rails_app/bin/setup +29 -0
  43. data/spec/integration/apps/rails_app/config.ru +2 -2
  44. data/spec/integration/apps/rails_app/config/application.rb +6 -43
  45. data/spec/integration/apps/rails_app/config/boot.rb +4 -9
  46. data/spec/integration/apps/rails_app/config/database.yml +25 -0
  47. data/spec/integration/apps/rails_app/config/environment.rb +3 -3
  48. data/spec/integration/apps/rails_app/config/environments/development.rb +23 -13
  49. data/spec/integration/apps/rails_app/config/environments/production.rb +46 -31
  50. data/spec/integration/apps/rails_app/config/environments/test.rb +20 -10
  51. data/spec/integration/apps/rails_app/config/initializers/assets.rb +11 -0
  52. data/spec/integration/apps/rails_app/config/initializers/cookies_serializer.rb +3 -0
  53. data/spec/integration/apps/rails_app/config/initializers/filter_parameter_logging.rb +4 -0
  54. data/spec/integration/apps/rails_app/config/initializers/inflections.rb +6 -5
  55. data/spec/integration/apps/rails_app/config/initializers/mime_types.rb +0 -1
  56. data/spec/integration/apps/rails_app/config/initializers/secret_token.rb +1 -1
  57. data/spec/integration/apps/rails_app/config/initializers/session_store.rb +1 -6
  58. data/spec/integration/apps/rails_app/config/initializers/wrap_parameters.rb +6 -2
  59. data/spec/integration/apps/rails_app/config/locales/en.yml +20 -2
  60. data/spec/integration/apps/rails_app/config/routes.rb +21 -29
  61. data/spec/integration/apps/rails_app/config/secrets.yml +22 -0
  62. data/spec/integration/apps/rails_app/lib/assets/.keep +0 -0
  63. data/spec/integration/apps/rails_app/public/404.html +54 -13
  64. data/spec/integration/apps/rails_app/public/422.html +54 -13
  65. data/spec/integration/apps/rails_app/public/500.html +53 -12
  66. data/spec/integration/rack/camel_caser_spec.rb +18 -18
  67. data/spec/integration/rack/error_spec.rb +17 -0
  68. data/spec/integration/rails/camel_caser_accept_header_spec.rb +3 -3
  69. data/spec/integration/rails/camel_caser_spec.rb +30 -19
  70. data/spec/spec_helper.rb +1 -2
  71. data/spec/support/rails_app_helper.rb +1 -1
  72. data/spec/unit/configuration_spec.rb +2 -2
  73. metadata +46 -24
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: 75dda1c248b28032a71bdc4492618eb696b43f9e8e0115f4f3d8bb603e3c26051e15aeaa3f0d11c71b35db060f4627766342b3a93a4cdcb10c38a5294e2d1885
15
+
16
+ test:
17
+ secret_key_base: d29a85353762cd6ea8936982d8a62def1850ac37bdbb42305cac6cf987e40c4ea8a6353aa54906260334f055b88d863104f8d250b457e9846c7d4a81fc6f288b
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -2,25 +2,66 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>The page you were looking for doesn't exist (404)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
16
54
  </style>
17
55
  </head>
18
56
 
19
57
  <body>
20
58
  <!-- This file lives in public/404.html -->
21
59
  <div class="dialog">
22
- <h1>The page you were looking for doesn't exist.</h1>
23
- <p>You may have mistyped the address or the page may have moved.</p>
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
24
65
  </div>
25
66
  </body>
26
67
  </html>
@@ -2,25 +2,66 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>The change you wanted was rejected (422)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
16
54
  </style>
17
55
  </head>
18
56
 
19
57
  <body>
20
58
  <!-- This file lives in public/422.html -->
21
59
  <div class="dialog">
22
- <h1>The change you wanted was rejected.</h1>
23
- <p>Maybe you tried to change something you didn't have access to.</p>
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
24
65
  </div>
25
66
  </body>
26
67
  </html>
@@ -2,24 +2,65 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>We're sorry, but something went wrong (500)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
16
54
  </style>
17
55
  </head>
18
56
 
19
57
  <body>
20
58
  <!-- This file lives in public/500.html -->
21
59
  <div class="dialog">
22
- <h1>We're sorry, but something went wrong.</h1>
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
23
64
  </div>
24
65
  </body>
25
66
  </html>
@@ -1,23 +1,23 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "camel caser middleware", type: :rack do
4
-
5
- let(:json) do
6
- MultiJson.dump({userName: "dsci", bar:{ lordFoo: 12 }})
4
+
5
+ let(:json) do
6
+ JSON.generate({userName: "dsci", bar:{ lordFoo: 12 }})
7
7
  end
8
-
9
- context "accept header is given" do
10
-
11
- before do
8
+
9
+ context "accept header is given" do
10
+
11
+ before do
12
12
  post '/', json, {'request-json-format' => 'underscore',
13
13
  'response-json-format' => 'underscore'}
14
14
  end
15
-
16
- subject do
17
- MultiJson.load(last_response.body)
15
+
16
+ subject do
17
+ JSON.parse(last_response.body)
18
18
  end
19
19
 
20
- it "converts lower camelcase to underscore params" do
20
+ it "converts lower camelcase to underscore params" do
21
21
  expect(subject).to have_key("keys")
22
22
  expect(subject["keys"]).to include("user_name")
23
23
  expect(subject["keys"]).to include("bar")
@@ -26,22 +26,22 @@ describe "camel caser middleware", type: :rack do
26
26
  end
27
27
  end
28
28
 
29
- context "accept header is not given" do
30
- before do
29
+ context "default behavior without manual configuration" do
30
+ before do
31
31
  post '/', json
32
32
  end
33
33
 
34
34
  subject do
35
- MultiJson.load(last_response.body)
35
+ JSON.parse(last_response.body)
36
36
  end
37
37
 
38
-
39
- it "did not convert lower camelcase to underscore params" do
38
+
39
+ it "converts incoming camelCase arguments to snake_case" do
40
40
  expect(subject).to have_key("keys")
41
- expect(subject["keys"]).to include("userName")
41
+ expect(subject["keys"]).to include("user_name")
42
42
  end
43
43
 
44
- it 'converted the snake case fake key to camelCase' do
44
+ it 'converted the snake case fake key to camelCase for the response' do
45
45
  expect(subject['fake_key']).to_not be_present
46
46
  expect(subject['fakeKey']).to eq false
47
47
  end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'the reactions when encountering error status', type: :rack do
4
+ context 'when encountering a server error' do
5
+ let(:json) { { error_code: 507 } }
6
+
7
+ before do
8
+ json_string = JSON.generate(json)
9
+ post '/error', json_string, {}
10
+ end
11
+
12
+ it 'delegates the error response without failing' do
13
+ expect(last_response.status).to eq json[:error_code]
14
+ expect(last_response.body).to be_present
15
+ end
16
+ end
17
+ end
@@ -9,7 +9,7 @@ describe "camel caser middleware for Rails", type: :rails do
9
9
  "DE" => 'german'
10
10
  }
11
11
  end
12
- let(:json) { MultiJson.dump(json_object) }
12
+ let(:json) { JSON.generate(json_object) }
13
13
 
14
14
  context "camel caser middleware for Rails with accept header " do
15
15
 
@@ -33,7 +33,7 @@ describe "camel caser middleware for Rails", type: :rails do
33
33
  'CONTENT-TYPE' => 'application/json',
34
34
  'ACCEPT' => 'text/html' }
35
35
 
36
- last_json = MultiJson.load(last_response.body)
36
+ last_json = JSON.parse(last_response.body)
37
37
  expect(last_json['keys']).to include('userName')
38
38
  expect(last_json['keys']).to include('bar')
39
39
  expect(last_json['keys']).to include('DE')
@@ -46,7 +46,7 @@ describe "camel caser middleware for Rails", type: :rails do
46
46
  'CONTENT-TYPE' => 'application/json',
47
47
  'ACCEPT' => 'foo/bar, gate/protect' }
48
48
 
49
- last_json = MultiJson.load(last_response.body)
49
+ last_json = JSON.parse(last_response.body)
50
50
  expect(last_json['keys']).to include('user_name')
51
51
  expect(last_json['keys']).to include('de')
52
52
  end
@@ -10,7 +10,7 @@ describe "camel caser middleware for Rails", type: :rails do
10
10
  "DE" => 'german',
11
11
  }
12
12
  end
13
- let(:json) { MultiJson.dump(json_object) }
13
+ let(:json) { JSON.generate(json_object) }
14
14
 
15
15
  context "accept header is given" do
16
16
 
@@ -21,7 +21,7 @@ describe "camel caser middleware for Rails", type: :rails do
21
21
  'CONTENT-TYPE' => 'application/json' }
22
22
  end
23
23
 
24
- subject { MultiJson.load(last_response.body) }
24
+ subject { JSON.parse(last_response.body) }
25
25
 
26
26
  it "converts lower camelcase to underscore params" do
27
27
  expect(last_response).to be_successful
@@ -40,7 +40,7 @@ describe "camel caser middleware for Rails", type: :rails do
40
40
  'response-json-format' => 'underscore' }
41
41
  end
42
42
 
43
- subject { MultiJson.load(last_response.body) }
43
+ subject { JSON.parse(last_response.body) }
44
44
 
45
45
  it 'should not touch the input keys and the response' do
46
46
  expect(subject).to have_key('camelCase')
@@ -161,7 +161,7 @@ describe "camel caser middleware for Rails", type: :rails do
161
161
  'CONTENT-TYPE' => 'application/json'
162
162
  }
163
163
  end
164
- subject { MultiJson.load(last_response.body) }
164
+ subject { JSON.parse(last_response.body) }
165
165
 
166
166
  it 'should return an array as root element' do
167
167
  expect(subject).to_not have_key("user_options")
@@ -180,18 +180,19 @@ describe "camel caser middleware for Rails", type: :rails do
180
180
  end
181
181
 
182
182
  subject do
183
- MultiJson.load(last_response.body)
183
+ JSON.parse(last_response.body)
184
184
  end
185
185
 
186
186
 
187
- it "did not convert lower camelcase to underscore params" do
187
+ it "converts incoming request parameters to snake_case" do
188
188
  expect(subject).to have_key("keys")
189
- expect(subject["keys"]).to include("userName")
189
+ expect(subject["keys"]).to include("user_name")
190
190
  end
191
191
 
192
- it "did not convert all UPPERCASE words to underscore params" do
192
+ # not touching UPPERCASE params only works for camelizing strategies
193
+ it "converts UPPERCASE params when using underscore strategy" do
193
194
  expect(subject).to have_key("keys")
194
- expect(subject["keys"]).to include("DE")
195
+ expect(subject["keys"]).to include("de")
195
196
  end
196
197
 
197
198
  end
@@ -204,7 +205,7 @@ describe "camel caser middleware for Rails", type: :rails do
204
205
  end
205
206
 
206
207
  subject do
207
- MultiJson.load(last_response.body)
208
+ JSON.parse(last_response.body)
208
209
  end
209
210
 
210
211
  it 'underscores the response' do
@@ -220,7 +221,7 @@ describe "camel caser middleware for Rails", type: :rails do
220
221
  'CONTENT-TYPE' => 'application/json; charset=utf-8'
221
222
  }
222
223
  end
223
- subject { MultiJson.load(last_response.body) }
224
+ subject { JSON.parse(last_response.body) }
224
225
 
225
226
  it 'should return an array as root element' do
226
227
  expect(subject.class).to eq Array
@@ -230,7 +231,7 @@ describe "camel caser middleware for Rails", type: :rails do
230
231
 
231
232
  end
232
233
 
233
- context 'reaction on error responses' do
234
+ describe 'the reaction on error responses' do
234
235
  require 'action_controller/metal/exceptions'
235
236
  it 'lets Rails do its RoutingError when the url is not found' do
236
237
  expect do
@@ -239,9 +240,18 @@ describe "camel caser middleware for Rails", type: :rails do
239
240
  end
240
241
 
241
242
  it 'does not touch the response if a server error gets triggered' do
242
- expect {
243
+ expect do
243
244
  get '/error', {}, { 'CONTENT-TYPE' => 'application/json' }
244
- }.to raise_error ZeroDivisionError
245
+ end.to raise_error ZeroDivisionError
246
+ end
247
+
248
+ it 'does not fail on 507 error' do
249
+ expect do
250
+ get '/error-507', {}, 'CONTENT-TYPE' => 'appliation/json',
251
+ 'Accept' => 'application/json'
252
+ end.to_not raise_error
253
+ expect(last_response.status).to eq 507
254
+ expect(JSON.parse(last_response.body)).to eq({'error_code' => 507})
245
255
  end
246
256
  end
247
257
 
@@ -250,7 +260,7 @@ describe "camel caser middleware for Rails", type: :rails do
250
260
  get '/welcome', json_object, { 'CONTENT_TYPE' => 'text/html',
251
261
  'request-json-format' => 'underscore' }
252
262
 
253
- last_json = MultiJson.load(last_response.body)
263
+ last_json = JSON.parse(last_response.body)
254
264
  expect(last_json).to have_key 'fakeKey'
255
265
  expect(last_json).to have_key 'keys'
256
266
  end
@@ -264,7 +274,7 @@ describe "camel caser middleware for Rails", type: :rails do
264
274
  'response-json-format' => 'underscore',
265
275
  'CONTENT-TYPE' => '' }
266
276
 
267
- last_json = MultiJson.load(last_response.body)
277
+ last_json = JSON.parse(last_response.body)
268
278
  expect(last_json['keys']).to include('userName')
269
279
  expect(last_json['keys']).to include('DE')
270
280
  end
@@ -278,15 +288,16 @@ describe "camel caser middleware for Rails", type: :rails do
278
288
  'response-json-format' => 'underscore',
279
289
  'CONTENT_TYPE' => ''}
280
290
 
281
- last_json = MultiJson.load(last_response.body)
291
+ last_json = JSON.parse(last_response.body)
282
292
  expect(last_json['keys']).to include('user_name')
283
293
  expect(last_json['keys']).to include('bar')
284
294
  # at the moment the "let uppercase as it is"-option only works for
285
295
  # camelCase. This test implies that.
286
296
  expect(last_json['keys']).to include('de')
287
297
  end
288
-
298
+
289
299
  it 'processes everything if content-types configured contains nil and no content-type is sent' do
300
+ skip("Test is the same as above? Removal of content_type will fail the test.")
290
301
  Sparrow.configure do |config|
291
302
  config.allowed_content_types = [nil]
292
303
  end
@@ -295,7 +306,7 @@ describe "camel caser middleware for Rails", type: :rails do
295
306
  'response-json-format' => 'underscore',
296
307
  'CONTENT_TYPE' => ''}
297
308
 
298
- last_json = MultiJson.load(last_response.body)
309
+ last_json = JSON.parse(last_response.body)
299
310
  expect(last_json['keys']).to include('user_name')
300
311
  expect(last_json['keys']).to include('bar')
301
312
  # at the moment the "let uppercase as it is"-option only works for