2020-04-08 14:13:33 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Gitlab::ImportExport::Error do
|
2020-04-08 14:13:33 +05:30
|
|
|
describe '.permission_error' do
|
|
|
|
subject(:error) do
|
|
|
|
described_class.permission_error(user, importable)
|
|
|
|
end
|
|
|
|
|
|
|
|
let(:user) { build(:user, id: 1) }
|
|
|
|
|
|
|
|
context 'when supplied a project' do
|
|
|
|
let(:importable) { build(:project, id: 1, name: 'project1') }
|
|
|
|
|
|
|
|
it 'returns an error with the correct message' do
|
|
|
|
expect(error.message)
|
|
|
|
.to eq 'User with ID: 1 does not have required permissions for Project: project1 with ID: 1'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when supplied a group' do
|
|
|
|
let(:importable) { build(:group, id: 1, name: 'group1') }
|
|
|
|
|
|
|
|
it 'returns an error with the correct message' do
|
|
|
|
expect(error.message)
|
|
|
|
.to eq 'User with ID: 1 does not have required permissions for Group: group1 with ID: 1'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|