Skip to content
Snippets Groups Projects
Commit 8c92c313 authored by danielvincent's avatar danielvincent
Browse files

Merge branch 'master' of github.com:diaspora/diaspora

parents 0621aa2f 962f282c
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,7 @@ class Aspect
belongs_to :user, :class_name => 'User'
validates_presence_of :name
validates_uniqueness_of :name, :scope => :user_id
timestamps!
......
......@@ -39,6 +39,21 @@ describe Aspect do
end
end
describe 'validation' do
before do
@aspect = @user.aspect(:name => 'losers')
end
it 'has a unique name for one user' do
aspect2 = @user.aspect(:name => @aspect.name)
aspect2.valid?.should be_false
end
it 'has no uniqueness between users' do
aspect2 = @user2.aspect(:name => @aspect.name)
aspect2.valid?.should be_true
end
end
describe 'querying' do
before do
@aspect = @user.aspect(:name => 'losers')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment