blob: 2b1a4b7bb611ef3973de3ea690d4ed4cce084024 (
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::ImportExport::LogUtil do
describe '.exportable_to_log_payload' do
subject { described_class.exportable_to_log_payload(exportable) }
context 'when exportable is a group' do
let(:exportable) { build_stubbed(:group) }
it 'returns hash with group keys' do
expect(subject).to be_a(Hash)
expect(subject.keys).to eq(%i[group_id group_name group_path])
end
end
context 'when exportable is a project' do
let(:exportable) { build_stubbed(:project) }
it 'returns hash with project keys' do
expect(subject).to be_a(Hash)
expect(subject.keys).to eq(%i[project_id project_name project_path])
end
end
context 'when exportable is a new record' do
let(:exportable) { Project.new }
it 'returns empty hash' do
expect(subject).to eq({})
end
end
context 'when exportable is an unexpected type' do
let(:exportable) { build_stubbed(:issue) }
it 'returns empty hash' do
expect(subject).to eq({})
end
end
end
end
|