Add haveJsonValue matcher#84
Open
EleanorRagone wants to merge 2 commits intocollectiveidea:masterfrom
Open
Conversation
Adds a helper to match a specific value in JSON
Contributor
|
This pull request has couple of flaws:
This effect can be achieved in the other ways, and that has been stated previously, see #23. That said, I would welcome matcher like this. +1, but changes are required before merge. With such matchers, I could write ActiveModel::Serializers examples like this one: describe ApiV1::SomeSerializer do
subject do
serializer_class.new(model, options).to_json
end
let(:serializer_class) { ApiV1::SomeSerializer } # this can be improved with RSpec metadata
let(:model) { SomeModel.new("What a beautiful model") }
let(:options) { Hash.new } # to be overriden in various contexts
it { is_expected.to have_json_value("What a beautiful model").at_path("pretty_name") }
endWhich would be really great. Currently I can either write Getting comparably readable effect with |
|
This PR appears dead. I would like to use this new matcher, see other PR above ^ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a helper to match a specific value in JSON