rename_params 1.1.3 → 2.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4cb3e07380a5fe20a672c77c21d265591081003
4
- data.tar.gz: c1d52eafde3e113008145ed81d74a86362761f3f
3
+ metadata.gz: 240a898147e9a591d68eba3237051bf27e68f6ab
4
+ data.tar.gz: 5d8dcff96bbedc59ad69f08aefdfd0803ab586fe
5
5
  SHA512:
6
- metadata.gz: a0d6589fc167e43b4d357251322734bca76e2bb0f90cbe6fc081f4187397ad7f623903fa38c29b39d9c4cf8ffcbb706a9a0e928b20d5bfb29b7c9afd18b575a8
7
- data.tar.gz: 1262bff9b7728496dd68783472e501dc04bf6b04caf530233d3f1b68a6732f9fc6e5ffcb23fd3ded711c083886f00f2e5ba848401f226bba71cdcfac41d258c4
6
+ metadata.gz: ad6f36a9af86fbbe369aeecdc90d1ae6d96f22d191855844eb6b58d333bea7e0782f3f60b63662a77de20a5f2e239c7848fa52fdf952c4b5dfac9c7aaeb5db17
7
+ data.tar.gz: 928ca1bde3f7623969837c841eacd0798d0f6be57c097c4fe22b819a931378e372e713b6dda18de0c1ab2a118f4a8b0a5c3d91c86f0ace45ec0bfd51a2fa665f
@@ -7,7 +7,7 @@ module RenameParams
7
7
  move_param = args.shift
8
8
  options = build_options(*args)
9
9
 
10
- klass.before_filter(options[:filters]) do |controller|
10
+ klass.before_action(options[:filters]) do |controller|
11
11
  params = RenameParams::Params.new(controller.params, controller)
12
12
  params.move(move_param, options[:to], options[:namespace]) if options[:to]
13
13
  end
@@ -7,7 +7,7 @@ module RenameParams
7
7
  rename_param = args.shift
8
8
  options = build_options(*args)
9
9
 
10
- klass.before_filter options[:filters] do |controller|
10
+ klass.before_action options[:filters] do |controller|
11
11
  params = RenameParams::Params.new(controller.params, controller)
12
12
  params.convert(rename_param, options[:convert], options[:namespace])
13
13
  params.rename(rename_param, options[:to], options[:namespace])
@@ -1,3 +1,3 @@
1
1
  module RenameParams
2
- VERSION = '1.1.3'.freeze
2
+ VERSION = '2.0.0'.freeze
3
3
  end
@@ -12,8 +12,8 @@ describe RenameParams::Macros::Move, type: :controller do
12
12
  before { routes.draw { get 'update' => 'anonymous#update' } }
13
13
 
14
14
  it 'moves billing_contact[:name] to root' do
15
- put :update, { 'billing_contact' => { 'name' => 'Marcelo' } }
16
- expect(controller.params).to eq('controller' => 'anonymous', 'action' => 'update', 'billing_contact' => {}, 'name' => 'Marcelo' )
15
+ put :update, with_params(billing_contact: { name: 'Marcelo' })
16
+ expect(controller.params).to eq(build_params(controller: 'anonymous', action: 'update', billing_contact: {}, name: 'Marcelo'))
17
17
  end
18
18
  end
19
19
  end
@@ -31,8 +31,8 @@ describe RenameParams::Macros::Move, type: :controller do
31
31
  before { routes.draw { get 'update' => 'anonymous#update' } }
32
32
 
33
33
  it 'moves billing_contact[:address][:street] to billing_contact[:street]' do
34
- put :update, { 'billing_contact' => { 'address' => { 'street' => '123 St' } } }
35
- expect(controller.params).to eq('controller' => 'anonymous', 'action' => 'update', 'billing_contact' => { 'address' => {}, 'street' => '123 St' } )
34
+ put :update, with_params(billing_contact: { address: { street: '123 St' } })
35
+ expect(controller.params).to eq(build_params(controller: 'anonymous', action: 'update', billing_contact: { address: {}, street: '123 St' }))
36
36
  end
