diff --git a/Gemfile b/Gemfile index ecfe332..28e5797 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,7 @@ source "https://rubygems.org" # Specify your gem's dependencies in suma.gemspec gemspec +gem "canon" gem "lutaml-model", github: "lutaml/lutaml-model", branch: "main" gem "nokogiri" gem "rake" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 830810e..eacaabf 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -16,7 +16,7 @@ end require "yaml" -require "diffy" +require "canon" # Define a helper method for capturing standard output/error def capture_output @@ -31,37 +31,6 @@ def capture_output $stderr = original_stderr end -RSpec::Matchers.define :be_yaml_equivalent_to do |expected| - match do |actual| - @actual_sorted = sort_yaml_keys(YAML.safe_load(actual)).to_yaml - @expected_sorted = sort_yaml_keys(YAML.safe_load(expected)).to_yaml - @actual_sorted == @expected_sorted - end - - def sort_yaml_keys(obj) - case obj - when Hash - obj.transform_values { |v| sort_yaml_keys(v) } - .sort.to_h - when Array - obj.map { |item| sort_yaml_keys(item) } - else - obj - end - end - - failure_message do |_actual| - diff = Diffy::Diff.new(@expected_sorted, @actual_sorted, - include_diff_info: false, - include_plus_and_minus_in_html: true, - diff_options: "-u") - - "expected YAML to be equivalent\n\n" \ - "Diff:\n" + - diff.to_s(:color) - end -end - # Configure LutaML adapters Lutaml::Model::Config.configure do |config| config.xml_adapter_type = :nokogiri diff --git a/unitsdb.gemspec b/unitsdb.gemspec index a9ad54c..b31337a 100644 --- a/unitsdb.gemspec +++ b/unitsdb.gemspec @@ -31,7 +31,6 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency "diffy" spec.add_dependency "fuzzy_match" spec.add_dependency "lutaml-model", "~> 0.8.0" spec.add_dependency "rdf", "~> 3.1"