2012-02-28 09:01:14 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe ActivityObserver do
|
|
|
|
let(:project) { Factory :project }
|
|
|
|
|
2012-02-28 09:48:15 -05:00
|
|
|
def self.it_should_be_valid_event
|
|
|
|
it { @event.should_not be_nil }
|
|
|
|
it { @event.project.should == project }
|
|
|
|
end
|
|
|
|
|
2012-02-28 09:01:14 -05:00
|
|
|
describe "Merge Request created" do
|
2012-06-12 14:27:03 -04:00
|
|
|
before do
|
|
|
|
MergeRequest.observers.enable :activity_observer do
|
2012-08-10 18:07:50 -04:00
|
|
|
@merge_request = Factory :merge_request, project: project
|
2012-06-12 14:27:03 -04:00
|
|
|
@event = Event.last
|
|
|
|
end
|
2012-02-28 09:01:14 -05:00
|
|
|
end
|
|
|
|
|
2012-02-28 09:48:15 -05:00
|
|
|
it_should_be_valid_event
|
2012-02-28 09:01:14 -05:00
|
|
|
it { @event.action.should == Event::Created }
|
|
|
|
it { @event.target.should == @merge_request }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "Issue created" do
|
2012-06-12 14:27:03 -04:00
|
|
|
before do
|
|
|
|
Issue.observers.enable :activity_observer do
|
2012-08-10 18:07:50 -04:00
|
|
|
@issue = Factory :issue, project: project
|
2012-06-12 14:27:03 -04:00
|
|
|
@event = Event.last
|
|
|
|
end
|
2012-02-28 09:01:14 -05:00
|
|
|
end
|
|
|
|
|
2012-02-28 09:48:15 -05:00
|
|
|
it_should_be_valid_event
|
2012-02-28 09:01:14 -05:00
|
|
|
it { @event.action.should == Event::Created }
|
|
|
|
it { @event.target.should == @issue }
|
|
|
|
end
|
|
|
|
|
2012-03-07 16:55:46 -05:00
|
|
|
#describe "Issue commented" do
|
|
|
|
#before do
|
2012-08-10 18:07:50 -04:00
|
|
|
#@issue = Factory :issue, project: project
|
|
|
|
#@note = Factory :note, noteable: @issue, project: project
|
2012-03-07 16:55:46 -05:00
|
|
|
#@event = Event.last
|
|
|
|
#end
|
|
|
|
|
|
|
|
#it_should_be_valid_event
|
|
|
|
#it { @event.action.should == Event::Commented }
|
|
|
|
#it { @event.target.should == @note }
|
|
|
|
#end
|
2012-02-28 09:01:14 -05:00
|
|
|
end
|