37
37
  end
38
38
  end
@@ -50,8 +50,8 @@ describe RenameParams::Macros::Move, type: :controller do
50
50
  before { routes.draw { get 'update' => 'anonymous#update' } }
51
51
 
52
52
  it 'moves billing_contact[:name] to contact[:name]' do
53
- put :update, { 'billing_contact' => { 'name' => 'Marcelo' } }
54
- expect(controller.params).to eq('controller' => 'anonymous', 'action' => 'update', 'billing_contact' => {}, 'contact' => { 'name' =>'Marcelo' })
53
+ put :update, with_params(billing_contact: { name: 'Marcelo' })
54
+ expect(controller.params).to eq( build_params(controller: 'anonymous', action: 'update', billing_contact: {}, contact: { name: 'Marcelo' }))
55
55
  end
56
56
  end
57
57
  end
@@ -69,8 +69,8 @@ describe RenameParams::Macros::Move, type: :controller do
69
69
  before { routes.draw { get 'update' => 'anonymous#update' } }
70
70
 
71
71
  it 'moves billing_contact[:name] to contact[:info][:name]' do
72
- put :update, { 'billing_contact' => { 'name' => 'Marcelo' } }
73
- expect(controller.params).to eq('controller' => 'anonymous', 'action' => 'update', 'billing_contact' => {}, 'contact' => { 'info' => { 'name' =>'Marcelo' } })
72
+ put :update, with_params(billing_contact: { name: 'Marcelo' })
73
+ expect(controller.params).to eq(build_params(controller: 'anonymous', action: 'update', billing_contact: {}, contact: { info: { name: 'Marcelo' } }))
74
74
  end
75
75
  end
76
76
  end
@@ -1,6 +1,6 @@
1
1
  describe RenameParams::Macros::Rename, type: :controller do
2
2
  context 'when not filtering' do
3
- let(:default_params) { { 'controller' => 'anonymous', 'action' => 'index' } }
3
+ let(:default_params) { { controller: 'anonymous', action: 'index' } }
4
4
  before { routes.draw { get 'index' => 'anonymous#index' } }
5
5
 
6
6
  describe 'when just renaming params' do
@@ -13,14 +13,14 @@ describe RenameParams::Macros::Rename, type: :controller do
13
13
  end
14
14
 
15
15
  it 'renames username to login' do
16
- get :index, { username: 'aperson' }
17
- expect(controller.params).to eq default_params.merge('login' => 'aperson')
16
+ get :index, with_params(username: 'aperson')
17
+ expect(controller.params).to eq build_params(default_params.merge(login: 'aperson'))
18
18
  end
19
19
 
20
20
  context 'if param is not sent' do
21
21
  it 'leaves params as they were' do
22
22
  get :index
23
- expect(controller.params).to eq default_params
23
+ expect(controller.params).to eq build_params(default_params)
24
24
  end
25
25
  end
26
26
  end
@@ -36,21 +36,21 @@ describe RenameParams::Macros::Rename, type: :controller do
36
36
  end
37
37
 
38
38
  it 'renames admin to role and converts value' do
39
- get :index, { admin: 'true' }
40
- expect(controller.params).to eq default_params.merge('role' => ['admin'])
39
+ get :index, with_params(admin: 'true')
40
+ expect(controller.params).to eq build_params(default_params.merge(role: ['admin']))
41
41
  end
42
42
 
43
43
  context 'if param is not sent' do
44
44
  it 'leaves params as they were' do
45
45
  get :index
46
- expect(controller.params).to eq default_params
46
+ expect(controller.params).to eq build_params(default_params)
47
47
  end
48
48
  end
49
49
 
50
50
  context 'if param is not included in enum' do
51
51
  it 'leaves params as they were' do
52
- get :index, { admin: 'some_value' }
53
- expect(controller.params).to eq default_params.merge('role' => 'some_value')
52
+ get :index, with_params(admin: 'some_value')
53
+ expect(controller.params).to eq build_params(default_params.merge(role: 'some_value'))
54
54
  end
55
55
  end
56
56
  end
