mirror of
https://github.com/mastodon/mastodon.git
synced 2025-05-11 20:21:10 +00:00
Convert admin/settings/branding
spec controller->request (#34130)
This commit is contained in:
parent
bedf808e02
commit
325b55485e
|
@ -1,25 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Admin::Settings::BrandingController do
|
|
||||||
render_views
|
|
||||||
|
|
||||||
describe 'When signed in as an admin' do
|
|
||||||
before do
|
|
||||||
sign_in Fabricate(:admin_user), scope: :user
|
|
||||||
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
|
|
||||||
|
|
||||||
patch :update, params: { form_admin_settings: { new_setting_key: 'New key value' } }
|
|
||||||
|
|
||||||
expect(response)
|
|
||||||
.to have_http_status(400)
|
|
||||||
expect(Setting.new_setting_key).to be_nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
19
spec/requests/admin/settings/branding_spec.rb
Normal file
19
spec/requests/admin/settings/branding_spec.rb
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe 'Admin Settings Branding' do
|
||||||
|
describe 'When signed in as an admin' do
|
||||||
|
before { sign_in Fabricate(:admin_user) }
|
||||||
|
|
||||||
|
describe 'PUT /admin/settings/branding' do
|
||||||
|
it 'cannot create a setting value for a non-admin key' do
|
||||||
|
expect { put admin_settings_branding_path, params: { form_admin_settings: { new_setting_key: 'New key value' } } }
|
||||||
|
.to_not change(Setting, :new_setting_key).from(nil)
|
||||||
|
|
||||||
|
expect(response)
|
||||||
|
.to have_http_status(400)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user