diff options
author | micael.bergeron <micaelbergeron@gmail.com> | 2017-11-22 09:48:09 -0500 |
---|---|---|
committer | micael.bergeron <micaelbergeron@gmail.com> | 2017-12-07 09:01:37 -0500 |
commit | cb6f51ec9b2006f1040cca94119135c92e9a4cd1 (patch) | |
tree | 6331c54f8eab568e134c51ec85a0232372471a16 /spec/lib | |
parent | 716f9cbb415cd425644b1aeae19844b26cc7d6b7 (diff) | |
download | gitlab-ce-cb6f51ec9b2006f1040cca94119135c92e9a4cd1.tar.gz |
add support for the commit reference filter
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/git_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git_spec.rb b/spec/lib/gitlab/git_spec.rb index 494dfe0e595..ce15057dd7d 100644 --- a/spec/lib/gitlab/git_spec.rb +++ b/spec/lib/gitlab/git_spec.rb @@ -38,4 +38,29 @@ describe Gitlab::Git do expect(described_class.ref_name(utf8_invalid_ref)).to eq("an_invalid_ref_å") end end + + describe '.shas_eql?' do + using RSpec::Parameterized::TableSyntax + + where(:sha1, :sha2, :result) do + sha = RepoHelpers.sample_commit.id + short_sha = sha[0, Gitlab::Git::Commit::MIN_SHA_LENGTH] + too_short_sha = sha[0, Gitlab::Git::Commit::MIN_SHA_LENGTH - 1] + + [ + [sha, sha, true], + [sha, short_sha, true], + [sha, sha.reverse, false], + [sha, too_short_sha, false], + [sha, nil, false] + ] + end + + with_them do + it { expect(described_class.shas_eql?(sha1, sha2)).to eq(result) } + it 'is commutative' do + expect(described_class.shas_eql?(sha2, sha1)).to eq(result) + end + end + end end |