Added a spec to person, cleaned up some putses
This commit is contained in:
parent
7961d11669
commit
638b71ae28
5 changed files with 7 additions and 6 deletions
|
|
@ -17,7 +17,7 @@ class Person
|
||||||
validates_format_of :url, :with =>
|
validates_format_of :url, :with =>
|
||||||
/^(https?):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\.[a-z]{2,5})?(:[0-9]{1,5})?(\/.*)?$/ix
|
/^(https?):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\.[a-z]{2,5})?(:[0-9]{1,5})?(\/.*)?$/ix
|
||||||
|
|
||||||
|
#validates_uniqueness_of :url
|
||||||
validates_true_for :url, :logic => lambda { self.url_unique?}
|
validates_true_for :url, :logic => lambda { self.url_unique?}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
class User < Person
|
class User < Person
|
||||||
include MongoMapper::Document
|
|
||||||
|
|
||||||
devise :database_authenticatable, :registerable,
|
devise :database_authenticatable, :registerable,
|
||||||
:recoverable, :rememberable, :trackable, :validatable
|
:recoverable, :rememberable, :trackable, :validatable
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ class MessageHandler
|
||||||
end
|
end
|
||||||
|
|
||||||
http.errback {
|
http.errback {
|
||||||
puts query.destination + " failed!"
|
|
||||||
query.try_count +=1
|
query.try_count +=1
|
||||||
@queue.push query unless query.try_count >= NUM_TRIES
|
@queue.push query unless query.try_count >= NUM_TRIES
|
||||||
process
|
process
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,7 @@ module SocketRenderer
|
||||||
|
|
||||||
def self.view_hash(object)
|
def self.view_hash(object)
|
||||||
begin
|
begin
|
||||||
puts "I be working hard"
|
|
||||||
v = view_for(object)
|
v = view_for(object)
|
||||||
puts v.inspect
|
|
||||||
|
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "in failzord " + v.inspect
|
puts "in failzord " + v.inspect
|
||||||
|
|
@ -24,7 +22,6 @@ module SocketRenderer
|
||||||
puts e.message
|
puts e.message
|
||||||
raise e
|
raise e
|
||||||
end
|
end
|
||||||
puts "i made it here"
|
|
||||||
{:class =>object.class.to_s.underscore.pluralize, :html => v}
|
{:class =>object.class.to_s.underscore.pluralize, :html => v}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,12 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Person do
|
describe Person do
|
||||||
|
it 'should not allow two friends with the same url' do
|
||||||
|
friend_one = Factory.create(:friend)
|
||||||
|
friend_two = Factory.build(:friend, :url => friend_one.url)
|
||||||
|
friend_two.valid?.should == false
|
||||||
|
end
|
||||||
|
|
||||||
it 'should not allow a friend with the same url as the user' do
|
it 'should not allow a friend with the same url as the user' do
|
||||||
user = Factory.create(:user)
|
user = Factory.create(:user)
|
||||||
friend = Factory.build(:friend, :url => user.url)
|
friend = Factory.build(:friend, :url => user.url)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue