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/database/gitlab_schema_info_spec.rb')
-rw-r--r--spec/lib/gitlab/database/gitlab_schema_info_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/lib/gitlab/database/gitlab_schema_info_spec.rb b/spec/lib/gitlab/database/gitlab_schema_info_spec.rb
new file mode 100644
index 00000000000..b37aec46de8
--- /dev/null
+++ b/spec/lib/gitlab/database/gitlab_schema_info_spec.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Database::GitlabSchemaInfo, feature_category: :cell do
+ describe '.new' do
+ it 'does ensure that name is always symbol' do
+ schema_info = described_class.new(name: 'gitlab_main')
+ expect(schema_info.name).to eq(:gitlab_main)
+ end
+
+ it 'does raise error when using invalid argument' do
+ expect { described_class.new(invalid: 'aa') }.to raise_error ArgumentError, /unknown keywords: invalid/
+ end
+ end
+
+ describe '.load_file' do
+ it 'does load YAML file and has file_path specified' do
+ file_path = Rails.root.join('db/gitlab_schemas/gitlab_main.yaml')
+ schema_info = described_class.load_file(file_path)
+
+ expect(schema_info).not_to be_nil
+ expect(schema_info.file_path).to eq(file_path)
+ end
+ end
+end