2016-09-20 12:07:52 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-07-10 10:24:02 -04:00
|
|
|
describe Gitlab::Git do
|
2017-03-23 09:08:39 -04:00
|
|
|
let(:committer_email) { 'user@example.org' }
|
|
|
|
let(:committer_name) { 'John Doe' }
|
2016-09-20 12:07:52 -04:00
|
|
|
|
|
|
|
describe 'committer_hash' do
|
|
|
|
it "returns a hash containing the given email and name" do
|
2017-07-25 13:09:00 -04:00
|
|
|
committer_hash = described_class.committer_hash(email: committer_email, name: committer_name)
|
2016-09-20 12:07:52 -04:00
|
|
|
|
|
|
|
expect(committer_hash[:email]).to eq(committer_email)
|
|
|
|
expect(committer_hash[:name]).to eq(committer_name)
|
|
|
|
expect(committer_hash[:time]).to be_a(Time)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when email is nil' do
|
|
|
|
it "returns nil" do
|
2017-07-25 13:09:00 -04:00
|
|
|
committer_hash = described_class.committer_hash(email: nil, name: committer_name)
|
2016-09-20 12:07:52 -04:00
|
|
|
|
|
|
|
expect(committer_hash).to be_nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when name is nil' do
|
|
|
|
it "returns nil" do
|
2017-07-25 13:09:00 -04:00
|
|
|
committer_hash = described_class.committer_hash(email: committer_email, name: nil)
|
2016-09-20 12:07:52 -04:00
|
|
|
|
|
|
|
expect(committer_hash).to be_nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|