@@ -65,14 +65,14 @@ describe RenameParams::Macros::Rename, type: :controller do
65
65
  end
66
66
 
67
67
  it 'renames amount_due to amount_due_in_cents and converts value' do
68
- get :index, { amount_due: 100 }
69
- expect(controller.params).to eq default_params.merge('amount_due_in_cents' => 10000)
68
+ get :index, with_params(amount_due: 100)
69
+ expect(controller.params).to eq build_params(default_params.merge(amount_due_in_cents: 10000))
70
70
  end
71
71
 
72
72
  context 'if param is not sent' do
73
73
  it 'leaves params as they were' do
74
74
  get :index
75
- expect(controller.params).to eq default_params
75
+ expect(controller.params).to eq build_params(default_params)
76
76
  end
77
77
  end
78
78
  end
@@ -93,14 +93,14 @@ describe RenameParams::Macros::Rename, type: :controller do
93
93
  end
94
94
 
95
95
  it 'renames amount_due to amount_due_in_cents and converts value' do
96
- get :index, { amount_due: 100 }
97
- expect(controller.params).to eq default_params.merge('amount_due_in_cents' => 10000)
96
+ get :index, with_params(amount_due: 100)
97
+ expect(controller.params).to eq build_params(default_params.merge(amount_due_in_cents: 10000))
98
98
  end
99
99
 
100
100
  context 'if param is not sent' do
101
101
  it 'leaves params as they were' do
102
102
  get :index
103
- expect(controller.params).to eq default_params
103
+ expect(controller.params).to eq build_params(default_params)
104
104
  end
105
105
  end
106
106
  end
@@ -115,8 +115,8 @@ describe RenameParams::Macros::Rename, type: :controller do
115
115
  end
116
116
 
117
117
  it 'renames admin to role and converts value' do
118
- get :index, { user: { admin: 'true' } }
119
- expect(controller.params).to eq default_params.merge({ 'user' => { 'role' => ['admin'] } })
118
+ get :index, with_params(user: { admin: 'true' })
119
+ expect(controller.params).to eq build_params(default_params.merge({ user: { role: ['admin'] } }))
120
120
  end
121
121
  end
122
122
  end
@@ -132,14 +132,14 @@ describe RenameParams::Macros::Rename, type: :controller do
132
132
  end
133
133
 
134
134
  it 'renames username to login' do
135
- get :index, { 'session' => { 'username' => 'aperson' } }
136
- expect(controller.params).to eq default_params.merge('session' => { 'login' => 'aperson' })
135
+ get :index, with_params('session' => { 'username' => 'aperson' })
136
+ expect(controller.params).to eq build_params(default_params.merge(session: { login: 'aperson' }))
137
137
  end
138
138
 
139
139
  context 'if param is not sent' do
140
140
  it 'leaves params as they were' do
141
- get :index, { 'session' => '' }
142
- expect(controller.params).to eq default_params.merge('session' => '')
141
+ get :index, with_params('session' => '')
142
+ expect(controller.params).to eq build_params(default_params.merge(session: ''))
143
143
  end
144
144
  end
145
145
  end
@@ -154,21 +154,21 @@ describe RenameParams::Macros::Rename, type: :controller do
154
154
  end
155
155
 
156
156
  it 'renames username to login' do
157
- get :index, { 'session' => { 'credentials' => { 'username' => 'aperson' } } }
158
- expect(controller.params).to eq default_params.merge('session' => { 'credentials' => { 'login' => 'aperson' } })
157
+ get :index, with_params('session' => { 'credentials' => { 'username' => 'aperson' } })
158
+ expect(controller.params).to eq build_params(default_params.merge(session: { credentials: { login: 'aperson' } }))
159
159
  end
160
160
 
161
161
  context 'if param is not sent' do
162
162
  it 'leaves params as they were' do
163
- get :index, { 'session' => { 'credentials' => '' } }
164
- expect(controller.params).to eq default_params.merge('session' => { 'credentials' => '' })
163
+ get :index, with_params('session' => { 'credentials' => '' })
164
+ expect(controller.params).to eq build_params(default_params.merge(session: { credentials: '' }))
165
165
  end
