Add coverage for rewrite with vary username paths (#38197)

This commit is contained in:
Matt Jankowski 2026-03-13 12:54:57 -04:00 committed by GitHub
parent d26269d68b
commit ec0e78f128
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,53 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Username URL rewrites' do
describe 'GET /users/:username' do
it 'redirects to at-username page variation' do
get '/users/username'
expect(response)
.to have_http_status(301)
.and redirect_to('/@username')
expect(response.headers)
.to include('Vary' => 'Origin, Accept')
end
end
describe 'GET /users/:username/following' do
it 'redirects to at-username page variation' do
get '/users/username/following'
expect(response)
.to have_http_status(301)
.and redirect_to('/@username/following')
expect(response.headers)
.to include('Vary' => 'Origin, Accept')
end
end
describe 'GET /users/:username/followers' do
it 'redirects to at-username page variation' do
get '/users/username/followers'
expect(response)
.to have_http_status(301)
.and redirect_to('/@username/followers')
expect(response.headers)
.to include('Vary' => 'Origin, Accept')
end
end
describe 'GET /users/:username/statuses/:id' do
it 'redirects to at-username page variation' do
get '/users/username/statuses/123456'
expect(response)
.to have_http_status(301)
.and redirect_to('/@username/123456')
expect(response.headers)
.to include('Vary' => 'Origin, Accept')
end
end
end