gitlabhq/spec/observers/activity_observer_spec.rb

49 lines
1.2 KiB
Ruby
Raw Normal View History

require 'spec_helper'
describe ActivityObserver do
let(:project) { create(:project) }
2012-02-28 15:48:15 +01:00
def self.it_should_be_valid_event
it { @event.should_not be_nil }
it { @event.project.should == project }
end
describe "Merge Request created" do
before do
MergeRequest.observers.enable :activity_observer do
@merge_request = create(:merge_request, project: project)
@event = Event.last
end
end
2012-02-28 15:48:15 +01:00
it_should_be_valid_event
it { @event.action.should == Event::Created }
it { @event.target.should == @merge_request }
end
describe "Issue created" do
before do
Issue.observers.enable :activity_observer do
@issue = create(:issue, project: project)
@event = Event.last
end
end
2012-02-28 15:48:15 +01:00
it_should_be_valid_event
it { @event.action.should == Event::Created }
it { @event.target.should == @issue }
end
#describe "Issue commented" do
#before do
#@issue = create(:issue, project: project)
#@note = create(:note, noteable: @issue, project: project)
2012-03-07 22:55:46 +01:00
#@event = Event.last
#end
#it_should_be_valid_event
#it { @event.action.should == Event::Commented }
#it { @event.target.should == @note }
#end
end