diff --git a/.gitignore b/.gitignore index a13c469..3e35ec1 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,4 @@ pkg/*.gem .yardoc/ doc/ node_modules/ - +vendor/ diff --git a/Gemfile.lock b/Gemfile.lock index 8834648..e7baa54 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,10 +7,7 @@ PATH GEM remote: https://rubygems.org/ specs: - codeclimate-test-reporter (1.0.7) - simplecov diff-lcs (1.4.4) - docile (1.3.2) hashery (2.1.2) mini_portile2 (2.4.0) nokogiri (1.10.9) @@ -23,22 +20,16 @@ GEM rspec-expectations (2.99.2) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.99.4) - simplecov (0.18.5) - docile (~> 1.1) - simplecov-html (~> 0.11) - simplecov-html (0.12.2) yajl-ruby (1.4.1) PLATFORMS ruby DEPENDENCIES - codeclimate-test-reporter hashery (~> 2.1.1) nokogiri (~> 1.6) prismic.io! rspec (~> 2.14) - simplecov (~> 0.7) yajl-ruby BUNDLED WITH diff --git a/spec/json_parsers_spec.rb b/spec/json_parsers_spec.rb index f985141..4cb671e 100644 --- a/spec/json_parsers_spec.rb +++ b/spec/json_parsers_spec.rb @@ -355,6 +355,10 @@ raw_json = File.read("#{File.dirname(__FILE__)}/responses_mocks/document.json") json = JSON.load(raw_json) @document = Prismic::JsonParser.document_parser(json) + + graph_query_raw_json = File.read("#{File.dirname(__FILE__)}/responses_mocks/graph-query-doc.json") + gq_josn = JSON.load(graph_query_raw_json) + @gq_document = Prismic::JsonParser.document_parser(gq_josn) end it "correctly parses Document objects" do @@ -364,6 +368,8 @@ @document.tags.should == ['Macaron'] @document.slugs.should == ['vanilla-macaron', '南大沢'] @document.lang.should == 'en-us' + + @gq_document.type.should == 'show_and_tell' end it "correctly parses the document's publication dates" do diff --git a/spec/responses_mocks/graph-query-doc.json b/spec/responses_mocks/graph-query-doc.json new file mode 100644 index 0000000..5f4a0df --- /dev/null +++ b/spec/responses_mocks/graph-query-doc.json @@ -0,0 +1,37 @@ +{ + "id": "XwTHHhEAACgAEJ21", + "uid": "test-article-2", + "type": "show_and_tell", + "href":"https://testin123.cdn.prismic.io/api/v2/documents/search?ref=XwTHIhEAACUAEJ3J&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22XwTHHhEAACgAEJ21%22%29+%5D%5D", + "tags":[], + "first_publication_date":"2020-07-07T19:04:02+0000", + "last_publication_date":"2020-07-07T19:04:02+0000", + "slugs":["2020-07-07"], + "linked_documents": [{ + "id":"XwTHHhEAACgAEJ21", + "tags": [], + "type": "show_and_tell", + "slug": "2020-07-07", + "lang":"en-us" + }], + "lang": "en-us", + "alternate_languages": [], + "data": { + "show_and_tell_date": { + "type": "Date", + "value": "2020-07-07" + }, + "author":{ + "id":"XwS_RREAACcAEHrD", + "type":"marketing_developers", + "tags": [], + "slug":"andre-molnar", + "lang":"en-us", + "uid":"andremolnar", + "link_type":"Document", + "isBroken":false + }, + "subject":"Second of a kind", + "body":[] + } +} \ No newline at end of file