2022-10-22 18:44:41 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
2023-05-04 12:49:53 +09:00
|
|
|
RSpec.describe Admin::Settings::BrandingController do
|
2022-10-22 18:44:41 +09:00
|
|
|
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 '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 redirect_to(admin_settings_branding_path)
|
|
|
|
expect(Setting.new_setting_key).to be_nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|