Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
33 changes: 1 addition & 32 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
end

require "yaml"
require "diffy"
require "canon"

# Define a helper method for capturing standard output/error
def capture_output
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion unitsdb.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading