Queue XmppSetAvatarJob when new avatar is uploaded
And let job do nothing in development for now
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user