From 72a4da83fdd2ac8a089cde208149792108783d97 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 6 Dec 2024 13:55:47 -0500 Subject: [PATCH] Merge duplicate custom css request specs (#33204) --- spec/requests/custom_css_spec.rb | 30 +++++++++++++++++++----- spec/requests/custom_stylesheets_spec.rb | 18 -------------- 2 files changed, 24 insertions(+), 24 deletions(-) delete mode 100644 spec/requests/custom_stylesheets_spec.rb diff --git a/spec/requests/custom_css_spec.rb b/spec/requests/custom_css_spec.rb index a46ebd7281..d97da00187 100644 --- a/spec/requests/custom_css_spec.rb +++ b/spec/requests/custom_css_spec.rb @@ -10,8 +10,14 @@ RSpec.describe 'Custom CSS' do it 'returns empty stylesheet' do get '/custom.css' - expect(response.content_type).to include('text/css') - expect(response.body.presence).to be_nil + expect(response) + .to have_http_status(200) + .and have_cacheable_headers + .and have_attributes( + content_type: match('text/css') + ) + expect(response.body.presence) + .to be_nil end end @@ -23,8 +29,14 @@ RSpec.describe 'Custom CSS' do it 'returns stylesheet from settings' do get '/custom.css' - expect(response.content_type).to include('text/css') - expect(response.body.strip).to eq(expected_css) + expect(response) + .to have_http_status(200) + .and have_cacheable_headers + .and have_attributes( + content_type: match('text/css') + ) + expect(response.body.strip) + .to eq(expected_css) end def expected_css @@ -44,8 +56,14 @@ RSpec.describe 'Custom CSS' do it 'returns stylesheet from settings' do get '/custom.css' - expect(response.content_type).to include('text/css') - expect(response.body.strip).to eq(expected_css) + expect(response) + .to have_http_status(200) + .and have_cacheable_headers + .and have_attributes( + content_type: match('text/css') + ) + expect(response.body.strip) + .to eq(expected_css) end def expected_css diff --git a/spec/requests/custom_stylesheets_spec.rb b/spec/requests/custom_stylesheets_spec.rb deleted file mode 100644 index 9c5c058344..0000000000 --- a/spec/requests/custom_stylesheets_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -RSpec.describe 'Custom stylesheets' do - describe 'GET /custom.css' do - before { get '/custom.css' } - - it 'returns http success' do - expect(response) - .to have_http_status(200) - .and have_cacheable_headers - .and have_attributes( - content_type: match('text/css') - ) - end - end -end