Add spec for updating reserved usernames setting
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Râu Cao 2023-02-19 11:56:16 +08:00
parent 25a0723166
commit df3ec9f90a
Signed by: raucao
GPG Key ID: 15E65F399D084BA9

View File

@ -0,0 +1,21 @@
require 'rails_helper'
RSpec.describe 'Admin/global settings', type: :feature do
let(:user) { create :user }
before do
allow(Devise::LDAP::Adapter).to receive(:get_ldap_param)
.with(user.cn, :admin).and_return(["true"])
login_as user, :scope => :user
end
scenario 'Update reserved usernames' do
visit admin_settings_registrations_path
expect(Setting.reserved_usernames).not_to include(['Kosmos', 'Kredits'])
fill_in 'Reserved usernames', with: "Kosmos\nKredits"
click_button "Save"
expect(Setting.reserved_usernames).to eq(['Kosmos', 'Kredits'])
end
end