summaryrefslogtreecommitdiff
path: root/spec/services/groups/create_service_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/groups/create_service_spec.rb')
-rw-r--r--spec/services/groups/create_service_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/services/groups/create_service_spec.rb b/spec/services/groups/create_service_spec.rb
new file mode 100644
index 00000000000..7dbc5297978
--- /dev/null
+++ b/spec/services/groups/create_service_spec.rb
@@ -0,0 +1,22 @@
+require 'spec_helper'
+
+describe Groups::CreateService, services: true do
+ let!(:user) { create(:user) }
+ let!(:private_group) { create(:group, visibility_level: Gitlab::VisibilityLevel::PRIVATE) }
+ let!(:internal_group) { create(:group, visibility_level: Gitlab::VisibilityLevel::INTERNAL) }
+ let!(:public_group) { create(:group, visibility_level: Gitlab::VisibilityLevel::PUBLIC) }
+
+ describe "execute" do
+ let!(:service) { described_class.new(public_group, user, visibility_level: Gitlab::VisibilityLevel::PUBLIC ) }
+ subject { service.execute }
+
+ context "create groups without restricted visibility level" do
+ it { is_expected.to be_truthy }
+ end
+
+ context "cannot create group with restricted visibility level" do
+ before { allow(current_application_settings).to receive(:restricted_visibility_levels).and_return([Gitlab::VisibilityLevel::PUBLIC]) }
+ it { is_expected.to be_falsy }
+ end
+ end
+end