Queue XmppSetAvatarJob when new avatar is uploaded
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Release Drafter / Update release notes draft (pull_request) Failing after 10m9s

And let job do nothing in development for now
This commit is contained in:
2025-05-15 22:04:25 +04:00
parent 5916969447
commit 5f276ff349
3 changed files with 19 additions and 7 deletions

View File

@@ -46,6 +46,8 @@ RSpec.describe 'Profile settings', type: :feature do
feature "Update avatar" do
scenario "fails with validation error for wrong content type" do
expect(LdapManager::UpdateAvatar).not_to receive(:call)
visit setting_path(:profile)
attach_file "Avatar", "#{Rails.root}/spec/fixtures/files/bitcoin.pdf"
click_button "Save"
@@ -57,8 +59,7 @@ 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)
expect(LdapManager::UpdateAvatar).not_to receive(:call)
visit setting_path(:profile)
attach_file "Avatar", "#{Rails.root}/spec/fixtures/files/fsociety-irc.png"
@@ -73,8 +74,12 @@ RSpec.describe 'Profile settings', type: :feature do
scenario 'works with valid JPG file' do
file_path = "#{Rails.root}/spec/fixtures/files/taipei.jpg"
expect_any_instance_of(LdapManager::UpdateAvatar)
.to receive(:replace_attribute).and_return(true)
expect(LdapManager::UpdateAvatar)
.to receive(:call).with(user: user)
.and_return(true)
expect(XmppSetAvatarJob)
.to receive(:perform_later).with(user: user)
.and_return(true)
visit setting_path(:profile)
attach_file "Avatar", file_path
@@ -89,8 +94,12 @@ RSpec.describe 'Profile settings', type: :feature do
scenario 'works with valid PNG file' do
file_path = "#{Rails.root}/spec/fixtures/files/bender.png"
expect_any_instance_of(LdapManager::UpdateAvatar)
.to receive(:replace_attribute).and_return(true)
expect(LdapManager::UpdateAvatar)
.to receive(:call).with(user: user)
.and_return(true)
expect(XmppSetAvatarJob)
.to receive(:perform_later).with(user: user)
.and_return(true)
visit setting_path(:profile)
attach_file "Avatar", file_path