From d6f98d12e1c5a903e70b8a65448550a958902d50 Mon Sep 17 00:00:00 2001 From: Jonne Hass Date: Sun, 11 Dec 2011 04:45:11 +0100 Subject: [PATCH] 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 --- app/controllers/aspect_memberships_controller.rb | 2 +- spec/models/user_spec.rb | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/controllers/aspect_memberships_controller.rb b/app/controllers/aspect_memberships_controller.rb index 189c1fb5b..d75832bbf 100644 --- a/app/controllers/aspect_memberships_controller.rb +++ b/app/controllers/aspect_memberships_controller.rb @@ -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 diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index a10ca23cf..f2688f8d8 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -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