BigW Consortium Gitlab

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

describe Groups::AvatarsController do
  let(:user)  { create(:user) }
Douwe Maan committed
5
  let(:group) { create(:group, avatar: fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png")) }
6 7

  before do
Douwe Maan committed
8
    group.add_owner(user)
9 10 11 12 13 14 15 16 17 18
    sign_in(user)
  end

  it 'destroy should remove avatar from DB' do
    delete :destroy, group_id: group.path
    @group = assigns(:group)
    expect(@group.avatar.present?).to be_falsey
    expect(@group).to be_valid
  end
end