23 lines
972 B
Ruby
23 lines
972 B
Ruby
require 'rails_helper'
|
||
|
||
describe "Home", type: :request do
|
||
describe "GET / on a public user's subdomain" do
|
||
let(:user) { create(:user, username: "alice", public: true) }
|
||
|
||
before { host! "#{user.username}.example.com" }
|
||
|
||
it "exposes OpenGraph tags for sharing" do
|
||
get root_path, params: { day: "2026-01-15" }
|
||
|
||
expect(response).to have_http_status(:ok)
|
||
page = Nokogiri::HTML(response.body)
|
||
meta = ->(attr, name) { page.at_css("meta[#{attr}='#{name}']")&.[]("content") }
|
||
|
||
expect(meta.("property", "og:title")).to eq("Comment ça Kluk chez alice\u202F?")
|
||
expect(meta.("property", "og:description")).to start_with("Les humeurs d’alice")
|
||
expect(meta.("property", "og:url")).to eq("http://alice.example.com/")
|
||
expect(meta.("property", "og:image")).to match(%r{\Ahttp://alice\.example\.com/assets/charte/partage-\h+\.png\z})
|
||
expect(meta.("name", "twitter:card")).to eq("summary_large_image")
|
||
end
|
||
end
|
||
end
|