Commit 45e6abffb422045dd30c3f1c74dd14186a23741d
1 parent
ba87b76d
Exists in
spb-stable
and in
3 other branches
Remove activity observer specs
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
1 changed file
with
0 additions
and
61 deletions
Show diff stats
spec/observers/activity_observer_spec.rb
| ... | ... | @@ -1,61 +0,0 @@ |
| 1 | -require 'spec_helper' | |
| 2 | - | |
| 3 | -describe ActivityObserver do | |
| 4 | - let(:project) { create(:project) } | |
| 5 | - | |
| 6 | - before { Thread.current[:current_user] = create(:user) } | |
| 7 | - | |
| 8 | - def self.it_should_be_valid_event | |
| 9 | - it { @event.should_not be_nil } | |
| 10 | - it { @event.project.should == project } | |
| 11 | - end | |
| 12 | - | |
| 13 | - describe "Issue created" do | |
| 14 | - before do | |
| 15 | - Issue.observers.enable :activity_observer do | |
| 16 | - @issue = create(:issue, project: project) | |
| 17 | - @event = Event.last | |
| 18 | - end | |
| 19 | - end | |
| 20 | - | |
| 21 | - it_should_be_valid_event | |
| 22 | - it { @event.action.should == Event::CREATED } | |
| 23 | - it { @event.target.should == @issue } | |
| 24 | - end | |
| 25 | - | |
| 26 | - describe "Issue commented" do | |
| 27 | - before do | |
| 28 | - Note.observers.enable :activity_observer do | |
| 29 | - @issue = create(:issue, project: project) | |
| 30 | - @note = create(:note, noteable: @issue, project: project, author: @issue.author) | |
| 31 | - @event = Event.last | |
| 32 | - end | |
| 33 | - end | |
| 34 | - | |
| 35 | - it_should_be_valid_event | |
| 36 | - it { @event.action.should == Event::COMMENTED } | |
| 37 | - it { @event.target.should == @note } | |
| 38 | - end | |
| 39 | - | |
| 40 | - describe "Ignore system notes" do | |
| 41 | - let(:author) { create(:user) } | |
| 42 | - let!(:issue) { create(:issue, project: project) } | |
| 43 | - let!(:other) { create(:issue) } | |
| 44 | - | |
| 45 | - it "should not create events for status change notes" do | |
| 46 | - expect do | |
| 47 | - Note.observers.enable :activity_observer do | |
| 48 | - Note.create_status_change_note(issue, project, author, 'reopened', nil) | |
| 49 | - end | |
| 50 | - end.to_not change { Event.count } | |
| 51 | - end | |
| 52 | - | |
| 53 | - it "should not create events for cross-reference notes" do | |
| 54 | - expect do | |
| 55 | - Note.observers.enable :activity_observer do | |
| 56 | - Note.create_cross_reference_note(issue, other, author, issue.project) | |
| 57 | - end | |
| 58 | - end.to_not change { Event.count } | |
| 59 | - end | |
| 60 | - end | |
| 61 | -end |