forked from berserker/microblog
Change settings area to be separated into categories in admin UI (#19407)
And update all descriptionsmain^2
parent
abf6c87ee8
commit
7c152acb2c
29 changed files with 528 additions and 296 deletions
@ -0,0 +1,9 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
class Admin::Settings::AboutController < Admin::SettingsController |
||||
private |
||||
|
||||
def after_update_redirect_path |
||||
admin_settings_about_path |
||||
end |
||||
end |
@ -0,0 +1,9 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
class Admin::Settings::AppearanceController < Admin::SettingsController |
||||
private |
||||
|
||||
def after_update_redirect_path |
||||
admin_settings_appearance_path |
||||
end |
||||
end |
@ -0,0 +1,9 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
class Admin::Settings::BrandingController < Admin::SettingsController |
||||
private |
||||
|
||||
def after_update_redirect_path |
||||
admin_settings_branding_path |
||||
end |
||||
end |
@ -0,0 +1,9 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
class Admin::Settings::ContentRetentionController < Admin::SettingsController |
||||
private |
||||
|
||||
def after_update_redirect_path |
||||
admin_settings_content_retention_path |
||||
end |
||||
end |
@ -0,0 +1,9 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
class Admin::Settings::DiscoveryController < Admin::SettingsController |
||||
private |
||||
|
||||
def after_update_redirect_path |
||||
admin_settings_discovery_path |
||||
end |
||||
end |
@ -0,0 +1,9 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
class Admin::Settings::RegistrationsController < Admin::SettingsController |
||||
private |
||||
|
||||
def after_update_redirect_path |
||||
admin_settings_registrations_path |
||||
end |
||||
end |
@ -1,11 +1,4 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
module Admin::SettingsHelper |
||||
def site_upload_delete_hint(hint, var) |
||||
upload = SiteUpload.find_by(var: var.to_s) |
||||
return hint unless upload |
||||
|
||||
link = link_to t('admin.site_uploads.delete'), admin_site_upload_path(upload), data: { method: :delete } |
||||
safe_join([hint, link], '<br/>'.html_safe) |
||||
end |
||||
end |
||||
|
@ -0,0 +1,33 @@ |
||||
- content_for :header_tags do |
||||
= javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous' |
||||
|
||||
- content_for :page_title do |
||||
= t('admin.settings.about.title') |
||||
|
||||
- content_for :heading do |
||||
%h2= t('admin.settings.title') |
||||
= render partial: 'admin/settings/shared/links' |
||||
|
||||
= simple_form_for @admin_settings, url: admin_settings_about_path, html: { method: :patch } do |f| |
||||
= render 'shared/error_messages', object: @admin_settings |
||||
|
||||
%p.lead= t('admin.settings.about.preamble') |
||||
|
||||
.fields-group |
||||
= f.input :site_extended_description, wrapper: :with_block_label, as: :text, input_html: { rows: 8 } |
||||
|
||||
%p.hint |
||||
= t 'admin.settings.about.rules_hint' |
||||
= link_to t('admin.settings.about.manage_rules'), admin_rules_path |
||||
|
||||
.fields-row |
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
= f.input :show_domain_blocks, wrapper: :with_label, collection: %i(disabled users all), label_method: lambda { |value| t("admin.settings.domain_blocks.#{value}") }, include_blank: false, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li' |
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
= f.input :show_domain_blocks_rationale, wrapper: :with_label, collection: %i(disabled users all), label_method: lambda { |value| t("admin.settings.domain_blocks.#{value}") }, include_blank: false, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li' |
||||
|
||||
.fields-group |
||||
= f.input :site_terms, wrapper: :with_block_label, as: :text, input_html: { rows: 8 } |
||||
|
||||
.actions |
||||
= f.button :button, t('generic.save_changes'), type: :submit |
@ -0,0 +1,34 @@ |
||||
- content_for :header_tags do |
||||
= javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous' |
||||
|
||||
- content_for :page_title do |
||||
= t('admin.settings.appearance.title') |
||||
|
||||
- content_for :heading do |
||||
%h2= t('admin.settings.title') |
||||
= render partial: 'admin/settings/shared/links' |
||||
|
||||
= simple_form_for @admin_settings, url: admin_settings_appearance_path, html: { method: :patch } do |f| |
||||
= render 'shared/error_messages', object: @admin_settings |
||||
|
||||
%p.lead= t('admin.settings.appearance.preamble') |
||||
|
||||
.fields-group |
||||
= f.input :theme, collection: Themes.instance.names, label_method: lambda { |theme| I18n.t("themes.#{theme}", default: theme) }, wrapper: :with_label, include_blank: false |
||||
|
||||
.fields-group |
||||
= f.input :custom_css, wrapper: :with_block_label, as: :text, input_html: { rows: 8 } |
||||
|
||||
.fields-row |
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
= f.input :mascot, as: :file, wrapper: :with_block_label |
||||
|
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
- if @admin_settings.mascot.persisted? |
||||
= image_tag @admin_settings.mascot.file.url, class: 'fields-group__thumbnail' |
||||
= link_to admin_site_upload_path(@admin_settings.mascot), data: { method: :delete }, class: 'link-button link-button--destructive' do |
||||
= fa_icon 'trash fw' |
||||
= t('admin.site_uploads.delete') |
||||
|
||||
.actions |
||||
= f.button :button, t('generic.save_changes'), type: :submit |
@ -0,0 +1,39 @@ |
||||
- content_for :header_tags do |
||||
= javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous' |
||||
|
||||
- content_for :page_title do |
||||
= t('admin.settings.branding.title') |
||||
|
||||
- content_for :heading do |
||||
%h2= t('admin.settings.title') |
||||
= render partial: 'admin/settings/shared/links' |
||||
|
||||
= simple_form_for @admin_settings, url: admin_settings_branding_path, html: { method: :patch } do |f| |
||||
= render 'shared/error_messages', object: @admin_settings |
||||
|
||||
%p.lead= t('admin.settings.branding.preamble') |
||||
|
||||
.fields-group |
||||
= f.input :site_title, wrapper: :with_label |
||||
|
||||
.fields-row |
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
= f.input :site_contact_username, wrapper: :with_label |
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
= f.input :site_contact_email, wrapper: :with_label |
||||
|
||||
.fields-group |
||||
= f.input :site_short_description, wrapper: :with_block_label, as: :text, input_html: { rows: 2, maxlength: 200 } |
||||
|
||||
.fields-row |
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
= f.input :thumbnail, as: :file, wrapper: :with_block_label |
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
- if @admin_settings.thumbnail.persisted? |
||||
= image_tag @admin_settings.thumbnail.file.url(:'@1x'), class: 'fields-group__thumbnail' |
||||
= link_to admin_site_upload_path(@admin_settings.thumbnail), data: { method: :delete }, class: 'link-button link-button--destructive' do |
||||
= fa_icon 'trash fw' |
||||
= t('admin.site_uploads.delete') |
||||
|
||||
.actions |
||||
= f.button :button, t('generic.save_changes'), type: :submit |
@ -0,0 +1,22 @@ |
||||
- content_for :header_tags do |
||||
= javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous' |
||||
|
||||
- content_for :page_title do |
||||
= t('admin.settings.content_retention.title') |
||||
|
||||
- content_for :heading do |
||||
%h2= t('admin.settings.title') |
||||
= render partial: 'admin/settings/shared/links' |
||||
|
||||
= simple_form_for @admin_settings, url: admin_settings_content_retention_path, html: { method: :patch } do |f| |
||||
= render 'shared/error_messages', object: @admin_settings |
||||
|
||||
%p.lead= t('admin.settings.content_retention.preamble') |
||||
|
||||
.fields-group |
||||
= f.input :media_cache_retention_period, wrapper: :with_block_label, input_html: { pattern: '[0-9]+' } |
||||
= f.input :content_cache_retention_period, wrapper: :with_block_label, input_html: { pattern: '[0-9]+' } |
||||
= f.input :backups_retention_period, wrapper: :with_block_label, input_html: { pattern: '[0-9]+' } |
||||
|
||||
.actions |
||||
= f.button :button, t('generic.save_changes'), type: :submit |
@ -0,0 +1,40 @@ |
||||
- content_for :header_tags do |
||||
= javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous' |
||||
|
||||
- content_for :page_title do |
||||
= t('admin.settings.discovery.title') |
||||
|
||||
- content_for :heading do |
||||
%h2= t('admin.settings.title') |
||||
= render partial: 'admin/settings/shared/links' |
||||
|
||||
= simple_form_for @admin_settings, url: admin_settings_discovery_path, html: { method: :patch } do |f| |
||||
= render 'shared/error_messages', object: @admin_settings |
||||
|
||||
%p.lead= t('admin.settings.discovery.preamble') |
||||
|
||||
%h4= t('admin.settings.discovery.trends') |
||||
|
||||
.fields-group |
||||
= f.input :trends, as: :boolean, wrapper: :with_label |
||||
|
||||
.fields-group |
||||
= f.input :trendable_by_default, as: :boolean, wrapper: :with_label |
||||
|
||||
%h4= t('admin.settings.discovery.public_timelines') |
||||
|
||||
.fields-group |
||||
= f.input :timeline_preview, as: :boolean, wrapper: :with_label |
||||
|
||||
%h4= t('admin.settings.discovery.follow_recommendations') |
||||
|
||||
.fields-group |
||||
= f.input :bootstrap_timeline_accounts, wrapper: :with_block_label |
||||
|
||||
%h4= t('admin.settings.discovery.profile_directory') |
||||
|
||||
.fields-group |
||||
= f.input :profile_directory, as: :boolean, wrapper: :with_label |
||||
|
||||
.actions |
||||
= f.button :button, t('generic.save_changes'), type: :submit |
@ -1,102 +0,0 @@ |
||||
- content_for :header_tags do |
||||
= javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous' |
||||
|
||||
- content_for :page_title do |
||||
= t('admin.settings.title') |
||||
|
||||
- content_for :heading_actions do |
||||
= button_tag t('generic.save_changes'), class: 'button', form: 'edit_admin' |
||||
|
||||
= simple_form_for @admin_settings, url: admin_settings_path, html: { method: :patch, id: 'edit_admin' } do |f| |
||||
= render 'shared/error_messages', object: @admin_settings |
||||
|
||||
.fields-group |
||||
= f.input :site_title, wrapper: :with_label, label: t('admin.settings.site_title') |
||||
|
||||
.fields-row |
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
= f.input :theme, collection: Themes.instance.names, label: t('simple_form.labels.defaults.setting_theme'), label_method: lambda { |theme| I18n.t("themes.#{theme}", default: theme) }, wrapper: :with_label, include_blank: false |
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
= f.input :registrations_mode, collection: %w(open approved none), wrapper: :with_label, label: t('admin.settings.registrations_mode.title'), include_blank: false, label_method: lambda { |mode| I18n.t("admin.settings.registrations_mode.modes.#{mode}") } |
||||
|
||||
.fields-row |
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
= f.input :site_contact_username, wrapper: :with_label, label: t('admin.settings.contact_information.username') |
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
= f.input :site_contact_email, wrapper: :with_label, label: t('admin.settings.contact_information.email') |
||||
|
||||
.fields-group |
||||
= f.input :site_short_description, wrapper: :with_block_label, as: :text, label: t('admin.settings.site_short_description.title'), hint: t('admin.settings.site_short_description.desc_html'), input_html: { rows: 2 } |
||||
|
||||
.fields-group |
||||
= f.input :site_description, wrapper: :with_block_label, as: :text, label: t('admin.settings.site_description.title'), hint: t('admin.settings.site_description.desc_html'), input_html: { rows: 2 } |
||||
|
||||
.fields-row |
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
= f.input :thumbnail, as: :file, wrapper: :with_block_label, label: t('admin.settings.thumbnail.title'), hint: site_upload_delete_hint(t('admin.settings.thumbnail.desc_html'), :thumbnail) |
||||
|
||||
.fields-row |
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
= f.input :mascot, as: :file, wrapper: :with_block_label, label: t('admin.settings.mascot.title'), hint: site_upload_delete_hint(t('admin.settings.mascot.desc_html'), :mascot) |
||||
|
||||
%hr.spacer/ |
||||
|
||||
.fields-group |
||||
= f.input :require_invite_text, as: :boolean, wrapper: :with_label, label: t('admin.settings.registrations.require_invite_text.title'), hint: t('admin.settings.registrations.require_invite_text.desc_html'), disabled: !approved_registrations? |
||||
|
||||
%hr.spacer/ |
||||
|
||||
.fields-group |
||||
= f.input :bootstrap_timeline_accounts, wrapper: :with_block_label, label: t('admin.settings.bootstrap_timeline_accounts.title'), hint: t('admin.settings.bootstrap_timeline_accounts.desc_html') |
||||
|
||||
%hr.spacer/ |
||||
|
||||
- unless whitelist_mode? |
||||
.fields-group |
||||
= f.input :timeline_preview, as: :boolean, wrapper: :with_label, label: t('admin.settings.timeline_preview.title'), hint: t('admin.settings.timeline_preview.desc_html') |
||||
|
||||
- unless whitelist_mode? |
||||
.fields-group |
||||
= f.input :activity_api_enabled, as: :boolean, wrapper: :with_label, label: t('admin.settings.activity_api_enabled.title'), hint: t('admin.settings.activity_api_enabled.desc_html'), recommended: true |
||||
|
||||
.fields-group |
||||
= f.input :peers_api_enabled, as: :boolean, wrapper: :with_label, label: t('admin.settings.peers_api_enabled.title'), hint: t('admin.settings.peers_api_enabled.desc_html'), recommended: true |
||||
|
||||
.fields-group |
||||
= f.input :preview_sensitive_media, as: :boolean, wrapper: :with_label, label: t('admin.settings.preview_sensitive_media.title'), hint: t('admin.settings.preview_sensitive_media.desc_html') |
||||
|
||||
.fields-group |
||||
= f.input :profile_directory, as: :boolean, wrapper: :with_label, label: t('admin.settings.profile_directory.title'), hint: t('admin.settings.profile_directory.desc_html') |
||||
|
||||
.fields-group |
||||
= f.input :trends, as: :boolean, wrapper: :with_label, label: t('admin.settings.trends.title'), hint: t('admin.settings.trends.desc_html') |
||||
|
||||
.fields-group |
||||
= f.input :trendable_by_default, as: :boolean, wrapper: :with_label, label: t('admin.settings.trendable_by_default.title'), hint: t('admin.settings.trendable_by_default.desc_html'), recommended: :not_recommended |
||||
|
||||
.fields-group |
||||
= f.input :noindex, as: :boolean, wrapper: :with_label, label: t('admin.settings.default_noindex.title'), hint: t('admin.settings.default_noindex.desc_html') |
||||
|
||||
%hr.spacer/ |
||||
|
||||
.fields-row |
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
= f.input :show_domain_blocks, wrapper: :with_label, collection: %i(disabled users all), label: t('admin.settings.domain_blocks.title'), label_method: lambda { |value| t("admin.settings.domain_blocks.#{value}") }, include_blank: false, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li' |
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
= f.input :show_domain_blocks_rationale, wrapper: :with_label, collection: %i(disabled users all), label: t('admin.settings.domain_blocks_rationale.title'), label_method: lambda { |value| t("admin.settings.domain_blocks.#{value}") }, include_blank: false, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li' |
||||
|
||||
.fields-group |
||||
= f.input :site_extended_description, wrapper: :with_block_label, as: :text, label: t('admin.settings.site_description_extended.title'), hint: t('admin.settings.site_description_extended.desc_html'), input_html: { rows: 8 } unless whitelist_mode? |
||||
= f.input :closed_registrations_message, as: :text, wrapper: :with_block_label, label: t('admin.settings.registrations.closed_message.title'), hint: t('admin.settings.registrations.closed_message.desc_html'), input_html: { rows: 8 } |
||||
= f.input :site_terms, wrapper: :with_block_label, as: :text, label: t('admin.settings.site_terms.title'), hint: t('admin.settings.site_terms.desc_html'), input_html: { rows: 8 } |
||||
= f.input :custom_css, wrapper: :with_block_label, as: :text, input_html: { rows: 8 }, label: t('admin.settings.custom_css.title'), hint: t('admin.settings.custom_css.desc_html') |
||||
|
||||
%hr.spacer/ |
||||
|
||||
.fields-group |
||||
= f.input :media_cache_retention_period, wrapper: :with_block_label, input_html: { pattern: '[0-9]+' } |
||||
= f.input :content_cache_retention_period, wrapper: :with_block_label, input_html: { pattern: '[0-9]+' } |
||||
= f.input :backups_retention_period, wrapper: :with_block_label, input_html: { pattern: '[0-9]+' } |
||||
|
||||
.actions |
||||
= f.button :button, t('generic.save_changes'), type: :submit |
@ -0,0 +1,27 @@ |
||||
- content_for :header_tags do |
||||
= javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous' |
||||
|
||||
- content_for :page_title do |
||||
= t('admin.settings.registrations.title') |
||||
|
||||
- content_for :heading do |
||||
%h2= t('admin.settings.title') |
||||
= render partial: 'admin/settings/shared/links' |
||||
|
||||
= simple_form_for @admin_settings, url: admin_settings_branding_path, html: { method: :patch } do |f| |
||||
= render 'shared/error_messages', object: @admin_settings |
||||
|
||||
%p.lead= t('admin.settings.registrations.preamble') |
||||
|
||||
.fields-row |
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
= f.input :registrations_mode, collection: %w(open approved none), wrapper: :with_label, include_blank: false, label_method: lambda { |mode| I18n.t("admin.settings.registrations_mode.modes.#{mode}") } |
||||
|
||||
.fields-row__column.fields-row__column-6.fields-group |
||||
= f.input :require_invite_text, as: :boolean, wrapper: :with_label, disabled: !approved_registrations? |
||||
|
||||
.fields-group |
||||
= f.input :closed_registrations_message, as: :text, wrapper: :with_block_label, input_html: { rows: 2 } |
||||
|
||||
.actions |
||||
= f.button :button, t('generic.save_changes'), type: :submit |
@ -0,0 +1,8 @@ |
||||
.content__heading__tabs |
||||
= render_navigation renderer: :links do |primary| |
||||
- primary.item :branding, safe_join([fa_icon('pencil fw'), t('admin.settings.branding.title')]), admin_settings_branding_path |
||||
- primary.item :about, safe_join([fa_icon('file-text fw'), t('admin.settings.about.title')]), admin_settings_about_path |
||||
- primary.item :registrations, safe_join([fa_icon('users fw'), t('admin.settings.registrations.title')]), admin_settings_registrations_path |
||||
- primary.item :discovery, safe_join([fa_icon('search fw'), t('admin.settings.discovery.title')]), admin_settings_discovery_path |
||||
- primary.item :content_retention, safe_join([fa_icon('history fw'), t('admin.settings.content_retention.title')]), admin_settings_content_retention_path |
||||
- primary.item :appearance, safe_join([fa_icon('desktop fw'), t('admin.settings.appearance.title')]), admin_settings_appearance_path |
@ -0,0 +1,53 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
require 'rails_helper' |
||||
|
||||
RSpec.describe Admin::Settings::BrandingController, type: :controller do |
||||
render_views |
||||
|
||||
describe 'When signed in as an admin' do |
||||
before 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 |
||||
before do |
||||
allow_any_instance_of(Form::AdminSettings).to receive(:valid?).and_return(true) |
||||
end |
||||
|
||||
around do |example| |
||||
before = Setting.site_short_description |
||||
Setting.site_short_description = nil |
||||
example.run |
||||
Setting.site_short_description = before |
||||
Setting.new_setting_key = nil |
||||
end |
||||
|
||||
it 'cannot create a setting value for a non-admin key' do |
||||
expect(Setting.new_setting_key).to be_blank |
||||
|
||||
patch :update, params: { form_admin_settings: { new_setting_key: 'New key value' } } |
||||
|
||||
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,71 +0,0 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
require 'rails_helper' |
||||
|
||||
RSpec.describe Admin::SettingsController, type: :controller do |
||||
render_views |
||||
|
||||
describe 'When signed in as an admin' do |
||||
before do |
||||
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')), scope: :user |
||||
end |
||||
|
||||
describe 'GET #edit' do |
||||
it 'returns http success' do |
||||
get :edit |
||||
|
||||
expect(response).to have_http_status(200) |
||||
end |
||||
end |
||||
|
||||
describe 'PUT #update' do |
||||
before do |
||||
allow_any_instance_of(Form::AdminSettings).to receive(:valid?).and_return(true) |
||||
end |
||||
|
||||
describe 'for a record that doesnt exist' do |
||||
around do |example| |
||||
before = Setting.site_extended_description |
||||
Setting.site_extended_description = nil |
||||
example.run |
||||
Setting.site_extended_description = before |
||||
Setting.new_setting_key = nil |
||||
end |
||||
|
||||
it 'cannot create a setting value for a non-admin key' do |
||||
expect(Setting.new_setting_key).to be_blank |
||||
|
||||
patch :update, params: { form_admin_settings: { new_setting_key: 'New key value' } } |
||||
|
||||
expect(response).to redirect_to(edit_admin_settings_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_extended_description).to be_blank |
||||
|
||||
patch :update, params: { form_admin_settings: { site_extended_description: 'New key value' } } |
||||
|
||||
expect(response).to redirect_to(edit_admin_settings_path) |
||||
expect(Setting.site_extended_description).to eq 'New key value' |
||||
end |
||||
end |
||||
|
||||
context do |
||||
around do |example| |
||||
site_title = Setting.site_title |
||||
example.run |
||||
Setting.site_title = site_title |
||||
end |
||||
|
||||
it 'updates a settings value' do |
||||
Setting.site_title = 'Original' |
||||
patch :update, params: { form_admin_settings: { site_title: 'New title' } } |
||||
|
||||
expect(response).to redirect_to(edit_admin_settings_path) |
||||
expect(Setting.site_title).to eq 'New title' |
||||
end |
||||
end |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue