From e7919e364478bc8d32f513b966cbbb7aa596589d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andres=20Keskk=C3=BCla?= Date: Wed, 27 Aug 2014 14:16:43 +0300 Subject: [PATCH] Fixed contact not saving password on create --- app/models/contact.rb | 2 +- spec/models/contact_spec.rb | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 79ca7c971..e0d808c1b 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -124,7 +124,7 @@ class Contact < ActiveRecord::Base } contact_hash[:code] = ph[:id] if type == :create - + contact_hash[:auth_info] = ph[:authInfo][:pw] if type == :create contact_hash.delete_if { |_k, v| v.nil? } end diff --git a/spec/models/contact_spec.rb b/spec/models/contact_spec.rb index c264ce78e..944b8811d 100644 --- a/spec/models/contact_spec.rb +++ b/spec/models/contact_spec.rb @@ -87,10 +87,12 @@ end describe Contact, '.extract_params' do it 'returns params hash'do - ph = { id: '123123', email: 'jdoe@example.com', postalInfo: { name: 'fred', addr: { cc: 'EE' } } } + ph = { id: '123123', email: 'jdoe@example.com', authInfo: { pw: 'asde' }, + postalInfo: { name: 'fred', addr: { cc: 'EE' } } } expect(Contact.extract_attributes(ph)).to eq({ code: '123123', - email: 'jdoe@example.com' + email: 'jdoe@example.com', + auth_info: 'asde' }) end end