-
Notifications
You must be signed in to change notification settings - Fork 23
Attributes matcher #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
Conversation
RSpec core matchers already have a `have_attributes` matcher. The matcher is extended to check strictly the number of attributes. Closes #4
@gabrielgasser @mkamensky I will appreciate your feedback on this please. 🙇♂️ |
Thanks. As far as I understand, this only allows to check that the list of attributes is precisely the given one. In my case, I would like to make sure it is a subset, but I might not know in advance the full list of attributes. |
@mkamensky by default it allows to check only a subset, use |
But what I need is the other inclusion: I wish check that the actual attributes are contained in the ones I provide |
@mkamensky I don't understand. Could you explain what exactly is not working here?!
|
@stas I would like expect(document['data']).to have_jsonapi_attributes_in(:name, :email) to pass if the only attribute in the document is |
@mkamensky this doesn't make sense to me. What are you trying to achieve here? As a solution, just use |
You can also just use |
The api might return different results, depending on the situation, and I do not wish to analyse precisely what that will. I only want to make sure that it does not return attributes the user is not authorized to see |
Anyway, I'm not insisting on including it if you don't find it useful, I can simply keep it for my project |
@mkamensky I'm sorry but I'll be closing your requests. We already provided you with a couple of ways to solve your issue. But we can not accept and maintain some very specific matchers based on the users business logic. Please consider either using |
What is the current behavior?
There's a conflicting matcher named
have_attributes
, with therspec-expectations
gem.What is the new behavior?
The old matcher is now
have_jsonapi_attributes
.Support for #12 was also added.
Checklist
Please make sure the following requirements are complete:
features)