Commit 1004638c authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'fix/reuse-existing-no-cache-method' into 'master'

Reuse `no_cache_headers` method in badges controller

Closes #14100

See merge request !3269
parents 4171933c 019fed0f
class Projects::BadgesController < Projects::ApplicationController class Projects::BadgesController < Projects::ApplicationController
before_action :set_no_cache before_action :no_cache_headers
def build def build
respond_to do |format| respond_to do |format|
...@@ -10,15 +10,4 @@ class Projects::BadgesController < Projects::ApplicationController ...@@ -10,15 +10,4 @@ class Projects::BadgesController < Projects::ApplicationController
end end
end end
end end
private
def set_no_cache
expires_now
# Add some deprecated headers for older agents
#
response.headers['Pragma'] = 'no-cache'
response.headers['Expires'] = 'Fri, 01 Jan 1990 00:00:00 GMT'
end
end end
...@@ -21,7 +21,7 @@ class Spinach::Features::ProjectBadgesBuild < Spinach::FeatureSteps ...@@ -21,7 +21,7 @@ class Spinach::Features::ProjectBadgesBuild < Spinach::FeatureSteps
end end
step 'I should see a badge that has not been cached' do step 'I should see a badge that has not been cached' do
expect(page.response_headers).to include('Cache-Control' => 'no-cache') expect(page.response_headers['Cache-Control']).to include 'no-cache'
end end
def expect_badge(status) def expect_badge(status)
......
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