Commit f4aa0105 authored by Z.J. van de Weg's avatar Z.J. van de Weg

Test etag cache key changing value

parent 7ec89692
......@@ -202,11 +202,16 @@ class Environment < ActiveRecord::Base
def expire_etag_cache
Gitlab::EtagCaching::Store.new.tap do |store|
store.touch(Gitlab::Routing.url_helpers
.namespace_project_environments_path(project.namespace, project))
store.touch(etag_cache_key)
end
end
def etag_cache_key
Gitlab::Routing.url_helpers.namespace_project_environments_path(
project.namespace,
project)
end
private
# Slugifying a name may remove the uniqueness guarantee afforded by it being
......
......@@ -42,6 +42,18 @@ describe Environment, models: true do
end
end
describe '#expire_etag_cache' do
let(:store) { Gitlab::EtagCaching::Store.new }
it 'changes the cached value' do
old_value = store.get(environment.etag_cache_key)
environment.stop
expect(store.get(environment.etag_cache_key)).not_to eq(old_value)
end
end
describe '#nullify_external_url' do
it 'replaces a blank url with nil' do
env = build(:environment, external_url: "")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment