avatars_controller_spec.rb 562 Bytes
Newer Older
1 2 3 4 5 6 7 8
require 'spec_helper'

describe Projects::AvatarsController do
  let(:project) { create(:project, avatar: fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png")) }
  let(:user)    { create(:user) }

  before do
    sign_in(user)
Douwe Maan's avatar
Douwe Maan committed
9
    project.team << [user, :master]
10 11 12 13 14 15 16 17 18
    controller.instance_variable_set(:@project, project)
  end

  it 'destroy should remove avatar from DB' do
    delete :destroy, namespace_id: project.namespace.id, project_id: project.id
    expect(project.avatar.present?).to be_falsey
    expect(project).to be_valid
  end
end