gitlabhq/spec/models/activity_observer_spec.rb
Dmitriy Zaporozhets fa07c9d662 register push event
2012-02-28 16:48:15 +02:00

45 lines
1.1 KiB
Ruby

require 'spec_helper'
describe ActivityObserver do
let(:project) { Factory :project }
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
@merge_request = Factory :merge_request, :project => project
@event = Event.last
end
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 = Factory :issue, :project => project
@event = Event.last
end
it_should_be_valid_event
it { @event.action.should == Event::Created }
it { @event.target.should == @issue }
end
describe "Issue commented" do
before do
@issue = Factory :issue, :project => project
@note = Factory :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
end