Remove email based filter

This commit is contained in:
Daniel Vincent Grippi 2010-09-14 11:22:32 -07:00
parent 7643fb4125
commit 426d038aaf
3 changed files with 1 additions and 32 deletions

View file

@ -63,23 +63,6 @@ class User
######## Making things work ######## ######## Making things work ########
key :email, String key :email, String
validates_true_for :email, :logic => lambda {self.allowed_email? unless email.nil?}
def allowed_email?
allowed_emails = ["@pivotallabs.com", "@joindiaspora.com", "@sofaer.net",
"wchulley@gmail.com", "kimfuh@yahoo.com", "CJichi@yahoo.com",
"madkisso@mit.edu", "bribak@msn.com", "asykley@verizon.net",
"paulhaeberli@gmail.com","bondovatic@gmail.com", "dixon1e@yahoo.com"]
allowed_emails.each{|allowed|
if email.include?(allowed)
return true
end
}
false
end
ensure_index :email ensure_index :email
def method_missing(method, *args) def method_missing(method, *args)

View file

@ -38,7 +38,7 @@ describe Request do
xml = request.to_xml.to_s xml = request.to_xml.to_s
xml.include?(@user.email).should be true xml.include?(@user.person.email).should be true
xml.include?(@user.url).should be true xml.include?(@user.url).should be true
xml.include?(@user.profile.first_name).should be true xml.include?(@user.profile.first_name).should be true
xml.include?(@user.profile.last_name).should be true xml.include?(@user.profile.last_name).should be true

View file

@ -35,20 +35,6 @@ describe User do
user3.created_at.nil?.should be false user3.created_at.nil?.should be false
end end
it 'should not create with disallowed emails' do
proc {
user1 = Factory.create(:user, :email => "kimuh@yahoo.com")
}.should raise_error /Validation failed/
proc {
user2 = Factory.create(:user, :email => "awesome@sobear.net")
}.should raise_error /Validation failed/
proc {
user3 = Factory.create(:user, :email => "steveellis@pivotalabs.com")
}.should raise_error /Validation failed/
end
describe 'profiles' do describe 'profiles' do
it 'should be able to update their profile and send it to their friends' do it 'should be able to update their profile and send it to their friends' do
Factory.create(:person) Factory.create(:person)