even more spec fixing, postgres throws statement invalids for duplicate keys, luckily record not unique is a subsubclass of it so we can just catch the higher error

This commit is contained in:
Jonne Hass 2011-12-11 04:45:11 +01:00
parent 4582c11dfd
commit d6f98d12e1
2 changed files with 2 additions and 6 deletions

View file

@ -75,7 +75,7 @@ class AspectMembershipsController < ApplicationController
render :text => response_hash.to_json
end
rescue_from ActiveRecord::RecordNotUnique do
rescue_from ActiveRecord::StatementInvalid do
render :text => "Duplicate record rejected.", :status => 400
end

View file

@ -62,7 +62,7 @@ describe User do
it 'does not overwrite old users with factory' do
lambda {
new_user = Factory.create(:user, :id => alice.id)
}.should raise_error ActiveRecord::RecordNotUnique
}.should raise_error ActiveRecord::StatementInvalid
end
it 'does not overwrite old users with create' do
@ -1055,10 +1055,7 @@ describe User do
it 'returns the clearable fields' do
user = Factory.create :user
user.send(:clearable_fields).sort.should == %w{
getting_started
disable_mail
language
email
invitation_token
invitation_sent_at
reset_password_token
@ -1077,7 +1074,6 @@ describe User do
authentication_token
unconfirmed_email
confirm_email_token
show_community_spotlight_in_stream
}.sort
end
end