debian-mirror-gitlab/spec/lib/gitlab/git/wiki_page_version_spec.rb
2021-03-08 18:12:59 +05:30

28 lines
743 B
Ruby

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