Don't do expensive things on invalid users
This commit is contained in:
parent
a4f1614fb2
commit
b54164cef8
2 changed files with 4 additions and 1 deletions
|
|
@ -372,6 +372,10 @@ class User
|
|||
|
||||
def setup(opts)
|
||||
self.username = opts[:username]
|
||||
self.valid?
|
||||
errors = self.errors
|
||||
errors.delete :person
|
||||
return if errors.size > 0
|
||||
|
||||
opts[:person] ||= {}
|
||||
opts[:person][:profile] ||= Profile.new
|
||||
|
|
|
|||
|
|
@ -216,7 +216,6 @@ describe User do
|
|||
lambda { User.build(@invalid_params) }.should_not change(Person, :count)
|
||||
end
|
||||
it 'does not generate a key' do
|
||||
pending 'Validate users before generating keys'
|
||||
User.should_receive(:generate_key).exactly(0).times
|
||||
User.build(@invalid_params)
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue