Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
e67234f6d8b8
Commit
b79e0088
authored
Dec 14, 2012
by
Dmitriy Zaporozhets
Browse files
Uncommented test observing comment event
parent
0fadb82f9228
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/models/milestone.rb
View file @
e67234f6
...
...
@@ -14,7 +14,7 @@
class
Milestone
<
ActiveRecord
::
Base
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
has_many
:issues
...
...
@@ -68,4 +68,8 @@ def can_be_closed?
def
open?
!
closed
end
def
author_id
author_id_of_changes
end
end
app/observers/activity_observer.rb
View file @
e67234f6
...
...
@@ -2,7 +2,7 @@ class ActivityObserver < ActiveRecord::Observer
observe
:issue
,
:merge_request
,
:note
,
:milestone
def
after_create
(
record
)
event_author_id
=
record
.
author_id
||
record
.
author_id_of_changes
event_author_id
=
record
.
author_id
# Skip status notes
if
record
.
kind_of?
(
Note
)
&&
record
.
note
.
include?
(
"_Status changed to "
)
...
...
spec/observers/activity_observer_spec.rb
View file @
e67234f6
...
...
@@ -34,15 +34,17 @@ def self.it_should_be_valid_event
it
{
@event
.
target
.
should
==
@issue
}
end
#describe "Issue commented" do
#before do
#@issue = create(:issue, project: project)
#@note = create(:note, noteable: @issue, project: project)
#@event = Event.last
#end
#it_should_be_valid_event
#it { @event.action.should == Event::Commented }
#it { @event.target.should == @note }
#end
describe
"Issue commented"
do
before
do
Note
.
observers
.
enable
:activity_observer
do
@issue
=
create
(
:issue
,
project:
project
)
@note
=
create
(
:note
,
noteable:
@issue
,
project:
project
,
author:
@issue
.
author
)
@event
=
Event
.
last
end
end
it_should_be_valid_event
it
{
@event
.
action
.
should
==
Event
::
Commented
}
it
{
@event
.
target
.
should
==
@note
}
end
end
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