Permalink
Browse files

Fixed the user model to allow two openid users

  • Loading branch information...
1 parent 2562a56 commit 7ebf90721eaebc7f35dca3c38b2dcdea2c9d4ee8 @jferris committed Oct 19, 2008
Showing with 14 additions and 1 deletion.
  1. +13 −0 test/unit/user_test.rb
  2. +1 −1 vendor/gems/thoughtbot-clearance/lib/clearance/app/models/user.rb
View
13 test/unit/user_test.rb
@@ -137,6 +137,19 @@ class UserTest < Test::Unit::TestCase
assert_equal [@nearby], @user.nearby_stores
end
end
+
+ context "with an existing openid user" do
+ setup { Factory(:user, :openid_identity => 'test', :email => nil) }
+ context "a new openid user" do
+ setup do
+ @user = Factory.build(:user, :openid_identity => 'other', :email => nil)
+ end
+
+ should "be valid" do
+ assert_valid @user
+ end
+ end
+ end
context "an email User" do
setup do
View
2 vendor/gems/thoughtbot-clearance/lib/clearance/app/models/user.rb
@@ -12,7 +12,7 @@ def self.included(base)
validates_presence_of :email, :if => :email_required?
validates_presence_of :password, :if => :password_required?
validates_confirmation_of :password, :if => :password_required?
- validates_uniqueness_of :email
+ validates_uniqueness_of :email, :allow_nil => true
before_save :initialize_salt, :encrypt_password

0 comments on commit 7ebf907

Please sign in to comment.