|
1 | 1 | RSpec.describe "GraphQL" do
|
2 | 2 | describe "generic edition" do
|
3 | 3 | before do
|
4 |
| - create(:live_edition, title: "My Generic Edition", base_path: "/my/generic/edition") |
| 4 | + document = create(:document, content_id: "d53db33f-d4ac-4eb3-839a-d415174eb906") |
| 5 | + @edition = create(:live_edition, document:, base_path: "/my/generic/edition") |
5 | 6 | end
|
6 | 7 |
|
7 | 8 | it "exposes generic edition fields" do
|
|
11 | 12 | edition(basePath: \"/my/generic/edition\") {
|
12 | 13 | ... on Edition {
|
13 | 14 | title
|
| 15 | + analyticsIdentifier |
| 16 | + basePath |
| 17 | + contentId |
| 18 | + description |
| 19 | + details |
| 20 | + documentType |
| 21 | + firstPublishedAt |
| 22 | + locale |
| 23 | + phase |
| 24 | + publicUpdatedAt |
| 25 | + publishingApp |
| 26 | + publishingRequestId |
| 27 | + publishingScheduledAt |
| 28 | + renderingApp |
| 29 | + scheduledPublishingDelaySeconds |
| 30 | + schemaName |
| 31 | + updatedAt |
| 32 | + withdrawnNotice { |
| 33 | + explanation |
| 34 | + withdrawnAt |
| 35 | + } |
14 | 36 | }
|
15 | 37 | }
|
16 | 38 | }",
|
|
19 | 41 | expected = {
|
20 | 42 | "data": {
|
21 | 43 | "edition": {
|
22 |
| - "title": "My Generic Edition", |
| 44 | + "analyticsIdentifier": @edition.analytics_identifier, |
| 45 | + "basePath": @edition.base_path, |
| 46 | + "contentId": @edition.content_id, |
| 47 | + "description": @edition.description, |
| 48 | + "details": @edition.details, |
| 49 | + "documentType": @edition.document_type, |
| 50 | + "firstPublishedAt": @edition.first_published_at.iso8601, |
| 51 | + "locale": @edition.locale, |
| 52 | + "phase": @edition.phase, |
| 53 | + "publicUpdatedAt": @edition.public_updated_at.iso8601, |
| 54 | + "publishingApp": @edition.publishing_app, |
| 55 | + "publishingRequestId": @edition.publishing_request_id, |
| 56 | + "publishingScheduledAt": nil, |
| 57 | + "renderingApp": @edition.rendering_app, |
| 58 | + "scheduledPublishingDelaySeconds": nil, |
| 59 | + "schemaName": @edition.schema_name, |
| 60 | + "title": @edition.title, |
| 61 | + "updatedAt": @edition.updated_at.iso8601, |
| 62 | + "withdrawnNotice": { |
| 63 | + "explanation": nil, |
| 64 | + "withdrawnAt": nil, |
| 65 | + }, |
23 | 66 | },
|
24 | 67 | },
|
25 |
| - }.to_json |
| 68 | + } |
26 | 69 |
|
27 |
| - expect(response.body).to eq(expected) |
| 70 | + parsed_response = JSON.parse(response.body).deep_symbolize_keys |
| 71 | + |
| 72 | + expect(parsed_response).to eq(expected) |
28 | 73 | end
|
29 | 74 |
|
30 | 75 | it "does not expose non-generic edition fields" do
|
|
0 commit comments