gitlab-org--gitlab-foss/spec/controllers/profiles/avatars_controller_spec.rb
Stan Hu bf4b438459 Fix bug where avatar filenames were not actually deleted from the database during removal.
This would result in a 404 error in certain views.

The `save` call was being rolled back due to an error in the validation step.
Relax the validation step so that this works.

Closes #1570
2015-05-07 10:00:35 -07:00

17 lines
433 B
Ruby

require 'spec_helper'
describe Profiles::AvatarsController do
let(:user) { create(:user, avatar: fixture_file_upload(Rails.root + "spec/fixtures/dk.png")) }
before do
sign_in(user)
controller.instance_variable_set(:@user, user)
end
it 'destroy should remove avatar from DB' do
delete :destroy
@user = assigns(:user)
expect(@user.avatar.present?).to be_falsey
expect(@user).to be_valid
end
end