166
166
  end
167
167
 
168
168
  context 'if namespace is not sent' do
169
169
  it 'leaves params as they were' do
170
- get :index, { 'session' => '' }
171
- expect(controller.params).to eq default_params.merge('session' => '')
170
+ get :index, with_params('session' => '')
171
+ expect(controller.params).to eq build_params(default_params.merge(session: ''))
172
172
  end
173
173
  end
174
174
  end
@@ -193,8 +193,8 @@ describe RenameParams::Macros::Rename, type: :controller do
193
193
  before { routes.draw { get 'show' => 'anonymous#show' } }
194
194
 
195
195
  it 'renames username to login' do
196
- get :show, { 'username' => 'aperson' }
197
- expect(controller.params).to eq('controller' => 'anonymous', 'action' => 'show', 'login' => 'aperson')
196
+ get :show, with_params(username: 'aperson')
197
+ expect(controller.params).to eq(build_params(controller: 'anonymous', action: 'show', login: 'aperson'))
198
198
  end
199
199
  end
200
200
 
@@ -202,8 +202,8 @@ describe RenameParams::Macros::Rename, type: :controller do
202
202
  before { routes.draw { get 'index' => 'anonymous#index' } }
203
203
 
204
204
  it 'keeps username param' do
205
- get :index, { 'username' => 'aperson' }
206
- expect(controller.params).to eq('controller' => 'anonymous', 'action' => 'index', 'username' => 'aperson')
205
+ get :index, with_params(username: 'aperson')
206
+ expect(controller.params).to eq(build_params(controller: 'anonymous', action: 'index', username: 'aperson'))
207
207
  end
208
208
  end
209
209
  end
@@ -225,8 +225,8 @@ describe RenameParams::Macros::Rename, type: :controller do
225
225
  before { routes.draw { get 'show' => 'anonymous#show' } }
226
226
 
227
227
  it 'keeps username param' do
228
- get :show, { 'username' => 'aperson' }
229
- expect(controller.params).to eq('controller' => 'anonymous', 'action' => 'show', 'username' => 'aperson')
228
+ get :show, with_params(username: 'aperson')
229
+ expect(controller.params).to eq(build_params(controller: 'anonymous', action: 'show', username: 'aperson'))
230
230
  end
231
231
  end
232
232
 
@@ -234,8 +234,8 @@ describe RenameParams::Macros::Rename, type: :controller do
234
234
  before { routes.draw { get 'index' => 'anonymous#index' } }
235
235
 
236
236
  it 'renames username to login' do
237
- get :index, { 'username' => 'aperson' }
238
- expect(controller.params).to eq('controller' => 'anonymous', 'action' => 'index', 'login' => 'aperson')
237
+ get :index, with_params(username: 'aperson')
238
+ expect(controller.params).to eq(build_params(controller: 'anonymous', action: 'index', login: 'aperson'))
239
239
  end
240
240
  end
241
241
  end
@@ -255,8 +255,8 @@ describe RenameParams::Macros::Rename, type: :controller do
255
255
  before { routes.draw { get 'update' => 'anonymous#update' } }
256
256
 
257
257
  it 'renames billing_contact[:name] to billing_contact_name' do
258
- put :update, { 'billing_contact' => { 'name' => 'Marcelo' } }
259
- expect(controller.params).to eq('controller' => 'anonymous', 'action' => 'update', 'billing_contact' => {}, 'billing_contact_name' => 'Marcelo' )
258
+ put :update, with_params(billing_contact: { name: 'Marcelo' })
259
+ expect(controller.params).to eq(build_params(controller: 'anonymous', action: 'update', billing_contact: {}, billing_contact_name: 'Marcelo'))
260
260
  end
261
261
  end
262
262
  end
@@ -274,8 +274,8 @@ describe RenameParams::Macros::Rename, type: :controller do
274
274
  before { routes.draw { get 'update' => 'anonymous#update' } }
275
275
 
276
276
  it 'renames billing_contact[:address][:street] to billing_contact[:street_address]' do
