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
22
spec/system/admin/settings/about_spec.rb
Normal file
22
spec/system/admin/settings/about_spec.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'Admin::Settings::About' do
|
||||
it 'Saves changes to about settings' do
|
||||
sign_in admin_user
|
||||
visit admin_settings_about_path
|
||||
|
||||
fill_in extended_description_field,
|
||||
with: 'new site description'
|
||||
|
||||
click_on submit_button
|
||||
|
||||
expect(page)
|
||||
.to have_content(success_message)
|
||||
end
|
||||
|
||||
def extended_description_field
|
||||
form_label 'form_admin_settings.site_extended_description'
|
||||
end
|
||||
end
|
22
spec/system/admin/settings/appearance_spec.rb
Normal file
22
spec/system/admin/settings/appearance_spec.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'Admin::Settings::Appearance' do
|
||||
it 'Saves changes to appearance settings' do
|
||||
sign_in admin_user
|
||||
visit admin_settings_appearance_path
|
||||
|
||||
fill_in custom_css_field,
|
||||
with: 'html { display: inline; }'
|
||||
|
||||
click_on submit_button
|
||||
|
||||
expect(page)
|
||||
.to have_content(success_message)
|
||||
end
|
||||
|
||||
def custom_css_field
|
||||
form_label 'form_admin_settings.custom_css'
|
||||
end
|
||||
end
|
37
spec/system/admin/settings/branding_spec.rb
Normal file
37
spec/system/admin/settings/branding_spec.rb
Normal file
|
@ -0,0 +1,37 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'Admin::Settings::Branding' do
|
||||
it 'Saves changes to branding settings' do
|
||||
sign_in admin_user
|
||||
visit admin_settings_branding_path
|
||||
|
||||
fill_in short_description_field,
|
||||
with: 'new key value'
|
||||
|
||||
fill_in site_contact_email_field,
|
||||
with: User.last.email
|
||||
|
||||
fill_in site_contact_username_field,
|
||||
with: Account.last.username
|
||||
|
||||
expect { click_on submit_button }
|
||||
.to change(Setting, :site_short_description).to('new key value')
|
||||
|
||||
expect(page)
|
||||
.to have_content(success_message)
|
||||
end
|
||||
|
||||
def short_description_field
|
||||
form_label 'form_admin_settings.site_short_description'
|
||||
end
|
||||
|
||||
def site_contact_email_field
|
||||
form_label 'form_admin_settings.site_contact_email'
|
||||
end
|
||||
|
||||
def site_contact_username_field
|
||||
form_label 'form_admin_settings.site_contact_username'
|
||||
end
|
||||
end
|
22
spec/system/admin/settings/content_retention_spec.rb
Normal file
22
spec/system/admin/settings/content_retention_spec.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'Admin::Settings::ContentRetention' do
|
||||
it 'Saves changes to content retention settings' do
|
||||
sign_in admin_user
|
||||
visit admin_settings_content_retention_path
|
||||
|
||||
fill_in media_cache_retention_period_field,
|
||||
with: '2'
|
||||
|
||||
click_on submit_button
|
||||
|
||||
expect(page)
|
||||
.to have_content(success_message)
|
||||
end
|
||||
|
||||
def media_cache_retention_period_field
|
||||
form_label 'form_admin_settings.media_cache_retention_period'
|
||||
end
|
||||
end
|
21
spec/system/admin/settings/discovery_spec.rb
Normal file
21
spec/system/admin/settings/discovery_spec.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'Admin::Settings::Discovery' do
|
||||
it 'Saves changes to discovery settings' do
|
||||
sign_in admin_user
|
||||
visit admin_settings_discovery_path
|
||||
|
||||
check trends_box
|
||||
|
||||
click_on submit_button
|
||||
|
||||
expect(page)
|
||||
.to have_content(success_message)
|
||||
end
|
||||
|
||||
def trends_box
|
||||
form_label 'form_admin_settings.trends'
|
||||
end
|
||||
end
|
26
spec/system/admin/settings/registrations_spec.rb
Normal file
26
spec/system/admin/settings/registrations_spec.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'Admin::Settings::Registrations' do
|
||||
it 'Saves changes to registrations settings' do
|
||||
sign_in admin_user
|
||||
visit admin_settings_registrations_path
|
||||
|
||||
select open_mode_option,
|
||||
from: registrations_mode_field
|
||||
|
||||
click_on submit_button
|
||||
|
||||
expect(page)
|
||||
.to have_content(success_message)
|
||||
end
|
||||
|
||||
def open_mode_option
|
||||
I18n.t('admin.settings.registrations_mode.modes.open')
|
||||
end
|
||||
|
||||
def registrations_mode_field
|
||||
form_label 'form_admin_settings.registrations_mode'
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue