diff options
author | Jarka Kadlecova <jarka@gitlab.com> | 2017-08-16 12:41:52 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-08-16 12:41:52 +0300 |
commit | 04ee970cc11719f1391207995674d096c48d5afc (patch) | |
tree | 8a3180327d5623592c2f69da5f931db652eab27c /spec/migrations | |
parent | aae23494393b1c2fc93bd9b39fc57aba7b792e63 (diff) |
Don't create event in Merge Request Create Service
Diffstat (limited to 'spec/migrations')
-rw-r--r-- | spec/migrations/remove_duplicate_mr_events_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/migrations/remove_duplicate_mr_events_spec.rb b/spec/migrations/remove_duplicate_mr_events_spec.rb new file mode 100644 index 00000000000..e393374028f --- /dev/null +++ b/spec/migrations/remove_duplicate_mr_events_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' +require Rails.root.join('db', 'post_migrate', '20170815060945_remove_duplicate_mr_events.rb') + +describe RemoveDuplicateMrEvents, truncate: true do + let(:migration) { described_class.new } + + describe '#up' do + let(:user) { create(:user) } + let(:merge_requests) { create_list(:merge_request, 2) } + let(:issue) { create(:issue) } + let!(:events) do + [ + create(:event, :created, author: user, target: merge_requests.first), + create(:event, :created, author: user, target: merge_requests.first), + create(:event, :updated, author: user, target: merge_requests.first), + create(:event, :created, author: user, target: merge_requests.second), + create(:event, :created, author: user, target: issue), + create(:event, :created, author: user, target: issue) + ] + end + + it 'removes duplicated merge request create records' do + expect { migration.up }.to change { Event.count }.from(6).to(5) + end + end +end |