277
- put :update, { 'billing_contact' => { 'address' => { 'street' => '123 St' } } }
278
- expect(controller.params).to eq('controller' => 'anonymous', 'action' => 'update', 'billing_contact' => { 'address' => {}, 'address_street' => '123 St' } )
277
+ put :update, with_params(billing_contact: { address: { street: '123 St' } })
278
+ expect(controller.params).to eq(build_params(controller: 'anonymous', action: 'update', billing_contact: { address: {}, address_street: '123 St' } ))
279
279
  end
280
280
  end
281
281
  end
@@ -294,15 +294,15 @@ describe RenameParams::Macros::Rename, type: :controller do
294
294
 
295
295
  context 'when sending params' do
296
296
  it 'renames billing_contact[:name] to contact[:name]' do
297
- put :update, { 'billing_contact' => { 'name' => 'Marcelo' } }
298
- expect(controller.params).to eq('controller' => 'anonymous', 'action' => 'update', 'billing_contact' => {}, 'contact' => { 'name' =>'Marcelo' })
297
+ put :update, with_params(billing_contact: { name: 'Marcelo' })
298
+ expect(controller.params).to eq(build_params(controller: 'anonymous', action: 'update', billing_contact: {}, contact: { name: 'Marcelo' }))
299
299
  end
300
300
  end
301
301
 
302
302
  context 'when not sending params' do
303
303
  it 'leaves params as they were' do
304
304
  put :update
305
- expect(controller.params).to eq('controller' => 'anonymous', 'action' => 'update')
305
+ expect(controller.params).to eq(build_params(controller: 'anonymous', action: 'update'))
306
306
  end
307
307
  end
308
308
  end
@@ -321,8 +321,8 @@ describe RenameParams::Macros::Rename, type: :controller do
321
321
  before { routes.draw { get 'update' => 'anonymous#update' } }
322
322
 
323
323
  it 'renames billing_contact[:name] to contact[:info][:name]' do
324
- put :update, { 'billing_contact' => { 'name' => 'Marcelo' } }
325
- expect(controller.params).to eq('controller' => 'anonymous', 'action' => 'update', 'billing_contact' => {}, 'contact' => { 'info' => { 'name' =>'Marcelo' } })
324
+ put :update, with_params(billing_contact: { name: 'Marcelo' })
325
+ expect(controller.params).to eq(build_params(controller: 'anonymous', action: 'update', billing_contact: {}, contact: { info: { 'name' =>'Marcelo' } }))
326
326
  end
327
327
  end
328
328
  end
@@ -337,8 +337,8 @@ describe RenameParams::Macros::Rename, type: :controller do
337
337
  end
338
338
 
339
339
  it 'renames admin to role and converts value' do
340
- get :index, { user: { admin: 'true' } }
341
- expect(controller.params).to eq('controller' => 'anonymous', 'action' => 'index', 'user' => {}, 'role' => ['admin'])
340
+ get :index, with_params(user: { admin: 'true' })
341
+ expect(controller.params).to eq(build_params(controller: 'anonymous', action: 'index', user: {}, role: ['admin']))
342
342
  end
343
343
  end
344
344
  end
data/spec/rails_helper.rb CHANGED
@@ -4,4 +4,22 @@ require 'rspec/rails'
4
4
  RSpec.configure do |config|
5
5
  config.infer_spec_type_from_file_location!
6
6
  config.filter_rails_from_backtrace!
7
- end
7
+
8
+ def build_params(params = {})
9
+ params.each_with_object(ActionController::Parameters.new) do |(key, value), memo|
10
+ if value.is_a?(Hash)
11
+ memo[key] = build_params(value)
12
+ else
13
+ memo[key] = value
14
+ end
15
+ end
16
+ end
17
+
18
+ def with_params(params = {})
19
+ if Rails.version.start_with?('5')
20
+ { params: params }
21
+ else
22
+ params
23
+ end
24
+ end
25
+ end
data/spec/spec_helper.rb CHANGED
@@ -3,13 +3,16 @@ ENV['DATABASE_URL'] = 'sqlite3://localhost/tmp/rename_params_test'
3
3
 
