gitlab-org--gitlab-foss/spec/lib/gitlab/git_spec.rb
Rémy Coutable 4e3516788f Don't use FFaker in factories, use sequences instead
FFaker can generate data that randomly break our test suite. This
simplifies our factories and use sequences which are more predictive.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-04-03 18:54:48 +02:00

32 lines
937 B
Ruby

require 'spec_helper'
describe Gitlab::Git, lib: true do
let(:committer_email) { 'user@example.org' }
let(:committer_name) { 'John Doe' }
describe 'committer_hash' do
it "returns a hash containing the given email and name" do
committer_hash = Gitlab::Git.committer_hash(email: committer_email, name: committer_name)
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
committer_hash = Gitlab::Git.committer_hash(email: nil, name: committer_name)
expect(committer_hash).to be_nil
end
end
context 'when name is nil' do
it "returns nil" do
committer_hash = Gitlab::Git.committer_hash(email: committer_email, name: nil)
expect(committer_hash).to be_nil
end
end
end
end