Skip to content
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

RFC: Better Poro Resource Test #1298

Merged
merged 1 commit into from
Dec 11, 2019
Merged

Conversation

bf4
Copy link
Collaborator

@bf4 bf4 commented Dec 2, 2019

Per cerebris/jsonapi-resources-site#45 (comment)
I'm trying to flesh out plain old resource support in JR 0.10.x

Here for comment and if good I'll bring up to standards to be mergeable

All Submissions:

  • I've checked to ensure there aren't other open Pull Requests for the same update/change.
  • I've submitted a ticket for my issue if one did not already exist.
  • My submission passes all tests. (Please run the full test suite locally to cut down on noise from travis failures.)
  • I've used Github auto-closing keywords in the commit message or the description.
  • I've added/updated tests for this change.

New Feature Submissions:

  • I've submitted an issue that describes this feature, and received the go ahead from the maintainers.
  • My submission includes new tests.
  • My submission maintains compliance with JSON:API.

Bug fixes and Changes to Core Features:

  • I've included an explanation of what the changes do and why I'd like you to include them.
  • I've provided test(s) that fails without the change.

Test Plan:

Reviewer Checklist:

  • Maintains compliance with JSON:API
  • Adequate test coverage exists to prevent regressions

attribute :name, format: :title

# This is unneeded, just here for testing
routing_options param: :id

def _save
super
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm

@bf4
Copy link
Collaborator Author

bf4 commented Dec 2, 2019

cc @scottgonzalez here's my thinking (btw, test failures seem unrelated)

  1. JR doesn't need to support a poro resource, but can document and test one and point people to use that if they wish
  2. this refactor at time of comment begins to support a pattern for a poro resource or general subclassing of basic resource
  3. next step would either be not to rely on globals in the poro resource to mimic persistence or have two basic resource subclasses 1) non ar persistence 2) non-persisted. The non-persisted one could use technique @scottgonzalez mentioned in problems with 0.10.1 changes to plain old resources  jsonapi-resources-site#45 (comment)

If the resources are not findable (perhaps they do not actually persist), you can store the created model in context in an after_create callback and then return that model in the finder (you can access context via the options argument).

Copy link
Member

@lgebhardt lgebhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

The travis failures came in with the introduction of the postgres testing.

@lgebhardt
Copy link
Member

@bf4 What do you wish to add to make this mergeable?

@bf4
Copy link
Collaborator Author

bf4 commented Dec 10, 2019

@lgebhardt I'm not sure what I might have had in mind when I first wrote the PR. Maybe add more tests around when the various 'NotImplemented' methods are used? I'd like to remove the globals, too. But really, I'm just trying to share what I've learned in trying to use 0.10.x

@lgebhardt lgebhardt merged commit 08edbc8 into cerebris:master Dec 11, 2019
@lgebhardt
Copy link
Member

@bf4 Sounds good, and thanks for the PR. I merged this as is and we can update things later.

@bf4 bf4 deleted the better_poro_test branch December 11, 2019 15:37
@bf4
Copy link
Collaborator Author

bf4 commented Apr 8, 2021

xref #1306

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