Extract EE specific files/lines for spec/services/lfs

We have the following files containing EE specific code. We should move them to ee/

spec/services/lfs/lock_file_service_spec.rb
diff --git a/spec/services/lfs/lock_file_service_spec.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/services/lfs/lock_file_service_spec.rb
index 3e58eea2501..62e7e6eabc2 100644
--- a/spec/services/lfs/lock_file_service_spec.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/services/lfs/lock_file_service_spec.rb
@@ -57,6 +57,26 @@ describe Lfs::LockFileService do
           expect(subject.execute[:status]).to eq(:error)
         end
       end
+
+      context 'when File Locking is available' do
+        before do
+          stub_licensed_features(file_locks: true)
+        end
+
+        it 'creates the Path Lock' do
+          expect { subject.execute }.to change { PathLock.count }.to(1)
+        end
+      end
+
+      context 'when File Locking is not available' do
+        before do
+          stub_licensed_features(file_locks: false)
+        end
+
+        it 'creates the Path Lock' do
+          expect { subject.execute }.not_to change { PathLock.count }
+        end
+      end
     end
   end
 end
spec/services/lfs/unlock_file_service_spec.rb
diff --git a/spec/services/lfs/unlock_file_service_spec.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/services/lfs/unlock_file_service_spec.rb
index fe42ca41633..968133febee 100644
--- a/spec/services/lfs/unlock_file_service_spec.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/services/lfs/unlock_file_service_spec.rb
@@ -100,6 +100,34 @@ describe Lfs::UnlockFileService do
           end
         end
       end
+
+      describe 'File Locking integraction' do
+        let(:params) { { id: lock.id } }
+        let(:current_user) { lock_author }
+
+        before do
+          project.add_developer(lock_author)
+          project.path_locks.create(path: lock.path, user: lock_author)
+        end
+
+        context 'when File Locking is available' do
+          it 'deletes the Path Lock' do
+            expect { subject.execute }.to change { PathLock.count }.to(0)
+          end
+        end
+
+        context 'when File Locking is not available' do
+          before do
+            stub_licensed_features(file_locks: false)
+          end
+
+          # For some reason RSpec is reseting the mock and
+          # License.feature_available?(:file_locks) returns true when the spec runs.
+          xit 'does not delete the Path Lock' do
+            expect { subject.execute }.not_to change { PathLock.count }
+          end
+        end
+      end
     end
   end
 end
Edited Feb 26, 2019 by Yorick Peterse
Assignee Loading
Time tracking Loading