Convert admin/settings
controller specs to system specs (#31548)
This commit is contained in:
parent
ef4920c6c9
commit
928390c2ba
14 changed files with 170 additions and 162 deletions
|
@ -1,29 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Admin::Settings::AboutController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
||||
|
||||
before do
|
||||
sign_in user, scope: :user
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
it 'returns http success' do
|
||||
get :show
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'PUT #update' do
|
||||
it 'updates the settings' do
|
||||
put :update, params: { form_admin_settings: { site_extended_description: 'new site description' } }
|
||||
|
||||
expect(response).to redirect_to(admin_settings_about_path)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,29 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Admin::Settings::AppearanceController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
||||
|
||||
before do
|
||||
sign_in user, scope: :user
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
it 'returns http success' do
|
||||
get :show
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'PUT #update' do
|
||||
it 'updates the settings' do
|
||||
put :update, params: { form_admin_settings: { custom_css: 'html { display: inline; }' } }
|
||||
|
||||
expect(response).to redirect_to(admin_settings_appearance_path)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -10,14 +10,6 @@ RSpec.describe Admin::Settings::BrandingController do
|
|||
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')), scope: :user
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
it 'returns http success' do
|
||||
get :show
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'PUT #update' do
|
||||
it 'cannot create a setting value for a non-admin key' do
|
||||
expect(Setting.new_setting_key).to be_blank
|
||||
|
@ -27,15 +19,6 @@ RSpec.describe Admin::Settings::BrandingController do
|
|||
expect(response).to redirect_to(admin_settings_branding_path)
|
||||
expect(Setting.new_setting_key).to be_nil
|
||||
end
|
||||
|
||||
it 'creates a settings value that didnt exist before for eligible key' do
|
||||
expect(Setting.site_short_description).to be_blank
|
||||
|
||||
patch :update, params: { form_admin_settings: { site_short_description: 'New key value' } }
|
||||
|
||||
expect(response).to redirect_to(admin_settings_branding_path)
|
||||
expect(Setting.site_short_description).to eq 'New key value'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Admin::Settings::ContentRetentionController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
||||
|
||||
before do
|
||||
sign_in user, scope: :user
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
it 'returns http success' do
|
||||
get :show
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'PUT #update' do
|
||||
it 'updates the settings' do
|
||||
put :update, params: { form_admin_settings: { media_cache_retention_period: '2' } }
|
||||
|
||||
expect(response).to redirect_to(admin_settings_content_retention_path)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,29 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Admin::Settings::DiscoveryController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
||||
|
||||
before do
|
||||
sign_in user, scope: :user
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
it 'returns http success' do
|
||||
get :show
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'PUT #update' do
|
||||
it 'updates the settings' do
|
||||
put :update, params: { form_admin_settings: { trends: '1' } }
|
||||
|
||||
expect(response).to redirect_to(admin_settings_discovery_path)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,29 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Admin::Settings::RegistrationsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
||||
|
||||
before do
|
||||
sign_in user, scope: :user
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
it 'returns http success' do
|
||||
get :show
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'PUT #update' do
|
||||
it 'updates the settings' do
|
||||
put :update, params: { form_admin_settings: { registrations_mode: 'open' } }
|
||||
|
||||
expect(response).to redirect_to(admin_settings_registrations_path)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue