summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2017-06-01 16:59:18 +0200
committerZ.J. van de Weg <git@zjvandeweg.nl>2017-06-01 16:59:18 +0200
commit696b0395116f9f973c919b281a1a5df023f22084 (patch)
treec4666d1a8e8c123d3049a5bf2a9f7ff68c919654
parent00b00f1edee71d236b0cd5b796bb68f15142911f (diff)
downloadgitlab-ce-zj-realtime-env-list.tar.gz
Explicitly test etag cache invalidationzj-realtime-env-list
When a new deployment is created, this will trigger the invalidation on the etag cache on the environment. This flow is now explicitly tested.
-rw-r--r--spec/models/deployment_spec.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb
index 9e8acb3812b..6f0d2db23c7 100644
--- a/spec/models/deployment_spec.rb
+++ b/spec/models/deployment_spec.rb
@@ -17,10 +17,15 @@ describe Deployment, models: true do
it { is_expected.to validate_presence_of(:sha) }
describe 'after_create callbacks' do
- it 'invalidates the cache for the environment' do
- expect(subject).to receive(:invalidate_cache)
+ let(:environment) { create(:environment) }
+ let(:store) { Gitlab::EtagCaching::Store.new }
- subject.save!
+ it 'invalidates the environment etag cache' do
+ old_value = store.get(environment.etag_cache_key)
+
+ create(:deployment, environment: environment)
+
+ expect(store.get(environment.etag_cache_key)).not_to eq(old_value)
end
end