WIP Store avatars as ActiveStorage attachments
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

Also push to LDAP as jpegPhoto
This commit is contained in:
2025-05-11 18:43:21 +04:00
parent 9e2210c45b
commit 17ffbde03a
8 changed files with 80 additions and 42 deletions

View File

@@ -16,8 +16,6 @@ RSpec.describe 'Profile settings', type: :feature do
.and_return({
uid: user.cn, ou: user.ou, display_name: "Mark", pgp_key: nil
})
allow_any_instance_of(User).to receive(:avatar)
.and_return(avatar_jpeg)
end
feature "Update display name" do
@@ -61,13 +59,16 @@ RSpec.describe 'Profile settings', type: :feature do
end
scenario "fails with validation error for file size too large" do
expect_any_instance_of(LdapManager::UpdateAvatar)
.not_to receive(:replace_attribute).and_return(true)
visit setting_path(:profile)
attach_file "Avatar", "#{Rails.root}/spec/fixtures/files/fsociety-irc.png"
click_button "Save"
expect(current_url).to eq(setting_url(:profile))
within ".error-msg" do
expect(page).to have_content("file size is too large")
expect(page).to have_content("must be less than 1MB")
end
end