mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-26 03:11:36 +01:00
Remove single-use shared examples in controller specs (#32044)
This commit is contained in:
parent
69aa5699ce
commit
06ecf9008b
2 changed files with 3 additions and 15 deletions
|
@ -5,16 +5,10 @@ require 'rails_helper'
|
||||||
RSpec.describe Settings::FeaturedTagsController do
|
RSpec.describe Settings::FeaturedTagsController do
|
||||||
render_views
|
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
|
context 'when user is not signed in' do
|
||||||
subject { post :create }
|
subject { post :create }
|
||||||
|
|
||||||
it_behaves_like 'authenticate user'
|
it { is_expected.to redirect_to new_user_session_path }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when user is signed in' do
|
context 'when user is signed in' do
|
||||||
|
|
|
@ -5,17 +5,11 @@ require 'rails_helper'
|
||||||
RSpec.describe Settings::MigrationsController do
|
RSpec.describe Settings::MigrationsController do
|
||||||
render_views
|
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
|
describe 'GET #show' do
|
||||||
context 'when user is not sign in' do
|
context 'when user is not sign in' do
|
||||||
subject { get :show }
|
subject { get :show }
|
||||||
|
|
||||||
it_behaves_like 'authenticate user'
|
it { is_expected.to redirect_to new_user_session_path }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when user is sign in' do
|
context 'when user is sign in' do
|
||||||
|
@ -49,7 +43,7 @@ RSpec.describe Settings::MigrationsController do
|
||||||
context 'when user is not sign in' do
|
context 'when user is not sign in' do
|
||||||
subject { post :create }
|
subject { post :create }
|
||||||
|
|
||||||
it_behaves_like 'authenticate user'
|
it { is_expected.to redirect_to new_user_session_path }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when user is signed in' do
|
context 'when user is signed in' do
|
||||||
|
|
Loading…
Reference in a new issue