Extract EE specific files/lines for spec/services/groups
We have the following files containing EE specific code. We should move them to ee/
spec/services/groups/create_service_spec.rb
diff --git a/spec/services/groups/create_service_spec.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/services/groups/create_service_spec.rb
index fe6a8691ae0..188780fe5aa 100644
--- a/spec/services/groups/create_service_spec.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/services/groups/create_service_spec.rb
@@ -88,6 +88,31 @@ describe Groups::CreateService, '#execute' do
end
end
+ context 'repository_size_limit assignment as Bytes' do
+ let(:admin_user) { create(:user, admin: true) }
+ let(:service) { described_class.new(admin_user, group_params.merge(opts)) }
+
+ context 'when param present' do
+ let(:opts) { { repository_size_limit: '100' } }
+
+ it 'assign repository_size_limit as Bytes' do
+ group = service.execute
+
+ expect(group.repository_size_limit).to eql(100 * 1024 * 1024)
+ end
+ end
+
+ context 'when param not present' do
+ let(:opts) { { repository_size_limit: '' } }
+
+ it 'assign nil value' do
+ group = service.execute
+
+ expect(group.repository_size_limit).to be_nil
+ end
+ end
+ end
+
describe 'creating a mattermost team' do
let!(:params) { group_params.merge(create_chat_team: "true") }
let!(:service) { described_class.new(user, params) }
spec/services/groups/destroy_service_spec.rb
diff --git a/spec/services/groups/destroy_service_spec.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/services/groups/destroy_service_spec.rb
index d80d0f5a8a8..98114ea4919 100644
--- a/spec/services/groups/destroy_service_spec.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/services/groups/destroy_service_spec.rb
@@ -82,44 +82,6 @@ describe Groups::DestroyService do
expect(Group.unscoped.count).to eq(2)
end
end
-
- context 'potential race conditions' do
- context "when the `GroupDestroyWorker` task runs immediately" do
- it "deletes the group" do
- # Commit the contents of this spec's transaction so far
- # so subsequent db connections can see it.
- #
- # DO NOT REMOVE THIS LINE, even if you see a WARNING with "No
- # transaction is currently in progress". Without this, this
- # spec will always be green, since the group created in setup
- # cannot be seen by any other connections / threads in this spec.
- Group.connection.commit_db_transaction
-
- group_record = run_with_new_database_connection do |conn|
- conn.execute("SELECT * FROM namespaces WHERE id = #{group.id}").first
- end
-
- expect(group_record).not_to be_nil
-
- # Execute the contents of `GroupDestroyWorker` in a separate thread, to
- # simulate data manipulation by the Sidekiq worker (different database
- # connection / transaction).
- expect(GroupDestroyWorker).to receive(:perform_async).and_wrap_original do |m, group_id, user_id|
- Thread.new { m[group_id, user_id] }.join(5)
- end
-
- # Kick off the initial group destroy in a new thread, so that
- # it doesn't share this spec's database transaction.
- Thread.new { described_class.new(group, user).async_execute }.join(5)
-
- group_record = run_with_new_database_connection do |conn|
- conn.execute("SELECT * FROM namespaces WHERE id = #{group.id}").first
- end
-
- expect(group_record).to be_nil
- end
- end
- end
end
describe 'synchronous delete' do
spec/services/groups/update_service_spec.rb
diff --git a/spec/services/groups/update_service_spec.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/services/groups/update_service_spec.rb
index d87a7dd234d..03a2a05e39a 100644
--- a/spec/services/groups/update_service_spec.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/services/groups/update_service_spec.rb
@@ -82,6 +82,31 @@ describe Groups::UpdateService do
end
end
+ context 'repository_size_limit assignment as Bytes' do
+ let(:group) { create(:group, :public, repository_size_limit: 0) }
+ let(:service) { described_class.new(group, user, opts) }
+
+ context 'when param present' do
+ let(:opts) { { repository_size_limit: '100' } }
+
+ it 'converts from MB to Bytes' do
+ service.execute
+
+ expect(group.reload.repository_size_limit).to eql(100 * 1024 * 1024)
+ end
+ end
+
+ context 'when param not present' do
+ let(:opts) { { repository_size_limit: '' } }
+
+ it 'assign nil value' do
+ service.execute
+
+ expect(group.reload.repository_size_limit).to be_nil
+ end
+ end
+ end
+
context "unauthorized visibility_level validation" do
let!(:service) { described_class.new(internal_group, user, visibility_level: 99) }
before do
Should be straightforward, except spec/services/groups/destroy_service_spec.rb
which we removed a test and I don't know why. Need to figure it out.
Edited by Yorick Peterse