2016-03-16 22:44:33 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Groups::CreateService, services: true do
|
2016-03-18 12:28:16 +00:00
|
|
|
let!(:user) { create(:user) }
|
|
|
|
let!(:group_params) { { path: "group_path", visibility_level: Gitlab::VisibilityLevel::PUBLIC } }
|
2016-03-16 22:44:33 +00:00
|
|
|
|
|
|
|
describe "execute" do
|
2016-03-17 22:42:46 +00:00
|
|
|
let!(:service) { described_class.new(user, group_params ) }
|
2016-03-16 22:44:33 +00:00
|
|
|
subject { service.execute }
|
|
|
|
|
|
|
|
context "create groups without restricted visibility level" do
|
2016-03-17 22:42:46 +00:00
|
|
|
it { is_expected.to be_persisted }
|
2016-03-16 22:44:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context "cannot create group with restricted visibility level" do
|
2016-05-28 02:05:52 +00:00
|
|
|
before { allow_any_instance_of(ApplicationSetting).to receive(:restricted_visibility_levels).and_return([Gitlab::VisibilityLevel::PUBLIC]) }
|
2016-05-23 23:37:59 +00:00
|
|
|
it { is_expected.not_to be_persisted }
|
2016-03-16 22:44:33 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|