2015-09-11 14:41:01 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Groups::AvatarsController do
|
|
|
|
let(:user) { create(:user) }
|
2016-06-02 11:05:42 +05:30
|
|
|
let(:group) { create(:group, avatar: fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png")) }
|
2015-09-11 14:41:01 +05:30
|
|
|
|
|
|
|
before do
|
2016-06-02 11:05:42 +05:30
|
|
|
group.add_owner(user)
|
2015-09-11 14:41:01 +05:30
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'removes avatar from DB calling destroy' do
|
2015-09-11 14:41:01 +05:30
|
|
|
delete :destroy, group_id: group.path
|
|
|
|
@group = assigns(:group)
|
|
|
|
expect(@group.avatar.present?).to be_falsey
|
|
|
|
expect(@group).to be_valid
|
|
|
|
end
|
|
|
|
end
|