-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add snapshot specs for countries query #55
Merged
Merged
Conversation
This file contains 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
AlessioRocco
force-pushed
the
add-snapshot-specs
branch
2 times, most recently
from
December 6, 2019 08:05
6a44be5
to
6d0604b
Compare
AlessioRocco
changed the base branch from
master
to
improve-execute_query-spec-helper
December 6, 2019 08:06
AlessioRocco
force-pushed
the
add-snapshot-specs
branch
3 times, most recently
from
December 6, 2019 09:56
52f0810
to
ecccb92
Compare
AlessioRocco
force-pushed
the
improve-execute_query-spec-helper
branch
from
December 6, 2019 10:07
d7f543a
to
3f70203
Compare
AlessioRocco
changed the base branch from
improve-execute_query-spec-helper
to
master
December 6, 2019 10:20
AlessioRocco
force-pushed
the
add-snapshot-specs
branch
3 times, most recently
from
December 6, 2019 10:32
b78e869
to
366b5ee
Compare
AlessioRocco
force-pushed
the
add-snapshot-specs
branch
4 times, most recently
from
December 13, 2019 10:40
d0b450c
to
b14d09a
Compare
AlessioRocco
force-pushed
the
add-snapshot-specs
branch
9 times, most recently
from
December 13, 2019 12:04
465f091
to
343f385
Compare
AlessioRocco
force-pushed
the
add-snapshot-specs
branch
2 times, most recently
from
December 13, 2019 13:04
194be47
to
7172b66
Compare
AlessioRocco
changed the title
Add snapshot specs
Add snapshot specs for countries query
Dec 13, 2019
AlessioRocco
force-pushed
the
add-snapshot-specs
branch
3 times, most recently
from
December 13, 2019 13:58
9ac20a1
to
18215d3
Compare
ChristianRimondi
previously approved these changes
Dec 13, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This custom RSpec matcher compares the result of a Graphql query with a JSON file that is stored in the folder spec/support/query_results/. The result files must have the 'json.erb' extension and supports 'erb', the variables can be set by using the method chain 'with_args', and the format can be set with 'as', for example: 'match_response('countries').with_args(current_time: current_time).as(Hash)'
The aliases are 'describe_query', 'connection_field' and 'field'. They can be used in the specs to explain better the result of a Graphql query, and they are of type "graphql_query". This type sets the subject by default through the "graphql query" shared context. The subject query can be set using a "let(:query)" or with the "query" metadata, and also the 'context' and 'variables' can be set in the same way. It also adds the "freeze_date" metadata that freeze the date with Timecop, if set to false the date will be the one set with the "DEFAULT_FREEZE_DATE" constant, instead if it is a String will be set by the given date parsed with "DateTime#parse".
Uses the 'describe_query' and 'connection_field' example groups to set the subject query and to freeze the time, and the 'match_response' custom matcher to compare the query with the result. It also adds a spec to verify the result when the countries don't exist.
All the code now is covered by the integration specs.
AlessioRocco
force-pushed
the
add-snapshot-specs
branch
from
December 13, 2019 14:06
18215d3
to
b8c71fd
Compare
ChristianRimondi
approved these changes
Dec 13, 2019
3 tasks
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.
Change specs to use snapshot results instead of test the nodes one by one.