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
social cards - part 1 #1
base: master
Are you sure you want to change the base?
Conversation
This will be used by social_previews to convert the templates into images. Setup a fallback image primarily for local dev, so that this won't cause errors if authentication is missing. Caching is setup to use contents of the html/css. So it with autobust/generate a new image whenever the markup changes.
+ Being random breaks caching (since we generate cachekey by a SHA of html content) + Use Roboto for when generating via HTML/CSS to Image
+ Make rand deterministic so it doesn't break caching
When adding .png to the url, these routes will now generate an image and redirect to it. This leaves the existing pages as they were, so we're backwards compatible with all the existing links out in the world.
before do | ||
stub_request(:post, /hcti.io/). | ||
to_return(status: 200, | ||
body: '{ "url": "https://hcti.io/v1/image/6c52de9d-4d37-4008-80f8-67155589e1a1" }', |
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.
What do you think about extracting the return-url into a let
that you can re-use here and the assertions
expect(response).to render_template(:shecoded) | ||
end | ||
|
||
it "requesting png generates an image and redirects to image url" do |
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.
"requesting png ..." reads a bit funny in these descriptions of the tests, wonder if it's more clear if you just omit it
SocialPreviewsController can now render .pngs via HTML/CSS to Image.