Skip to content

Replace custom be_yaml_equivalent_to matcher with Canon gem#23

Merged
ronaldtse merged 1 commit intomainfrom
copilot/replace-custom-implementation-with-canon
Mar 27, 2026
Merged

Replace custom be_yaml_equivalent_to matcher with Canon gem#23
ronaldtse merged 1 commit intomainfrom
copilot/replace-custom-implementation-with-canon

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

  • Explore repository and understand custom be_yaml_equivalent_to implementation
  • Research Canon gem (lutaml/canon) and its RSpec matchers API
  • Add canon gem to Gemfile as a test dependency
  • Remove diffy from unitsdb.gemspec (it was only used by the custom YAML matcher in spec, not in any lib code)
  • Update spec/spec_helper.rb: remove custom be_yaml_equivalent_to matcher and replace with require "canon"
  • Fix RuboCop offense: sort gem "canon" before nokogiri alphabetically in Gemfile
  • All tests and RuboCop checks pass
Original prompt

Replace the custom implementation in the unitsdb-ruby gem with the Canon library, integrating it for serialization comparison tasks. Update the relevant areas in the repository by removing manual implementations and ensuring Canon is used seamlessly in its place. Ensure necessary tests are updated or added to reflect the changes while maintaining or exceeding the current code coverage.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Work on this to use Canon to replace the custom implementation in this gem

Assistant: It seems like you're referring to issue #11 in the repository unitsml/unitsdb-ruby. The request to "use Canon to replace the custom implementation" suggests a desire to substitute a custom-built solution for one provided by the Canon library.

I'll need to gather information about the repository and the issue to ensure the changes are made appropriately in the pull request. Let me retrieve details about the issue before proceeding.

Assistant: The issue titled "Move be_yaml_equivalent_to method into the xml-c14 gem which should be renamed" on the repository unitsml/unitsdb-ruby includes the following details:

Description:
The xml-c14 gem was designed to compare XML regardless of specific key orders, and an analogous YAML implementation has been developed. The suggestion is to merge these functionalities into a new "serialization rspec matcher" gem covering all serialization formats.

  • Label: Enhancement
  • State: Open
  • Created on: January 11, 2025
  • Updated on: September 30, 2025
  • Author: ronaldtse

You suggested introducing "Canon" to replace the custom implementation in this gem. Do you want me to proceed with creating a pull request for this?

User: Yes

Assistant: I've initiated the process to create a pull request to replace the custom implementation with the Canon library for the unitsdb-ruby gem. Let me know if there are any specific requirements or updates you'd like to include!

This pull request was created from Copilot chat.


⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

Copilot AI changed the title [WIP] Replace custom implementation with Canon library for serialization comparison Replace custom be_yaml_equivalent_to matcher with Canon gem Mar 27, 2026
Copilot AI requested a review from ronaldtse March 27, 2026 11:47
@ronaldtse
Copy link
Copy Markdown
Contributor

@copilot fix the rubocop error in the runs.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 27, 2026

@copilot fix the rubocop error in the runs.

Fixed in 4faea7bgem "canon" was alphabetically out of order in the Gemfile (after nokogiri). Moved it before nokogiri to satisfy RuboCop's Bundler/OrderedGems cop.

@ronaldtse ronaldtse marked this pull request as ready for review March 27, 2026 13:09
@ronaldtse ronaldtse force-pushed the copilot/replace-custom-implementation-with-canon branch from 4faea7b to 921b672 Compare March 27, 2026 13:11
@ronaldtse ronaldtse merged commit f574fdf into main Mar 27, 2026
7 checks passed
@ronaldtse ronaldtse deleted the copilot/replace-custom-implementation-with-canon branch March 27, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants