BigW Consortium Gitlab

avatars_controller_spec.rb 438 Bytes
Newer Older
1 2 3
require 'spec_helper'

describe Profiles::AvatarsController do
4
  let(:user)    { create(:user, avatar: fixture_file_upload(Rails.root + "spec/fixtures/dk.png")) }
5 6 7 8 9 10

  before do
    sign_in(user)
    controller.instance_variable_set(:@user, user)
  end

11
  it 'removes avatar from DB by calling destroy' do
12 13 14 15 16 17
    delete :destroy
    @user = assigns(:user)
    expect(@user.avatar.present?).to be_falsey
    expect(@user).to be_valid
  end
end