Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
9a5f3283
Commit
9a5f3283
authored
Nov 10, 2011
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
notes should depends on user when destroy
parent
eb96336d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
app/models/user.rb
app/models/user.rb
+4
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+15
-0
No files found.
app/models/user.rb
View file @
9a5f3283
...
@@ -16,6 +16,10 @@ class User < ActiveRecord::Base
...
@@ -16,6 +16,10 @@ class User < ActiveRecord::Base
:foreign_key
=>
:author_id
,
:foreign_key
=>
:author_id
,
:dependent
=>
:destroy
:dependent
=>
:destroy
has_many
:notes
,
:foreign_key
=>
:author_id
,
:dependent
=>
:destroy
has_many
:assigned_issues
,
has_many
:assigned_issues
,
:class_name
=>
"Issue"
,
:class_name
=>
"Issue"
,
:foreign_key
=>
:assignee_id
,
:foreign_key
=>
:assignee_id
,
...
...
spec/models/user_spec.rb
View file @
9a5f3283
...
@@ -18,6 +18,21 @@ describe User do
...
@@ -18,6 +18,21 @@ describe User do
user
=
User
.
new
(
:email
=>
"test@mail.com"
)
user
=
User
.
new
(
:email
=>
"test@mail.com"
)
user
.
identifier
.
should
==
"test_mail.com"
user
.
identifier
.
should
==
"test_mail.com"
end
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
end
# == Schema Information
# == Schema Information
#
#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment