diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-01-24 13:48:33 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-01-24 13:48:33 +0000 |
commit | 65bf7e0d92856d90215ca908751e676393c10618 (patch) | |
tree | febf109d5461c13b856d7a8e3c51cdd2fa1beb18 /spec/models | |
parent | a89aab9c630593524b8a210746d2eb680ac5d102 (diff) | |
parent | 99404a5851a4b8bbba8a5786d7351f2d4b024092 (diff) | |
download | gitlab-ce-65bf7e0d92856d90215ca908751e676393c10618.tar.gz |
Merge branch '24833-Allow-to-search-by-commit-hash-within-project' into 'master'
Allows to search within project by commit's hash #24833
Closes #24833
See merge request !8028
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/commit_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index 0d425ab7fd4..b2202f0fd44 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -351,4 +351,22 @@ eos expect(commit).not_to be_work_in_progress end end + + describe '.valid_hash?' do + it 'checks hash contents' do + expect(described_class.valid_hash?('abcdef01239ABCDEF')).to be true + expect(described_class.valid_hash?("abcdef01239ABCD\nEF")).to be false + expect(described_class.valid_hash?(' abcdef01239ABCDEF ')).to be false + expect(described_class.valid_hash?('Gabcdef01239ABCDEF')).to be false + expect(described_class.valid_hash?('gabcdef01239ABCDEF')).to be false + expect(described_class.valid_hash?('-abcdef01239ABCDEF')).to be false + end + + it 'checks hash length' do + expect(described_class.valid_hash?('a' * 6)).to be false + expect(described_class.valid_hash?('a' * 7)).to be true + expect(described_class.valid_hash?('a' * 40)).to be true + expect(described_class.valid_hash?('a' * 41)).to be false + end + end end |