4
4
  require 'bundler/setup'
5
5
  require 'rails'
6
- case Rails.version
7
- when '3.2.22.5'
8
- require 'support/apps/rails3_2'
9
- when '4.2.7.1'
10
- require 'support/apps/rails4_2'
11
- when '5.0.0.1'
12
- require 'support/apps/rails5_0'
6
+ if Rails.version.start_with?('4.0')
7
+ require 'support/apps/rails4_0'
8
+ elsif Rails.version.start_with?('4.1')
9
+ require 'support/apps/rails4_1'
10
+ elsif Rails.version.start_with?('4.2')
11
+ require 'support/apps/rails4_2'
12
+ elsif Rails.version.start_with?('5.0')
13
+ require 'support/apps/rails5_0'
14
+ elsif Rails.version.start_with?('5.1')
15
+ require 'support/apps/rails5_1'
13
16
  end
14
17
  require 'rename_params'
15
18
 
@@ -0,0 +1,44 @@
1
+ require 'rails/all'
2
+
3
+ module Rails40
4
+ class Application < Rails::Application
5
+ # Settings specified here will take precedence over those in config/application.rb.
6
+
7
+ # The test environment is used exclusively to run your application's
8
+ # test suite. You never need to work with it otherwise. Remember that
9
+ # your test database is "scratch space" for the test suite and is wiped
10
+ # and recreated between test runs. Don't rely on the data there!
11
+ config.cache_classes = true
12
+
13
+ # Do not eager load code on boot. This avoids loading your whole application
14
+ # just for the purpose of running a single test. If you are using a tool that
15
+ # preloads Rails for running tests, you may have to set it to true.
16
+ config.eager_load = false
17
+
18
+ # Configure static asset server for tests with Cache-Control for performance.
19
+ config.serve_static_assets = true
20
+ config.static_cache_control = "public, max-age=3600"
21
+
22
+ # Show full error reports and disable caching.
23
+ config.consider_all_requests_local = true
24
+ config.action_controller.perform_caching = false
25
+
26
+ # Raise exceptions instead of rendering exception templates.
27
+ config.action_dispatch.show_exceptions = false
28
+
29
+ # Disable request forgery protection in test environment.
30
+ config.action_controller.allow_forgery_protection = false
31
+
32
+ # Tell Action Mailer not to deliver emails to the real world.
33
+ # The :test delivery method accumulates sent emails in the
34
+ # ActionMailer::Base.deliveries array.
35
+ config.action_mailer.delivery_method = :test
36
+
37
+ # Print deprecation notices to the stderr.
38
+ config.active_support.deprecation = :stderr
39
+
40
+ config.secret_key_base = '49837489qkuweoiuoqwehisuakshdjksadhaisdy78o34y138974xyqp9rmye8yrpiokeuioqwzyoiuxftoyqiuxrhm3iou1hrzmjk'
41
+ end
42
+ end
43
+
44
+ Rails.application.initialize!
@@ -0,0 +1,47 @@
1
+ require 'rails/all'
2
+
3
+ module Rails41
4
+ class Application < Rails::Application
5
+ # Settings specified here will take precedence over those in config/application.rb.
6
+
7
+ # The test environment is used exclusively to run your application's
8
+ # test suite. You never need to work with it otherwise. Remember that
9
+ # your test database is "scratch space" for the test suite and is wiped
10
+ # and recreated between test runs. Don't rely on the data there!
11
+ config.cache_classes = true
12
+
13
+ # Do not eager load code on boot. This avoids loading your whole application
14
+ # just for the purpose of running a single test. If you are using a tool that
15
+ # preloads Rails for running tests, you may have to set it to true.
16
+ config.eager_load = false
17
+
18
+ # Configure static asset server for tests with Cache-Control for performance.
19
+ config.serve_static_assets = true
20
+ config.static_cache_control = 'public, max-age=3600'
21
+
22
+ # Show full error reports and disable caching.
23
+ config.consider_all_requests_local = true
24
+ config.action_controller.perform_caching = false
25
+
26
+ # Raise exceptions instead of rendering exception templates.
27
+ config.action_dispatch.show_exceptions = false
28
+
29
+ # Disable request forgery protection in test environment.
30
+ config.action_controller.allow_forgery_protection = false
31
+
32
+ # Tell Action Mailer not to deliver emails to the real world.
33
+ # The :test delivery method accumulates sent emails in the
34
+ # ActionMailer::Base.deliveries array.
35
+ config.action_mailer.delivery_method = :test
36
+
37
+ # Print deprecation notices to the stderr.
38
+ config.active_support.deprecation = :stderr
39
+
40
+ # Raises error for missing translations
41
+ # config.action_view.raise_on_missing_translations = true
42
+
43
+ config.secret_key_base = '49837489qkuweoiuoqwehisuakshdjksadhaisdy78o34y138974xyqp9rmye8yrpiokeuioqwzyoiuxftoyqiuxrhm3iou1hrzmjk'
44
+ end
45
+ end
46
+
47
+ Rails.application.initialize!
@@ -0,0 +1,50 @@
1
+ require 'rails/all'
2
+
3
+ module Rails51
4
+ class Application < Rails::Application
5
+ # Settings specified here will take precedence over those in config/application.rb.
6
+
7
+ # The test environment is used exclusively to run your application's
8
+ # test suite. You never need to work with it otherwise. Remember that
9
+ # your test database is "scratch space" for the test suite and is wiped
10
+ # and recreated between test runs. Don't rely on the data there!
11
+ config.cache_classes = true
12
+
13
+ # Do not eager load code on boot. This avoids loading your whole application
14
+ # just for the purpose of running a single test. If you are using a tool that
15
+ # preloads Rails for running tests, you may have to set it to true.
16
+ config.eager_load = false
17
+
18
+ # Configure public file server for tests with Cache-Control for performance.
19
+ config.public_file_server.enabled = true
20
+ config.public_file_server.headers = {
21
+ 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
22
+ }
23
+
24
+ # Show full error reports and disable caching.
25
+ config.consider_all_requests_local = true
26
+ config.action_controller.perform_caching = false
27
+
28
+ # Raise exceptions instead of rendering exception templates.
29
+ config.action_dispatch.show_exceptions = false
30
+
31
+ # Disable request forgery protection in test environment.
32
+ config.action_controller.allow_forgery_protection = false
33
+ config.action_mailer.perform_caching = false
34
+
35
+ # Tell Action Mailer not to deliver emails to the real world.
36
+ # The :test delivery method accumulates sent emails in the
37
+ # ActionMailer::Base.deliveries array.
38
+ config.action_mailer.delivery_method = :test
39
+
40
+ # Print deprecation notices to the stderr.
41
+ config.active_support.deprecation = :stderr
42
+
43
+ # Raises error for missing translations
44
+ # config.action_view.raise_on_missing_translations = true
45
+
46
+ config.secret_key_base = '49837489qkuweoiuoqwehisuakshdjksadhaisdy78o34y138974xyqp9rmye8yrpiokeuioqwzyoiuxftoyqiuxrhm3iou1hrzmjk'
47
+ end
48
+ end
49
+
50
+ Rails.application.initialize!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rename_params
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Casiraghi
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.2'
19
+ version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '3.2'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionpack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '3.2'
33
+ version: '4.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '3.2'
40
+ version: '4.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -145,10 +145,12 @@ files:
145
145
  - spec/params_spec.rb
