summaryrefslogtreecommitdiff
path: root/spec/models/protected_branch_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/protected_branch_spec.rb')
-rw-r--r--spec/models/protected_branch_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/models/protected_branch_spec.rb b/spec/models/protected_branch_spec.rb
index 366de809bed..a3fc09b31fb 100644
--- a/spec/models/protected_branch_spec.rb
+++ b/spec/models/protected_branch_spec.rb
@@ -190,6 +190,14 @@ RSpec.describe ProtectedBranch do
expect(described_class).not_to receive(:matching)
expect(described_class.protected?(project, protected_branch.name)).to eq(true)
end
+
+ it 'sets expires_in for a cache key' do
+ cache_key = described_class.protected_ref_cache_key(project, protected_branch.name)
+
+ expect(Rails.cache).to receive(:fetch).with(cache_key, expires_in: 1.hour)
+
+ described_class.protected?(project, protected_branch.name)
+ end
end
end