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:
Diffstat (limited to 'spec/lib/gitlab/import_export/json/legacy_reader/file_spec.rb')
-rw-r--r--spec/lib/gitlab/import_export/json/legacy_reader/file_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/lib/gitlab/import_export/json/legacy_reader/file_spec.rb b/spec/lib/gitlab/import_export/json/legacy_reader/file_spec.rb
new file mode 100644
index 00000000000..1021ce3cd50
--- /dev/null
+++ b/spec/lib/gitlab/import_export/json/legacy_reader/file_spec.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+require_relative 'shared_example.rb'
+
+describe Gitlab::ImportExport::JSON::LegacyReader::File do
+ it_behaves_like 'import/export json legacy reader' do
+ let(:valid_path) { 'spec/fixtures/lib/gitlab/import_export/light/project.json' }
+ let(:data) { valid_path }
+ let(:json_data) { JSON.parse(File.read(valid_path)) }
+ end
+
+ describe '#exist?' do
+ let(:legacy_reader) do
+ described_class.new(path, relation_names: [])
+ end
+
+ subject { legacy_reader.exist? }
+
+ context 'given valid path' do
+ let(:path) { 'spec/fixtures/lib/gitlab/import_export/light/project.json' }
+
+ it { is_expected.to be true }
+ end
+
+ context 'given invalid path' do
+ let(:path) { 'spec/non-existing-folder/do-not-create-this-file.json' }
+
+ it { is_expected.to be false }
+ end
+ end
+end