2021-01-19 01:10:50 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe Gitlab::Git::WikiPageVersion do
|
|
|
|
let_it_be(:project) { create(:project, :public, :repository) }
|
2021-03-04 19:09:24 -05:00
|
|
|
let_it_be(:user) { create(:user, username: 'someone') }
|
2021-01-19 01:10:50 -05:00
|
|
|
|
2021-03-04 19:09:24 -05:00
|
|
|
describe '#author' do
|
|
|
|
subject(:author) { described_class.new(commit, nil).author }
|
2021-01-19 01:10:50 -05:00
|
|
|
|
|
|
|
context 'user exists in gitlab' do
|
|
|
|
let(:commit) { create(:commit, project: project, author: user) }
|
|
|
|
|
2021-03-04 19:09:24 -05:00
|
|
|
it 'returns the user' do
|
|
|
|
expect(author).to eq user
|
2021-01-19 01:10:50 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'user does not exist in gitlab' do
|
|
|
|
let(:commit) { create(:commit, project: project, author_email: "someone@somewebsite.com") }
|
|
|
|
|
2021-03-04 19:09:24 -05:00
|
|
|
it 'returns nil' do
|
|
|
|
expect(author).to be_nil
|
2021-01-19 01:10:50 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|