2015-05-06 17:33:39 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Groups::AvatarsController do
|
|
|
|
let(:user) { create(:user) }
|
2018-06-05 17:18:06 -04:00
|
|
|
let(:group) { create(:group, avatar: fixture_file_upload("spec/fixtures/dk.png", "image/png")) }
|
2015-05-06 17:33:39 -04:00
|
|
|
|
|
|
|
before do
|
2016-03-20 18:09:33 -04:00
|
|
|
group.add_owner(user)
|
2015-05-06 17:33:39 -04:00
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'removes avatar from DB calling destroy' do
|
2015-05-06 17:33:39 -04:00
|
|
|
delete :destroy, group_id: group.path
|
|
|
|
@group = assigns(:group)
|
|
|
|
expect(@group.avatar.present?).to be_falsey
|
|
|
|
expect(@group).to be_valid
|
|
|
|
end
|
|
|
|
end
|