debian-mirror-gitlab/spec/controllers/profiles/avatars_controller_spec.rb
2020-06-23 00:09:42 +05:30

19 lines
459 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Profiles::AvatarsController do
let(:user) { create(:user, avatar: fixture_file_upload("spec/fixtures/dk.png")) }
before do
sign_in(user)
controller.instance_variable_set(:@user, user)
end
it 'removes avatar from DB by calling destroy' do
delete :destroy
@user = assigns(:user)
expect(@user.avatar.present?).to be_falsey
expect(@user).to be_valid
end
end