debian-mirror-gitlab/spec/workers/create_note_diff_file_worker_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
1,010 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
2018-11-08 19:23:39 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe CreateNoteDiffFileWorker do
2018-11-08 19:23:39 +05:30
describe '#perform' do
let(:diff_note) { create(:diff_note_on_merge_request) }
it 'creates diff file' do
diff_note.note_diff_file.destroy!
expect_any_instance_of(DiffNote).to receive(:create_diff_file)
.and_call_original
described_class.new.perform(diff_note.id)
end
2021-11-18 22:05:49 +05:30
context "when the supplied diff_note_id doesn't belong to an existing DiffNote" do
it "returns nil without raising an error" do
expect_any_instance_of(DiffNote).not_to receive(:create_diff_file)
.and_call_original
described_class.new.perform(non_existing_record_id)
end
end
context "when called with a missing diff_note id" do
it "returns nil without creating diff file" do
expect_any_instance_of(DiffNote).not_to receive(:create_diff_file)
.and_call_original
described_class.new.perform(nil)
end
end
2018-11-08 19:23:39 +05:30
end
end