diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-06-01 17:59:18 +0300 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-06-01 17:59:18 +0300 |
commit | 696b0395116f9f973c919b281a1a5df023f22084 (patch) | |
tree | c4666d1a8e8c123d3049a5bf2a9f7ff68c919654 /spec/models | |
parent | 00b00f1edee71d236b0cd5b796bb68f15142911f (diff) |
Explicitly test etag cache invalidation
When a new deployment is created, this will trigger the invalidation on
the etag cache on the environment. This flow is now explicitly tested.
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/deployment_spec.rb | 11 |
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 |