From 06ecf9008b9f98a54eb4c2c0b57cdea0fdd96526 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 25 Sep 2024 03:50:15 -0400 Subject: [PATCH] Remove single-use shared examples in controller specs (#32044) --- .../settings/featured_tags_controller_spec.rb | 8 +------- .../controllers/settings/migrations_controller_spec.rb | 10 ++-------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/spec/controllers/settings/featured_tags_controller_spec.rb b/spec/controllers/settings/featured_tags_controller_spec.rb index a56ae1c49..f414e818f 100644 --- a/spec/controllers/settings/featured_tags_controller_spec.rb +++ b/spec/controllers/settings/featured_tags_controller_spec.rb @@ -5,16 +5,10 @@ require 'rails_helper' RSpec.describe Settings::FeaturedTagsController do render_views - shared_examples 'authenticate user' do - it 'redirects to sign_in page' do - expect(subject).to redirect_to new_user_session_path - end - end - context 'when user is not signed in' do subject { post :create } - it_behaves_like 'authenticate user' + it { is_expected.to redirect_to new_user_session_path } end context 'when user is signed in' do diff --git a/spec/controllers/settings/migrations_controller_spec.rb b/spec/controllers/settings/migrations_controller_spec.rb index 93c5de089..dca4c925f 100644 --- a/spec/controllers/settings/migrations_controller_spec.rb +++ b/spec/controllers/settings/migrations_controller_spec.rb @@ -5,17 +5,11 @@ require 'rails_helper' RSpec.describe Settings::MigrationsController do render_views - shared_examples 'authenticate user' do - it 'redirects to sign_in page' do - expect(subject).to redirect_to new_user_session_path - end - end - describe 'GET #show' do context 'when user is not sign in' do subject { get :show } - it_behaves_like 'authenticate user' + it { is_expected.to redirect_to new_user_session_path } end context 'when user is sign in' do @@ -49,7 +43,7 @@ RSpec.describe Settings::MigrationsController do context 'when user is not sign in' do subject { post :create } - it_behaves_like 'authenticate user' + it { is_expected.to redirect_to new_user_session_path } end context 'when user is signed in' do