146
146
  - spec/rails_helper.rb
147
147
  - spec/spec_helper.rb
148
- - spec/support/apps/rails3_2.rb
148
+ - spec/support/apps/rails4_0.rb
149
+ - spec/support/apps/rails4_1.rb
149
150
  - spec/support/apps/rails4_2.rb
150
151
  - spec/support/apps/rails5_0.rb
151
- homepage: http://rubygems.org/gems/rename_params
152
+ - spec/support/apps/rails5_1.rb
153
+ homepage: https://github.com/marceloeloelo/rename_params
152
154
  licenses:
153
155
  - MIT
154
156
  metadata: {}
@@ -168,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
170
  version: '0'
169
171
  requirements: []
170
172
  rubyforge_project:
171
- rubygems_version: 2.5.1
173
+ rubygems_version: 2.6.10
172
174
  signing_key:
173
175
  specification_version: 4
174
176
  summary: Simple params renaming for Rails applications
@@ -180,6 +182,8 @@ test_files:
180
182
  - spec/params_spec.rb
181
183
  - spec/rails_helper.rb
182
184
  - spec/spec_helper.rb
183
- - spec/support/apps/rails3_2.rb
185
+ - spec/support/apps/rails4_0.rb
186
+ - spec/support/apps/rails4_1.rb
184
187
  - spec/support/apps/rails4_2.rb
