gitlab-org--gitlab-foss/spec/services/projects/group_links/destroy_service_spec.rb

19 lines
584 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2017-11-01 10:08:18 -04:00
require 'spec_helper'
describe Projects::GroupLinks::DestroyService, '#execute' do
let(:group_link) { create :project_group_link }
let(:project) { group_link.project }
let(:user) { create :user }
let(:subject) { described_class.new(project, user) }
it 'removes group from project' do
expect { subject.execute(group_link) }.to change { project.project_group_links.count }.from(1).to(0)
end
it 'returns false if group_link is blank' do
expect { subject.execute(nil) }.not_to change { project.project_group_links.count }
end
end