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
Kazuhiko Shiozaki
gitlab-ce
Commits
b79e0088
Commit
b79e0088
authored
12 years ago
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Uncommented test observing comment event
parent
0ff46816
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
13 deletions
+19
-13
app/models/milestone.rb
app/models/milestone.rb
+5
-1
app/observers/activity_observer.rb
app/observers/activity_observer.rb
+1
-1
spec/observers/activity_observer_spec.rb
spec/observers/activity_observer_spec.rb
+13
-11
No files found.
app/models/milestone.rb
View file @
b79e0088
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
class
Milestone
<
ActiveRecord
::
Base
class
Milestone
<
ActiveRecord
::
Base
attr_accessible
:title
,
:description
,
:due_date
,
:closed
,
:author_id_of_changes
attr_accessible
:title
,
:description
,
:due_date
,
:closed
,
:author_id_of_changes
attr_accessor
:author_id
,
:author_id
_of_changes
attr_accessor
:author_id_of_changes
belongs_to
:project
belongs_to
:project
has_many
:issues
has_many
:issues
...
@@ -68,4 +68,8 @@ class Milestone < ActiveRecord::Base
...
@@ -68,4 +68,8 @@ class Milestone < ActiveRecord::Base
def
open?
def
open?
!
closed
!
closed
end
end
def
author_id
author_id_of_changes
end
end
end
This diff is collapsed.
Click to expand it.
app/observers/activity_observer.rb
View file @
b79e0088
...
@@ -2,7 +2,7 @@ class ActivityObserver < ActiveRecord::Observer
...
@@ -2,7 +2,7 @@ class ActivityObserver < ActiveRecord::Observer
observe
:issue
,
:merge_request
,
:note
,
:milestone
observe
:issue
,
:merge_request
,
:note
,
:milestone
def
after_create
(
record
)
def
after_create
(
record
)
event_author_id
=
record
.
author_id
||
record
.
author_id_of_changes
event_author_id
=
record
.
author_id
# Skip status notes
# Skip status notes
if
record
.
kind_of?
(
Note
)
&&
record
.
note
.
include?
(
"_Status changed to "
)
if
record
.
kind_of?
(
Note
)
&&
record
.
note
.
include?
(
"_Status changed to "
)
...
...
This diff is collapsed.
Click to expand it.
spec/observers/activity_observer_spec.rb
View file @
b79e0088
...
@@ -34,15 +34,17 @@ describe ActivityObserver do
...
@@ -34,15 +34,17 @@ describe ActivityObserver do
it
{
@event
.
target
.
should
==
@issue
}
it
{
@event
.
target
.
should
==
@issue
}
end
end
#describe "Issue commented" do
describe
"Issue commented"
do
#before do
before
do
#@issue = create(:issue, project: project)
Note
.
observers
.
enable
:activity_observer
do
#@note = create(:note, noteable: @issue, project: project)
@issue
=
create
(
:issue
,
project:
project
)
#@event = Event.last
@note
=
create
(
:note
,
noteable:
@issue
,
project:
project
,
author:
@issue
.
author
)
#end
@event
=
Event
.
last
end
#it_should_be_valid_event
end
#it { @event.action.should == Event::Commented }
#it { @event.target.should == @note }
it_should_be_valid_event
#end
it
{
@event
.
action
.
should
==
Event
::
Commented
}
it
{
@event
.
target
.
should
==
@note
}
end
end
end
This diff is collapsed.
Click to expand it.
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