Skip to content

Add rspec matchers #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

todtb
Copy link

@todtb todtb commented Jul 22, 2021

This may or may not be useful to the larger community, but here they are if interested. Love to hear any feedback either way.

These matchers are a suplement to the existing schema specs. The schema (by necessity) cannot assert against specific adapter dependent options (PK, FK, etc), however when using with AR (or otherwise passing such options) this helps assert those are maintained.

# example:
expect(subject).to belong_to_resource(:userr).with_options(foreign_key: :user_id, resource: User)
       expected that PostResource would belong to user
       expected that foreign_key would be user_id, was user_idd
       expected that resource would be UserResource, was UsrRsource

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.

1 participant