Uncommented test observing comment event
This commit is contained in:
parent
0ff468160e
commit
b79e00881e
|
@ -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
|
||||||
def open?
|
def open?
|
||||||
!closed
|
!closed
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def author_id
|
||||||
|
author_id_of_changes
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -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 ")
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue