mirror of
https://github.com/mastodon/mastodon.git
synced 2026-04-21 06:28:37 -05:00
Convert settings/preferences/appearance controller spec to system (#33323)
Some checks are pending
Check i18n / check-i18n (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (ruby) (push) Waiting to run
Check formatting / lint (push) Waiting to run
Ruby Linting / lint (push) Waiting to run
Historical data migration test / test (14-alpine) (push) Waiting to run
Historical data migration test / test (15-alpine) (push) Waiting to run
Historical data migration test / test (16-alpine) (push) Waiting to run
Historical data migration test / test (17-alpine) (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.2) (push) Blocked by required conditions
Ruby Testing / Libvips tests (.ruby-version) (push) Blocked by required conditions
Ruby Testing / Libvips tests (3.2) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Some checks are pending
Check i18n / check-i18n (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (ruby) (push) Waiting to run
Check formatting / lint (push) Waiting to run
Ruby Linting / lint (push) Waiting to run
Historical data migration test / test (14-alpine) (push) Waiting to run
Historical data migration test / test (15-alpine) (push) Waiting to run
Historical data migration test / test (16-alpine) (push) Waiting to run
Historical data migration test / test (17-alpine) (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.2) (push) Blocked by required conditions
Ruby Testing / Libvips tests (.ruby-version) (push) Blocked by required conditions
Ruby Testing / Libvips tests (3.2) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
This commit is contained in:
parent
9067a7f696
commit
efe4e72f93
|
|
@ -1,35 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Settings::Preferences::AppearanceController do
|
||||
render_views
|
||||
|
||||
let!(:user) { Fabricate(:user) }
|
||||
|
||||
before do
|
||||
sign_in user, scope: :user
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
before do
|
||||
get :show
|
||||
end
|
||||
|
||||
it 'returns http success with private cache control headers', :aggregate_failures do
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.headers['Cache-Control']).to include('private, no-store')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'PUT #update' do
|
||||
subject { put :update, params: { user: { settings_attributes: { theme: 'contrast' } } } }
|
||||
|
||||
it 'redirects correctly' do
|
||||
expect { subject }
|
||||
.to change { user.reload.settings.theme }.to('contrast')
|
||||
|
||||
expect(response).to redirect_to(settings_preferences_appearance_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
43
spec/system/settings/preferences/appearance_spec.rb
Normal file
43
spec/system/settings/preferences/appearance_spec.rb
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Settings preferences appearance page' do
|
||||
let(:user) { Fabricate :user }
|
||||
|
||||
before { sign_in user }
|
||||
|
||||
it 'Views and updates user prefs' do
|
||||
visit settings_preferences_appearance_path
|
||||
|
||||
expect(page)
|
||||
.to have_private_cache_control
|
||||
|
||||
select 'contrast', from: theme_selection_field
|
||||
check confirm_reblog_field
|
||||
uncheck confirm_delete_field
|
||||
|
||||
expect { save_changes }
|
||||
.to change { user.reload.settings.theme }.to('contrast')
|
||||
.and change { user.reload.settings['web.reblog_modal'] }.to(true)
|
||||
.and(change { user.reload.settings['web.delete_modal'] }.to(false))
|
||||
expect(page)
|
||||
.to have_title(I18n.t('settings.appearance'))
|
||||
end
|
||||
|
||||
def save_changes
|
||||
within('form') { click_on submit_button }
|
||||
end
|
||||
|
||||
def confirm_delete_field
|
||||
I18n.t('simple_form.labels.defaults.setting_delete_modal')
|
||||
end
|
||||
|
||||
def confirm_reblog_field
|
||||
I18n.t('simple_form.labels.defaults.setting_boost_modal')
|
||||
end
|
||||
|
||||
def theme_selection_field
|
||||
I18n.t('simple_form.labels.defaults.setting_theme')
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue
Block a user