185
188
  - spec/support/apps/rails5_0.rb
189
+ - spec/support/apps/rails5_1.rb
@@ -1,87 +0,0 @@
1
- require 'rails/all'
2
-
3
- module Rails32
4
- class Application < Rails::Application
5
- # Custom directories with classes and modules you want to be autoloadable.
6
- # config.autoload_paths += %W(#{config.root}/extras)
7
-
8
- # Only load the plugins named here, in the order given (default is alphabetical).
9
- # :all can be used as a placeholder for all plugins not explicitly named.
10
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
11
-
12
- # Activate observers that should always be running.
13
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
14
-
15
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17
- # config.time_zone = 'Central Time (US & Canada)'
18
-
19
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21
- # config.i18n.default_locale = :de
22
-
23
- # Configure the default encoding used in templates for Ruby 1.9.
24
- config.encoding = "utf-8"
25
-
26
- # Configure sensitive parameters which will be filtered from the log file.
27
- config.filter_parameters += [:password]
28
-
29
- # Enable escaping HTML in JSON.
30
- config.active_support.escape_html_entities_in_json = true
31
-
32
- # Use SQL instead of Active Record's schema dumper when creating the database.
33
- # This is necessary if your schema can't be completely dumped by the schema dumper,
34
- # like if you have constraints or database-specific column types
35
- # config.active_record.schema_format = :sql
36
-
37
- # Enforce whitelist mode for mass assignment.
38
- # This will create an empty whitelist of attributes available for mass-assignment for all models
39
- # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
40
- # parameters by using an attr_accessible or attr_protected declaration.
41
- config.active_record.whitelist_attributes = true
42
-
43
- # Enable the asset pipeline
44
- config.assets.enabled = true
45
-
46
- # Version of your assets, change this if you want to expire all your assets
47
- config.assets.version = '1.0'
48
-
49
- # Settings specified here will take precedence over those in config/application.rb
50
-
51
- # The test environment is used exclusively to run your application's
52
- # test suite. You never need to work with it otherwise. Remember that
53
- # your test database is "scratch space" for the test suite and is wiped
54
- # and recreated between test runs. Don't rely on the data there!
55
- config.cache_classes = true
56
-
57
- # Configure static asset server for tests with Cache-Control for performance
58
- config.serve_static_assets = true
59
- config.static_cache_control = "public, max-age=3600"
60
-
61
- # Log error messages when you accidentally call methods on nil
62
- config.whiny_nils = true
63
-
64
- # Show full error reports and disable caching
65
- config.consider_all_requests_local = true
66
- config.action_controller.perform_caching = false
67
-
68
- # Raise exceptions instead of rendering exception templates
69
- config.action_dispatch.show_exceptions = false
70
-
71
- # Disable request forgery protection in test environment
72
- config.action_controller.allow_forgery_protection = false
73
-
74
- # Tell Action Mailer not to deliver emails to the real world.
75
- # The :test delivery method accumulates sent emails in the
76
- # ActionMailer::Base.deliveries array.
77
- config.action_mailer.delivery_method = :test
78
-
79
- # Raise exception on mass assignment protection for Active Record models
80
- config.active_record.mass_assignment_sanitizer = :strict
81
-
82
- # Print deprecation notices to the stderr
83
- config.active_support.deprecation = :stderr
84
- end
85
- end
86
-
87
- Rails32::Application.initialize!