summaryrefslogtreecommitdiff
path: root/spec/models/user_spec.rb
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2012-08-28 07:01:27 -0400
committerRobert Speicher <rspeicher@gmail.com>2012-08-28 21:22:49 -0400
commit77d06454ededc3beef09db709829ccb687ccc045 (patch)
treed051a03c8753fb8947fe94638120ede631b8041c /spec/models/user_spec.rb
parent0bc909405852135d7f98440193830eba664ea122 (diff)
downloadgitlab-ce-77d06454ededc3beef09db709829ccb687ccc045.tar.gz
Simple model spec changes made possible by new factories
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r--spec/models/user_spec.rb26
1 files changed, 6 insertions, 20 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 265dcef1e77..ebc45fa4710 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -3,11 +3,12 @@ require 'spec_helper'
describe User do
describe "Associations" do
it { should have_many(:projects) }
- it { should have_many(:users_projects) }
- it { should have_many(:issues) }
- it { should have_many(:assigned_issues) }
- it { should have_many(:merge_requests) }
- it { should have_many(:assigned_merge_requests) }
+ it { should have_many(:users_projects).dependent(:destroy) }
+ it { should have_many(:issues).dependent(:destroy) }
+ it { should have_many(:assigned_issues).dependent(:destroy) }
+ it { should have_many(:merge_requests).dependent(:destroy) }
+ it { should have_many(:assigned_merge_requests).dependent(:destroy) }
+ it { should have_many(:notes).dependent(:destroy) }
end
describe "Respond to" do
@@ -49,21 +50,6 @@ describe User do
user = Factory(:user)
user.authentication_token.should_not == ""
end
-
- describe "dependent" do
- before do
- @user = Factory :user
- @note = Factory :note,
- author: @user,
- project: Factory(:project)
- end
-
- it "should destroy all notes with user" do
- Note.find_by_id(@note.id).should_not be_nil
- @user.destroy
- Note.find_by_id(@note.id).should be_nil
- end
- end
end
# == Schema Information
#