rename_params 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b0c87289877054fdb0060e0cf54eea6c2336469
4
- data.tar.gz: f0c404e489c7b6a005aaad5fe53772afc9d64982
3
+ metadata.gz: acf76209a4669531b09b1d00e3eef3318ee303e5
4
+ data.tar.gz: 4158052088d08ca8900531ddd8ab304fe2bf9ef7
5
5
  SHA512:
6
- metadata.gz: 38c614188817e1f6d4fc0de57687839248f5638dd5d335a796e0c251b6f73dee60b33f98557b8b599a9987413a6d88599d15455c8bc62294b2f91bb969405af4
7
- data.tar.gz: 9bae578175c0b31724de2b7f8d81bc7d906dd93ae9d20c11472db26dcc85159ac40cb74f648724a50ca2e0543258b1e49da171be352e7aac5dafe494c7331325
6
+ metadata.gz: 2c382593a6087364069e7df3a018f6d289e94ec5dd902e7d982c76178b2d4de12a695bd8df356b211648d6187708915657b784d8d71bc964cf47c3ba7a7719fd
7
+ data.tar.gz: 681b875e1e9db9812c57b73079f1b686392c8566fdf77306c66d9e0da1446daa943d7e7d9837e579d882b5b4a568ba5d842019c1a630b8fae77911d78dc471f7
@@ -23,7 +23,7 @@ module RenameParams
23
23
  end
24
24
 
25
25
  def move(key, target = [], namespace = [])
26
- set(key, delete(key, namespace), target)
26
+ set(key, delete(key, namespace), target) if has_key?(key, namespace)
27
27
  end
28
28
 
29
29
  private
@@ -1,3 +1,3 @@
1
1
  module RenameParams
2
- VERSION = '1.1.1'.freeze
2
+ VERSION = '1.1.2'.freeze
3
3
  end
@@ -285,9 +285,18 @@ describe RenameParams::Macros::Rename, type: :controller do
285
285
  describe 'move_to' do
286
286
  before { routes.draw { get 'update' => 'anonymous#update' } }
287
287
 
288
- it 'renames billing_contact[:name] to contact[:name]' do
289
- put :update, { 'billing_contact' => { 'name' => 'Marcelo' } }
290
- expect(controller.params).to eq('controller' => 'anonymous', 'action' => 'update', 'billing_contact' => {}, 'contact' => { 'name' =>'Marcelo' })
288
+ context 'when sending params' do
289
+ it 'renames billing_contact[:name] to contact[:name]' do
290
+ put :update, { 'billing_contact' => { 'name' => 'Marcelo' } }
291
+ expect(controller.params).to eq('controller' => 'anonymous', 'action' => 'update', 'billing_contact' => {}, 'contact' => { 'name' =>'Marcelo' })
292
+ end
293
+ end
294
+
295
+ context 'when not sending params' do
296
+ it 'leaves params as they were' do
297
+ put :update
298
+ expect(controller.params).to eq('controller' => 'anonymous', 'action' => 'update')
299
+ end
291
300
  end
292
301
  end
293
302
  end
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.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Casiraghi