summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/git/branch_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/git/branch_spec.rb')
-rw-r--r--spec/lib/gitlab/git/branch_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/branch_spec.rb b/spec/lib/gitlab/git/branch_spec.rb
index 9271f635b14..3cc52863976 100644
--- a/spec/lib/gitlab/git/branch_spec.rb
+++ b/spec/lib/gitlab/git/branch_spec.rb
@@ -44,6 +44,16 @@ RSpec.describe Gitlab::Git::Branch, :seed_helper do
end
end
+ describe "#cache_key" do
+ subject { repository.branches.first }
+
+ it "returns a cache key that changes based on changeable values" do
+ digest = Digest::SHA1.hexdigest([subject.name, subject.target, subject.dereferenced_target.sha].join(":"))
+
+ expect(subject.cache_key).to eq("branch:#{digest}")
+ end
+ end
+
describe '#size' do
subject { super().size }