From baa69975e2510763a8d2ea76970b1d9268568b4f Mon Sep 17 00:00:00 2001 From: HassanAkbar Date: Mon, 29 Apr 2024 18:31:40 +0500 Subject: [PATCH 1/2] updating glossarist version to fix concept ids --- spec/tc211/termbase_spec.rb | 23 +++++++++++++++++++---- tc211-termbase.gemspec | 2 +- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/spec/tc211/termbase_spec.rb b/spec/tc211/termbase_spec.rb index 0cc2814..01fce59 100644 --- a/spec/tc211/termbase_spec.rb +++ b/spec/tc211/termbase_spec.rb @@ -26,11 +26,26 @@ end end - context "localized_concept count" do - let(:localized_concepts_count) { Dir.glob("concepts/localized_concept/*").count } + context "localized_concept" do + describe "validate count" do + let(:localized_concepts_count) { Dir.glob("concepts/localized_concept/*").count } - it "should to be 193" do - expect(localized_concepts_count).to eq(193) + it "should to be 193" do + expect(localized_concepts_count).to eq(193) + end + end + + describe "validate uuids" do + let(:localized_concept_files) { Dir.glob("concepts/localized_concept/*") } + + it "should match filenames to ids" do + localized_concept_files.each do |localized_concept_file| + filename = File.basename(localized_concept_file, ".yaml") + localized_concept = YAML.load(File.read(localized_concept_file), permitted_classes: [Date, Time]) + + expect(localized_concept["id"]).to eq(filename) + end + end end end diff --git a/tc211-termbase.gemspec b/tc211-termbase.gemspec index d07bb8d..b54bc30 100644 --- a/tc211-termbase.gemspec +++ b/tc211-termbase.gemspec @@ -24,7 +24,7 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency "creek" spec.add_runtime_dependency "relaton" - spec.add_runtime_dependency "glossarist", "~> 2.0" + spec.add_runtime_dependency "glossarist", "~> 2.1" spec.add_development_dependency "bundler" spec.add_development_dependency "rake", "~> 13.0" From f327c0acbc55a3e372232c7c26d0220073447afa Mon Sep 17 00:00:00 2001 From: HassanAkbar Date: Mon, 29 Apr 2024 18:37:26 +0500 Subject: [PATCH 2/2] fixing hound comments --- spec/tc211/termbase_spec.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/spec/tc211/termbase_spec.rb b/spec/tc211/termbase_spec.rb index 01fce59..11dff6f 100644 --- a/spec/tc211/termbase_spec.rb +++ b/spec/tc211/termbase_spec.rb @@ -28,7 +28,9 @@ context "localized_concept" do describe "validate count" do - let(:localized_concepts_count) { Dir.glob("concepts/localized_concept/*").count } + let(:localized_concepts_count) do + Dir.glob("concepts/localized_concept/*").count + end it "should to be 193" do expect(localized_concepts_count).to eq(193) @@ -36,12 +38,17 @@ end describe "validate uuids" do - let(:localized_concept_files) { Dir.glob("concepts/localized_concept/*") } + let(:localized_concept_files) do + Dir.glob("concepts/localized_concept/*") + end it "should match filenames to ids" do localized_concept_files.each do |localized_concept_file| filename = File.basename(localized_concept_file, ".yaml") - localized_concept = YAML.load(File.read(localized_concept_file), permitted_classes: [Date, Time]) + localized_concept = YAML.safe_load( + File.read(localized_concept_file), + permitted_classes: [Date, Time], + ) expect(localized_concept["id"]).to eq(filename) end