Skip to content

Commit

Permalink
Use Example rather than RandomExample
Browse files Browse the repository at this point in the history
- RandomExample doesn't generate valid examples for  (at least) the get-involved schema, and it's not really necessary for this set of tests, so change this to use the standard named schemas.
  • Loading branch information
KludgeKML committed Nov 11, 2024
1 parent a4988bd commit c94c354
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions spec/support/meta_tags.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
RSpec.shared_examples "it has meta tags" do |schema, path|
before do
example_doc = GovukSchemas::RandomExample.for_schema(frontend_schema: schema) do |random|
random.merge!(
"title" => "Zhe title",
"withdrawn_notice" => {},
)
random["links"]["available_translations"] = []
random
end
example_doc = GovukSchemas::Example.find(schema, example_name: schema)
example_doc.merge!(
"title" => "Zhe title",
"withdrawn_notice" => {},
)
example_doc["links"]["available_translations"] = []

stub_content_store_has_item(path, example_doc.to_json)
end
Expand All @@ -21,16 +19,14 @@

RSpec.shared_examples "it has meta tags for images" do |schema, path|
before do
example_doc = GovukSchemas::RandomExample.for_schema(frontend_schema: schema) do |random|
random["details"].merge!(
"image" => {
"url" => "https://example.org/image.jpg",
"alt_text" => "An accessible alt text",
},
)
random["links"]["available_translations"] = []
random
end
example_doc = GovukSchemas::Example.find(schema, example_name: schema)
example_doc["details"].merge!(
"image" => {
"url" => "https://example.org/image.jpg",
"alt_text" => "An accessible alt text",
},
)
example_doc["links"]["available_translations"] = []

stub_content_store_has_item(path, example_doc.to_json)
end
Expand Down

0 comments on commit c94c354

Please sign in to comment.