summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/import_export/legacy_relation_tree_saver_spec.rb
blob: 0d372def8b0066762bade608385006ad886f5ec3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::ImportExport::LegacyRelationTreeSaver do
  let(:exportable) { create(:group) }
  let(:relation_tree_saver) { described_class.new }
  let(:tree) { {} }

  describe '#serialize' do
    let(:serializer) { instance_double(Gitlab::ImportExport::FastHashSerializer) }

    it 'uses FastHashSerializer' do
      expect(Gitlab::ImportExport::FastHashSerializer)
        .to receive(:new)
        .with(exportable, tree, batch_size: Gitlab::ImportExport::Json::StreamingSerializer::BATCH_SIZE)
        .and_return(serializer)

      expect(serializer).to receive(:execute)

      relation_tree_saver.serialize(exportable, tree)
    end
  end
end