sul-dlss / cocina-models

Cocina repository data model (implemented in Ruby)
https://sul-dlss.github.io/cocina-models/
3 stars 0 forks source link

Add RSpec matchers for cocina comparisons #354

Closed mjgiarlo closed 2 years ago

mjgiarlo commented 2 years ago

Fixes #319

Why was this change made? 🤔

This commit ports Cocina matchers from other codebases (argo, dor-services-app, sdr-client) so that they are available downstream. Companion PRs in these codebases are in progress and will be ready for review once we cut the next release of cocina-models.

How was this change tested? 🤨

CI, and this change was already tested successfully in argo, dor-services-app, and sdr-client.

edsu commented 2 years ago

Would it be useful to pull some of the ones in https://github.com/sul-dlss/argo/blob/main/spec/support/cocina_matchers.rb too?

mjgiarlo commented 2 years ago

@edsu 💬

Would it be useful to pull some of the ones in https://github.com/sul-dlss/argo/blob/main/spec/support/cocina_matchers.rb too?

Yep! I think I got 'em all? What's not obvious is that cocina_object_with handles all of what cocina_object_with_access, cocina_object_with_administrative, and cocina_object_with_identification handled.

edsu commented 2 years ago

Oh, I missed that! Yeah I used a_cocina_object_with_access recently and didn't see it there.

This is not really relevant to this PR but last week I was writing a test where I wanted to check access down in structural but didn't see a way to do that without writing another matcher. Would that be possible with the matchers you have here?