akkounts/spec/features/admin/settings_spec.rb
Garret Alfert 9b89101afc
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
Basic RemoteStorage settings
2023-04-08 21:49:16 +02:00

72 lines
2.4 KiB
Ruby

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
describe "Service settings" do
scenario "Opening service settings shows page for first service" do
visit admin_settings_services_path
expect(current_url).to eq(admin_settings_services_url(params: { s: "discourse" }))
end
scenario "View ejabberd settings" do
visit admin_settings_services_path(params: { s: "ejabberd" })
expect(page).to have_content("Enable ejabberd integration")
expect(page).to have_field("API URL",
with: "http://xmpp.example.com/api",
disabled: true)
end
scenario "Disable ejabberd integration" do
visit admin_settings_services_path(params: { s: "ejabberd" })
expect(page).to have_checked_field("setting[ejabberd_enabled]")
uncheck "setting[ejabberd_enabled]"
click_button "Save"
expect(current_url).to eq(admin_settings_services_url(params: { s: "ejabberd" }))
expect(page).to_not have_checked_field("setting[ejabberd_enabled]")
expect(page).to_not have_field("API URL", disabled: true)
end
scenario "View remoteStorage settings" do
visit admin_settings_services_path(params: { s: "remotestorage" })
expect(page).to have_content("Enable RemoteStorage integration")
expect(page).to have_field("Storage URL",
with: "https://storage.kosmos.org",
disabled: true)
end
scenario "Disable remoteStorage integration" do
visit admin_settings_services_path(params: { s: "remotestorage" })
expect(page).to have_checked_field("setting[remotestorage_enabled]")
uncheck "setting[remotestorage_enabled]"
click_button "Save"
expect(current_url).to eq(admin_settings_services_url(params: { s: "remotestorage" }))
expect(page).to_not have_checked_field("setting[remotestorage_enabled]")
expect(page).to_not have_field("Storage URL", disabled: true)
end
end
end