Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-01 06:09:55 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-01 06:09:55 +0300
commit4ed4dc08a806773e5dc326fc0c18bda6f6ea7af7 (patch)
tree6b68c951a0fa49efd7bab988fd740012cbe5443b /spec/services/namespace_settings
parent186e045e14c941ac0b8490a0ff92694b186990ad (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/namespace_settings')
-rw-r--r--spec/services/namespace_settings/update_service_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/services/namespace_settings/update_service_spec.rb b/spec/services/namespace_settings/update_service_spec.rb
new file mode 100644
index 00000000000..2319bdcd4de
--- /dev/null
+++ b/spec/services/namespace_settings/update_service_spec.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe NamespaceSettings::UpdateService do
+ let(:user) { create(:user) }
+ let(:group) { create(:group) }
+ let(:settings) { {} }
+
+ subject(:service) { described_class.new(user, group, settings) }
+
+ describe "#execute" do
+ context "group has no namespace_settings" do
+ it "builds out a new namespace_settings record" do
+ expect do
+ service.execute
+ end.to change { NamespaceSetting.count }.by(1)
+ end
+ end
+
+ context "group has a namespace_settings" do
+ before do
+ create(:namespace_settings, namespace: group)
+
+ service.execute
+ end
+
+ it "doesn't create a new namespace_setting record" do
+ expect do
+ service.execute
+ end.not_to change { NamespaceSetting.count }
+ end
+ end
+ end
+end